voice

package module
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Unlicense Imports: 6 Imported by: 7

README

voice

voice is a pure Go audio instrument/voice library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableFilterEnvelope

func EnableFilterEnvelope(v Voice, enabled bool)

EnableFilterEnvelope sets the filter envelope enable flag, if the interface for it exists on the voice

func EnablePanEnvelope

func EnablePanEnvelope(v Voice, enabled bool)

EnablePanEnvelope sets the pan envelope enable flag, if the interface for it exists on the voice

func EnablePitchEnvelope

func EnablePitchEnvelope(v Voice, enabled bool)

EnablePitchEnvelope sets the pitch envelope enable flag, if the interface for it exists on the voice

func EnableVolumeEnvelope

func EnableVolumeEnvelope(v Voice, enabled bool)

EnableVolumeEnvelope sets the volume envelope enable flag, if the interface for it exists on the voice

func GetCurrentFilterEnvelope

func GetCurrentFilterEnvelope(v Voice) int8

GetCurrentFilterEnvelope returns the filter envelope's current value, if the interface for it exists on the voice

func GetFinalPan

func GetFinalPan(v Voice) panning.Position

GetFinalPan returns the final panning position from the pan modulator, if the interface for it exists on the voice

func GetFinalPeriod

func GetFinalPeriod(v Voice) period.Period

GetFinalPeriod returns the final period from the frequency modulator, if the interface for it exists on the voice

func GetFinalVolume

func GetFinalVolume(v Voice) volume.Volume

GetFinalVolume returns the final volume from the amplitude modulator, if the interface for it exists on the voice

func GetPan

func GetPan(v Voice) panning.Position

GetPan gets the period from the pan modulator, if the interface for it exists on the voice

func GetPeriod

func GetPeriod(v Voice) period.Period

GetPeriod gets the period from the frequency modulator, if the interface for it exists on the voice

func GetPeriodDelta

func GetPeriodDelta(v Voice) period.Delta

GetPeriodDelta returns the period delta from the frequency modulator, if the interface for it exists on the voice

func GetPos

func GetPos(v Voice) sampling.Pos

GetPos gets the position from the positioner, if the interface for it exists on the voice

func GetVolume

func GetVolume(v Voice) volume.Volume

GetVolume gets the volume from the amplitude modulator, if the interface for it exists on the voice

func IsVolumeEnvelopeEnabled

func IsVolumeEnvelopeEnabled(v Voice) bool

IsVolumeEnvelopeEnabled returns true if the volume envelope is enabled and the interface for it exists on the voice

func SetAllEnvelopePositions

func SetAllEnvelopePositions(v Voice, pos int)

SetEnvelopePosition sets the envelope position(s) on the voice

func SetFilterEnvelopePosition

func SetFilterEnvelopePosition(v Voice, pos int)

SetFilterEnvelopePosition sets the filter envelope position, if the interface for it exists on the voice

func SetPan

func SetPan(v Voice, pan panning.Position)

SetPan sets the period into the pan modulator, if the interface for it exists on the voice

func SetPanEnvelopePosition

func SetPanEnvelopePosition(v Voice, pos int)

SetPanEnvelopePosition sets the pan envelope position, if the interface for it exists on the voice

func SetPeriod

func SetPeriod(v Voice, period period.Period)

SetPeriod sets the period into the frequency modulator, if the interface for it exists on the voice

func SetPeriodDelta

func SetPeriodDelta(v Voice, delta period.Delta)

SetPeriodDelta sets the period delta into the frequency modulator, if the interface for it exists on the voice

func SetPitchEnvelopePosition

func SetPitchEnvelopePosition(v Voice, pos int)

SetPitchEnvelopePosition sets the pitch envelope position, if the interface for it exists on the voice

func SetPos

func SetPos(v Voice, pos sampling.Pos)

SetPos sets the position within the positioner, if the interface for it exists on the voice

func SetVolume

func SetVolume(v Voice, vol volume.Volume)

SetVolume sets the volume into the amplitude modulator, if the interface for it exists on the voice

func SetVolumeEnvelopePosition

func SetVolumeEnvelopePosition(v Voice, pos int)

SetVolumeEnvelopePosition sets the volume envelope position, if the interface for it exists on the voice

Types

type AmpModulator

type AmpModulator interface {
	SetVolume(vol volume.Volume)
	GetVolume() volume.Volume
	GetFinalVolume() volume.Volume
}

AmpModulator is the instrument volume (amplitude) control interface

type AutoVibrato

type AutoVibrato struct {
	Enabled           bool
	Sweep             int
	WaveformSelection uint8
	Depth             float32
	Rate              int
	Factory           func() oscillator.Oscillator
}

AutoVibrato is the setting and memory for the auto-vibrato system

func (*AutoVibrato) Generate

func (a *AutoVibrato) Generate() oscillator.Oscillator

Generate creates an AutoVibrato waveform oscillator and configures it with the inital values

type Callback

type Callback func(v Voice)

Callback is a callback function for performing some sort of action at a later time

type Controller

type Controller interface {
	Attack()
	Release()
	Fadeout()
	IsKeyOn() bool
	IsFadeout() bool
	IsDone() bool
	SetActive(active bool)
	IsActive() bool
}

Controller is the instrument actuation control interface

type FilterApplier

type FilterApplier interface {
	ApplyFilter(dry volume.Matrix) volume.Matrix
	SetFilterEnvelopeValue(envVal int8)
}

FilterApplier is an interface for applying a filter to a sample stream

type FilterEnveloper

type FilterEnveloper interface {
	EnableFilterEnvelope(enabled bool)
	IsFilterEnvelopeEnabled() bool
	GetCurrentFilterEnvelope() int8
	SetFilterEnvelopePosition(pos int)
}

FilterEnveloper is a filter envelope interface

type FreqModulator

type FreqModulator interface {
	SetPeriod(period period.Period)
	GetPeriod() period.Period
	SetPeriodDelta(delta period.Delta)
	GetPeriodDelta() period.Delta
	GetFinalPeriod() period.Period
}

FreqModulator is the instrument frequency control interface

type PanEnveloper

type PanEnveloper interface {
	EnablePanEnvelope(enabled bool)
	IsPanEnvelopeEnabled() bool
	GetCurrentPanEnvelope() panning.Position
	SetPanEnvelopePosition(pos int)
}

PanEnveloper is a pan envelope interface

type PanModulator

type PanModulator interface {
	SetPan(vol panning.Position)
	GetPan() panning.Position
	GetFinalPan() panning.Position
}

PanModulator is the instrument pan (spatial) control interface

type PitchEnveloper

type PitchEnveloper interface {
	EnablePitchEnvelope(enabled bool)
	IsPitchEnvelopeEnabled() bool
	GetCurrentPitchEnvelope() period.Delta
	SetPitchEnvelopePosition(pos int)
}

PitchEnveloper is a pitch envelope interface

type Positioner

type Positioner interface {
	SetPos(pos sampling.Pos)
	GetPos() sampling.Pos
}

Positioner is the instrument position (timeline) control interface

type Transaction

type Transaction interface {
	Cancel()
	Commit()
	GetVoice() Voice
	Clone() Transaction

	SetActive(active bool)
	IsPendingActive() (bool, bool)
	IsCurrentlyActive() bool

	Attack()
	Release()
	Fadeout()
	SetPeriod(period period.Period)
	GetPendingPeriod() (period.Period, bool)
	GetCurrentPeriod() period.Period
	SetPeriodDelta(delta period.Delta)
	GetPendingPeriodDelta() (period.Delta, bool)
	GetCurrentPeriodDelta() period.Delta
	SetVolume(vol volume.Volume)
	GetPendingVolume() (volume.Volume, bool)
	GetCurrentVolume() volume.Volume
	SetPos(pos sampling.Pos)
	GetPendingPos() (sampling.Pos, bool)
	GetCurrentPos() sampling.Pos
	SetPan(pan panning.Position)
	GetPendingPan() (panning.Position, bool)
	GetCurrentPan() panning.Position
	SetVolumeEnvelopePosition(pos int)
	EnableVolumeEnvelope(enabled bool)
	IsPendingVolumeEnvelopeEnabled() (bool, bool)
	IsCurrentVolumeEnvelopeEnabled() bool
	SetPitchEnvelopePosition(pos int)
	EnablePitchEnvelope(enabled bool)
	SetPanEnvelopePosition(pos int)
	EnablePanEnvelope(enabled bool)
	SetFilterEnvelopePosition(pos int)
	EnableFilterEnvelope(enabled bool)
	SetAllEnvelopePositions(pos int)
}

Transaction is an interface for updating Voice settings

type Voice

type Voice interface {
	Controller
	sampling.SampleStream

	// == required function interfaces ==
	Advance(tickDuration time.Duration)
	GetSampler(samplerRate float32) sampling.Sampler
	Clone() Voice
	StartTransaction() Transaction
}

Voice is a voice interface

type VolumeEnveloper

type VolumeEnveloper interface {
	EnableVolumeEnvelope(enabled bool)
	IsVolumeEnvelopeEnabled() bool
	GetCurrentVolumeEnvelope() volume.Volume
	SetVolumeEnvelopePosition(pos int)
}

VolumeEnveloper is a volume envelope interface

Directories

Path Synopsis
internal
pan

Jump to

Keyboard shortcuts

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