instruments

package
v0.0.0-...-486f928 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bank = make([]BankType, 128)
View Source
var PercussionBank = make([]BankType, 128)

Functions

This section is empty.

Types

type BandOptionsDef

type BandOptionsDef struct {
	Lowest  float64
	Highest float64
}

func (*BandOptionsDef) Validate

func (f *BandOptionsDef) Validate() error

type BankDef

type BankDef struct {
	Instruments []*InstrumentDef `json:"bank" yaml:"bank"`
	FromFile    string           `json:"-" yaml:"-"`
}

func NewBankFromYamlFile

func NewBankFromYamlFile(file string) (*BankDef, error)

func (*BankDef) Activate

func (b *BankDef) Activate(bank int)

func (*BankDef) Validate

func (b *BankDef) Validate(cfg *audio.AudioConfig) error

type BankDefType

type BankDefType func(cfg *Context) generators.Generator

type BankType

type BankType func(cfg *audio.AudioConfig) generators.Generator

func BankDefToBankType

func BankDefToBankType(def BankDefType, fromFile string) BankType

type ConstantPitchDef

type ConstantPitchDef struct {
	Pitch        float64 `json:"pitch" yaml:"pitch"`
	GeneratorDef `json:",inline" yaml:",inline"`
}

func (*ConstantPitchDef) Generator

func (t *ConstantPitchDef) Generator(ctx *Context) generators.Generator

func (*ConstantPitchDef) Validate

func (t *ConstantPitchDef) Validate(ctx *Context) error

type Context

type Context struct {
	BaseDir string
	Config  *audio.AudioConfig
}

func NewContext

func NewContext(forFile string, cfg *audio.AudioConfig) (*Context, error)

func (*Context) GetPathFor

func (c *Context) GetPathFor(file string) string

type ConvolutionOptionsDef

type ConvolutionOptionsDef struct {
	File string `json:"file" yaml:"file"`
}

func (*ConvolutionOptionsDef) Validate

func (f *ConvolutionOptionsDef) Validate() error

type DelayOptionsDef

type DelayOptionsDef struct {
	Time     float64 `json:"time" yaml:"time"`
	Factor   float64 `json:"factor" yaml:"factor"`
	Feedback float64 `json:"feedback" yaml:"feedback"`
}

func (*DelayOptionsDef) Validate

func (f *DelayOptionsDef) Validate() error

type DistortionOptionsDef

type DistortionOptionsDef struct {
	Level float64 `json:"level" yaml:"level"`
}

func (*DistortionOptionsDef) Validate

func (f *DistortionOptionsDef) Validate() error

type FilterDef

type FilterDef struct {
	FilterOptionsDef `json:",inline" yaml:",inline"`
	GeneratorDef     `json:",inline" yaml:",inline"`
}

func (*FilterDef) Generator

func (f *FilterDef) Generator(ctx *Context) generators.Generator

func (*FilterDef) Validate

func (f *FilterDef) Validate(ctx *Context) error

type FilterOptionsDef

type FilterOptionsDef struct {
	Delay       *DelayOptionsDef       `json:"delay,omitempty" yaml:"delay"`
	Overdrive   *OverdriveOptionsDef   `json:"overdrive,omitempty" yaml:"overdrive"`
	Distortion  *DistortionOptionsDef  `json:"distortion,omitempty" yaml:"distortion"`
	Flanger     *FlangerOptionsDef     `json:"flanger,omitempty" yaml:"flanger"`
	Tremelo     *TremeloOptionsDef     `json:"tremelo,omitempty" yaml:"tremelo"`
	Convolution *ConvolutionOptionsDef `json:"convolution,omitempty" yaml:"convolution"`
	LPF         *LPFOptionsDef         `json:"lpf,omitempty" yaml:"lpf"`
	HPF         *LPFOptionsDef         `json:"hpf,omitempty" yaml:"hpf"`
	BPF         *BandOptionsDef        `json:"bpf,omitempty" yaml:"bpf"`
	Sum         []*FilterOptionsDef    `json:"sum,omitempty" yaml:"sum"`
	Average     []*FilterOptionsDef    `json:"average,omitempty" yaml:"average"`
}

