zeptocore

package
v0.0.0-...-9f6e23e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMetadata = fmt.Errorf("no metadata present")

define error for no metadata present

Functions

func IsBusy

func IsBusy() bool

func SetMetadata

func SetMetadata(fname string, metadata Metadata) (err error)

Types

type File

type File struct {
	Filename       string
	Duration       float64
	PathToFile     string
	PathToAudio    string
	BPM            int
	SliceStart     []float64 // fractional (0-1)
	SliceStop      []float64 // fractional (0-1)
	SliceType      []int     // 0 = normal, 1 = kick
	TempoMatch     bool
	OneShot        bool
	Channels       int  // 0 if mono, 1 if stereo
	Oversampling   int  // 1, 2, or 4
	SpliceTrigger  int  // 0, 16, 32, 48, 64, 80, 96, 112, 128
	SpliceVariable bool // 0,1 (off/on)
	// from audio_callaback.h:
	// // starts at splice start and ends at splice stop
	// #define PLAY_SPLICE_STOP 0
	// // starts at splice start, and returns to start when reaching splice boundary
	// #define PLAY_SPLICE_LOOP 1
	// // starts at splice start and ends at sample boundary
	// #define PLAY_SAMPLE_STOP 2
	// // starts at splice start and returns to start when reaching sample boundary
	// #define PLAY_SAMPLE_LOOP 3
	SplicePlayback int
	// contains filtered or unexported fields
}

func Get

func Get(pathToOriginal string) (f File, err error)

func (*File) Load

func (f *File) Load() (err error)

func (File) Regenerate

func (f File) Regenerate()

func (File) Save

func (f File) Save() (err error)

func (File) SaveNoDebounce

func (f File) SaveNoDebounce() (err error)

func (*File) SetBPM

func (f *File) SetBPM(bpm int)

func (*File) SetChannels

func (f *File) SetChannels(channels int)

func (*File) SetOneshot

func (f *File) SetOneshot(oneshot bool)

func (*File) SetOversampling

func (f *File) SetOversampling(oversampling int)

func (*File) SetSlices

func (f *File) SetSlices(sliceStart []float64, sliceEnd []float64) (sliceType []int)

func (*File) SetSplicePlayback

func (f *File) SetSplicePlayback(playback int)

func (*File) SetSpliceTrigger

func (f *File) SetSpliceTrigger(spliceTrigger int)

func (*File) SetSpliceVariable

func (f *File) SetSpliceVariable(spliceVariable bool)

func (*File) SetTempoMatch

func (f *File) SetTempoMatch(TempoMatch bool)

func (*File) UpdateSliceTypes

func (f *File) UpdateSliceTypes()

type Metadata

type Metadata struct {
	SliceStart []float64 `json:"s"`
	SliceStop  []float64 `json:"e"`
}

func GetMetadata

func GetMetadata(fname string) (metadata Metadata, err error)

type SampleInfo

type SampleInfo struct {
	Size           uint32
	Bpm            uint16 // 0-511
	PlayMode       uint16 // 0-7
	OneShot        uint16 // 0-1 (off/on)
	TempoMatch     uint16 // 0-1 (off/on)
	Oversampling   uint16 // 0-1 (1x or 2x)
	NumChannels    uint16 // 0-1 (mono or stereo)
	Version        uint16 // 0-127
	SpliceTrigger  uint16
	SpliceVariable uint16 // 0-1 (off/on)
	SliceNum       uint8  // 0-255
	SliceStart     []int32
	SliceStop      []int32
	SliceType      []int8
}

type SampleInfoPack

type SampleInfoPack struct {
	Size       uint32
	Flags      uint32 // Holds bpm, slice_num, slice_current, play_mode, one_shot, tempo_match, oversampling, and num_channels
	SpliceInfo uint16 // Holds splice_trigger and splice_variable
	SliceNum   uint8  // 0-255
	SliceStart []int32
	SliceStop  []int32
	SliceType  []int8
}

func SampleInfoMarshal

func SampleInfoMarshal(si *SampleInfo) *SampleInfoPack

func (*SampleInfoPack) WriteToFile

func (sip *SampleInfoPack) WriteToFile(filename string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL