synth

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: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type        EventType
	Channel     int
	Value       string
	Values      []int
	FloatValues []float64
	Instrument  instruments.Instrument
}

func NewEvent

func NewEvent(ty EventType, channel int, values []int) *Event

func NewFloatEvent

func NewFloatEvent(ty EventType, channel int, values []float64) *Event

func NewInstrumentEvent

func NewInstrumentEvent(ty EventType, channel int, value instruments.Instrument) *Event

func NewStringEvent

func NewStringEvent(ty EventType, channel int, value string) *Event

type EventType

type EventType int
const (
	NoteOn                     EventType = iota
	NoteOff                    EventType = iota
	SetChannelVolume           EventType = iota
	SetChannelExpressionVolume EventType = iota
	SetChannelPanning          EventType = iota
	SetReverb                  EventType = iota
	SetTremelo                 EventType = iota
	SetChorus                  EventType = iota
	SetDetuneEffect            EventType = iota
	SetPhaser                  EventType = iota
	ProgramChange              EventType = iota
	SilenceChannel             EventType = iota
	PitchBend                  EventType = iota

	// Non-midi; require float value(s)
	SetReverbTime     EventType = iota
	SetReverbFeedback EventType = iota
	SetLPFCutoff      EventType = iota
	SetHPFCutoff      EventType = iota
	SetGrain          EventType = iota
	SetGrainGain      EventType = iota
	SetGrainSize      EventType = iota
	SetGrainBirthRate EventType = iota
	SetGrainDensity   EventType = iota
	SetGrainSpread    EventType = iota
	SetGrainSpeed     EventType = iota

	ToggleSoloChannel  EventType = iota
	SilenceAllChannels EventType = iota
	SetInstrument      EventType = iota

	SetMasterGain EventType = iota
	ForceUIReload EventType = iota
)

type Mixer

type Mixer struct {
	Channels         []channels.Channel
	Gain             []float64
	ExpressionVolume []float64
	Panning          []float64
	Solo             []bool
	MasterGain       float64
}

func NewMixer

func NewMixer() *Mixer

func (*Mixer) AddChannel

func (m *Mixer) AddChannel(ch channels.Channel)

func (*Mixer) ChangeInstrument

func (m *Mixer) ChangeInstrument(cfg *audio.AudioConfig, channel, instr int)

func (*Mixer) GetSamples

func (m *Mixer) GetSamples(cfg *audio.AudioConfig, n int) []int

func (*Mixer) HasSolo

func (m *Mixer) HasSolo() bool

func (*Mixer) NoteOff

func (m *Mixer) NoteOff(channel, note int)

func (*Mixer) NoteOn

func (m *Mixer) NoteOn(channel, note int, velocity float64)

func (*Mixer) SetChannelExpressionVolume

func (m *Mixer) SetChannelExpressionVolume(ch int, volume int)

func (*Mixer) SetChannelPanning

func (m *Mixer) SetChannelPanning(ch int, panning int)

func (*Mixer) SetChannelVolume

func (m *Mixer) SetChannelVolume(ch int, volume int)

func (*Mixer) SetGrainOption

func (m *Mixer) SetGrainOption(channel int, opt channels.GrainOption, value interface{})

func (*Mixer) SetHPFCutoff

func (m *Mixer) SetHPFCutoff(channel int, freq int)

func (*Mixer) SetInstrument

func (m *Mixer) SetInstrument(cfg *audio.AudioConfig, channel int, instr instruments.Instrument)

func (*Mixer) SetLPFCutoff

func (m *Mixer) SetLPFCutoff(channel int, freq int)

func (*Mixer) SetMasterGain

func (m *Mixer) SetMasterGain(g float64)

func (*Mixer) SetPitchbend

func (m *Mixer) SetPitchbend(channel int, pitchbendFactor float64)

func (*Mixer) SetReverb

func (m *Mixer) SetReverb(channel, reverb int)

func (*Mixer) SetReverbFeedback

func (m *Mixer) SetReverbFeedback(channel int, fb float64)

func (*Mixer) SetReverbTime

func (m *Mixer) SetReverbTime(channel int, time float64)

func (*Mixer) SetTremelo

func (m *Mixer) SetTremelo(channel, reverb int)

func (*Mixer) SilenceAllChannels

func (m *Mixer) SilenceAllChannels()

func (*Mixer) SilenceChannel

func (m *Mixer) SilenceChannel(ch int)

func (*Mixer) ToggleSoloChannel

func (m *Mixer) ToggleSoloChannel(ch int)

type Synth

type Synth struct {
	Config   *audio.AudioConfig
	Mixer    *Mixer
	Sinks    []sinks.Sink
	Inputs   chan *Event
	Outputs  chan *ui.UIEvent
	Debug    bool
	Recorder *sinks.WavSink
}

func NewSynth

func NewSynth(cfg *audio.AudioConfig) *Synth

func (*Synth) ChangeInstrument

func (s *Synth) ChangeInstrument(channel, instrument int)

func (*Synth) Close

func (s *Synth) Close()

func (*Synth) EnableSDLSink

func (s *Synth) EnableSDLSink() error

func (*Synth) EnableWavSink

func (s *Synth) EnableWavSink(file string) error

func (*Synth) LoadInstrumentBank

func (s *Synth) LoadInstrumentBank(file string) error

func (*Synth) LoadPercussionBank

func (s *Synth) LoadPercussionBank(file string) error

func (*Synth) SetMasterGain

func (s *Synth) SetMasterGain(v float64)

func (*Synth) Start

func (s *Synth) Start()

Jump to

Keyboard shortcuts

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