func (*FilterOptionsDef) Filter

func (f *FilterOptionsDef) Filter() filters.Filter

func (*FilterOptionsDef) Validate

func (f *FilterOptionsDef) Validate() error

type FlangerOptionsDef

type FlangerOptionsDef struct {
	Time   float64 `json:"time" yaml:"time"`
	Factor float64 `json:"factor" yaml:"factor"`
	Rate   float64 `json:"rate" yaml:"rate"`
}

func (*FlangerOptionsDef) Validate

func (f *FlangerOptionsDef) Validate() error

type GeneratorDef

type GeneratorDef struct {
	Filter        *FilterDef           `json:"filter,omitempty" yaml:"filter,omitempty"`
	Transpose     *TransposeDef        `json:"transpose,omitempty" yaml:"transpose,omitempty"`
	ConstantPitch *ConstantPitchDef    `json:"constant_pitch,omitempty" yaml:"constant_pitch,omitempty"`
	Sine          *GeneratorOptionsDef `json:"sine,omitempty" yaml:"sine,omitempty"`
	Square        *GeneratorOptionsDef `json:"square,omitempty" yaml:"square,omitempty"`
	Sawtooth      *GeneratorOptionsDef `json:"sawtooth,omitempty" yaml:"sawtooth,omitempty"`
	Triangle      *GeneratorOptionsDef `json:"triangle,omitempty" yaml:"triangle,omitempty"`
	WhiteNoise    *GeneratorOptionsDef `json:"white_noise,omitempty" yaml:"white_noise,omitempty"`
	Pulse         *PulseWaveDef        `json:"pulse,omitempty" yaml:"pulse,omitempty"`
	Wav           *WavOptionsDef       `json:"wav,omitempty" yaml:"wav,omitempty"`
	Grains        *GrainsOptionsDef    `json:"grains,omitempty" yaml:"grains,omitempty"`
	Combined      []*GeneratorDef      `json:"combined,omitempty" yaml:"combined,omitempty"`
	Vocoder       *VocoderDef          `json:"vocoder,omitempty" yaml:"vocoder,omitempty"`
	Panning       *PitchedPanningDef   `json:"panning,omitempty" yaml:"panning,omitempty"`
}

func (*GeneratorDef) Generator

func (d *GeneratorDef) Generator(ctx *Context) generators.Generator

func (*GeneratorDef) Validate

func (d *GeneratorDef) Validate(ctx *Context) error

type GeneratorOptionsDef

type GeneratorOptionsDef struct {
	Attack  *float64 `json:"attack" yaml:"attack"`
	Decay   *float64 `json:"decay" yaml:"decay"`
	Sustain *float64 `json:"sustain" yaml:"sustain"`
	Release *float64 `json:"release" yaml:"release"`
	Pitch   *float64 `json:"pitch" yaml:"pitch"`
}

func (*GeneratorOptionsDef) Generator

func (*GeneratorOptionsDef) Validate

func (g *GeneratorOptionsDef) Validate() error

type GrainsOptionsDef

type GrainsOptionsDef struct {
	File           string  `json:"file" yaml:"file"`
	GrainSize      float64 `json:"grain_size" yaml:"grain_size"`
	BirthRate      float64 `json:"birth_rate" yaml:"birth_rate"`
	Gain           float64 `json:"gain" yaml:"gain"`
	Repeat         bool    `json:"repeat" yaml:"repeat"`
	Density        int     `json:"density" yaml:"density"`
	Spread         float64 `json:"spread" yaml:"spread"`
	Speed          float64 `json:"speed" yaml:"speed"`
	RandomPosition float64 `json:"random_position" yaml:"random_position"`
}

func (*GrainsOptionsDef) Generator

func (w *GrainsOptionsDef) Generator(ctx *Context) generators.Generator

func (*GrainsOptionsDef) Validate

func (w *GrainsOptionsDef) Validate(ctx *Context) error

type Instrument

type Instrument BankType

func BankDefToInstrument

func BankDefToInstrument(def BankDefType, fromFile string) Instrument

type InstrumentDef

type InstrumentDef struct {
	Index        int    `json:"index" yaml:"index"`
	Name         string `json:"name" yaml:"name"`
	GeneratorDef `json:",inline" yaml:",inline"`
}

func (*InstrumentDef) Generator

func (i *InstrumentDef) Generator(ctx *Context) generators.Generator

func (*InstrumentDef) Validate

func (i *InstrumentDef) Validate(ctx *Context) error

type LPFOptionsDef

type LPFOptionsDef struct {
	Cutoff float64 `json:"cutoff" yaml:"cutoff"`
}

func (*LPFOptionsDef) Validate

func (f *LPFOptionsDef) Validate() error

type OverdriveOptionsDef

type OverdriveOptionsDef struct {
	Factor float64 `json:"factor" yaml:"factor"`
}

func (*OverdriveOptionsDef) Validate

func (f *OverdriveOptionsDef) Validate() error

type PitchedPanningDef

type PitchedPanningDef struct {
	GeneratorDef `json:",inline" yaml:",inline"`
}

func (*PitchedPanningDef) Generator

func (w *PitchedPanningDef) Generator(ctx *Context) generators.Generator

func (*PitchedPanningDef) Validate

func (w *PitchedPanningDef) Validate(ctx *Context) error

type PulseWaveDef

type PulseWaveDef struct {
	DutyCycle           float64       `json:"duty_cycle" yaml:"duty_cycle"`
	DutyCycleDepth      float64       `json:"duty_cycle_depth" yaml:"duty_cycle_depth"`
	DutyCycleModulator  *GeneratorDef `json:"duty_cycle_modulator" yaml:"duty_cycle_modulator"`
	GeneratorOptionsDef `json:",inline" yaml:",inline"`
}

func (*PulseWaveDef) Generator

func (p *PulseWaveDef) Generator(ctx *Context) generators.Generator

func (*PulseWaveDef) Validate

func (g *PulseWaveDef) Validate(ctx *Context) error

type TransposeDef

type TransposeDef struct {
	Semitones    float64 `json:"semitones" yaml:"semitones"`
	Gain         float64 `json:"gain" yaml:"gain"`
	GeneratorDef `json:",inline" yaml:",inline"`
}

func (*TransposeDef) Generator

func (t *TransposeDef) Generator(ctx *Context) generators.Generator

func (*TransposeDef) Validate

func (t *TransposeDef) Validate(ctx *Context) error

type TremeloOptionsDef

type TremeloOptionsDef struct {
	Factor float64 `json:"factor" yaml:"factor"`
	Rate   float64 `json:"rate" yaml:"rate"`
}

func (*TremeloOptionsDef) Validate

func (f *TremeloOptionsDef) Validate() error

type VocoderDef

type VocoderDef struct {
	Source  *GeneratorDef `json:"source" yaml:"source"`
	Vocoder *GeneratorDef `json:"vocoder" yaml:"vocoder"`
}

func (*VocoderDef) Generator

func (w *VocoderDef) Generator(ctx *Context) generators.Generator

func (*VocoderDef) Validate

func (w *VocoderDef) Validate(ctx *Context) error

type WavOptionsDef

type WavOptionsDef struct {
	File                string      `json:"file" yaml:"file"`
	Gain                float64     `json:"gain" yaml:"gain"`
	Pitched             bool        `json:"pitched" yaml:"pitched"`
	BasePitch           interface{} `json:"base_pitch" yaml:"base_pitch"`
	GeneratorOptionsDef `json:",inline" yaml:",inline"`
}

func (*WavOptionsDef) Generator

func (w *WavOptionsDef) Generator(ctx *Context) generators.Generator

func (*WavOptionsDef) Validate

func (w *WavOptionsDef) Validate(ctx *Context) error

Jump to

Keyboard shortcuts

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