audio

package
v0.0.0-...-bb8a734 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2015 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeyPitch = map[int]float64{
	gui.KeyZ:            -12,
	gui.KeyS:            -11,
	gui.KeyX:            -10,
	gui.KeyD:            -9,
	gui.KeyC:            -8,
	gui.KeyV:            -7,
	gui.KeyG:            -6,
	gui.KeyB:            -5,
	gui.KeyH:            -4,
	gui.KeyN:            -3,
	gui.KeyJ:            -2,
	gui.KeyM:            -1,
	gui.KeyComma:        0,
	gui.KeyL:            1,
	gui.KeyPeriod:       2,
	gui.KeySemicolon:    3,
	gui.KeySlash:        4,
	gui.KeyQ:            0,
	gui.Key2:            1,
	gui.KeyW:            2,
	gui.Key3:            3,
	gui.KeyE:            4,
	gui.KeyR:            5,
	gui.Key5:            6,
	gui.KeyT:            7,
	gui.Key6:            8,
	gui.KeyY:            9,
	gui.Key7:            10,
	gui.KeyU:            11,
	gui.KeyI:            12,
	gui.Key9:            13,
	gui.KeyO:            14,
	gui.Key0:            15,
	gui.KeyP:            16,
	gui.KeyLeftBracket:  17,
	gui.KeyEqual:        18,
	gui.KeyRightBracket: 19,
	gui.KeyBackslash:    21,
}

Functions

func PitchToFreq

func PitchToFreq(pitch float64) (freq float64)

Types

type AttackReleaseEnv

type AttackReleaseEnv struct {
	Params Params
	Out    Audio
	// contains filtered or unexported fields
}

func MakeAttackReleaseEnv

func MakeAttackReleaseEnv(attackTime float64, releaseTime float64) (x AttackReleaseEnv)

func (*AttackReleaseEnv) Attack

func (x *AttackReleaseEnv) Attack()

func (*AttackReleaseEnv) Release

func (x *AttackReleaseEnv) Release()

func (*AttackReleaseEnv) SetAttackTime

func (x *AttackReleaseEnv) SetAttackTime(x2 float64)

func (*AttackReleaseEnv) SetAudioParams

func (x *AttackReleaseEnv) SetAudioParams(params Params)

func (*AttackReleaseEnv) SetReleaseTime

func (x *AttackReleaseEnv) SetReleaseTime(x2 float64)

func (*AttackReleaseEnv) Sing

func (x2 *AttackReleaseEnv) Sing() (x Audio, done bool)

type Audio

type Audio []float64

func Add

func Add(x2 Audio, x22 Audio) (x Audio)

func Mul

func Mul(x2 Audio, x22 Audio) (x Audio)

func Sub

func Sub(x2 Audio, x3 Audio) (x Audio)

func Tanh

func Tanh(x2 Audio) (x Audio)

func (Audio) Add

func (x2 Audio) Add(x3 Audio, x4 Audio) (x Audio)

func (Audio) Mul

func (x Audio) Mul(x2 Audio, x3 Audio) (x4 Audio)

func (Audio) MulX

func (x Audio) MulX(x2 float64) (x3 Audio)

func (*Audio) SetAudioParams

func (x *Audio) SetAudioParams(p Params)

func (Audio) Tanh

func (x Audio) Tanh(x2 Audio) (x3 Audio)

func (Audio) Zero

func (x Audio) Zero()

type AudioParamSetter

type AudioParamSetter interface{ SetAudioParams(p Params) }

type Beat

type Beat struct {
	Params
	// contains filtered or unexported fields
}

func (*Beat) Beat

func (x *Beat) Beat()

type Control

type Control struct {
	Params  Params
	Periods []ControlPeriod
	Out     Audio
	// contains filtered or unexported fields
}

func NewControl

func NewControl(x []ControlPeriod) (c Control)

func (*Control) Sing

func (x *Control) Sing() (x2 Audio, done bool)

type ControlConst

type ControlConst struct {
	Duration_ float64
	Value     float64
}

func (*ControlConst) Control

func (x *ControlConst) Control(a Audio)

func (*ControlConst) Duration

func (x *ControlConst) Duration() (d float64)

type ControlExp

type ControlExp struct {
	Duration_ float64
	Value1    float64
	Value2    float64
	// contains filtered or unexported fields
}

func (*ControlExp) Control

func (x *ControlExp) Control(a Audio)

func (*ControlExp) Duration

func (x *ControlExp) Duration() (d float64)

func (*ControlExp) SetAudioParams

func (x *ControlExp) SetAudioParams(p Params)

type ControlLine

type ControlLine struct {
	Duration_ float64
	Value1    float64
	Value2    float64
	// contains filtered or unexported fields
}

func (*ControlLine) Control

func (x *ControlLine) Control(a Audio)

func (*ControlLine) Duration

func (x *ControlLine) Duration() (d float64)

func (*ControlLine) SetAudioParams

func (x *ControlLine) SetAudioParams(p Params)

type ControlPeriod

type ControlPeriod interface {
	Control(_ Audio)
	Duration() float64
}

type Instrument

type Instrument interface {
	Play(_ Note)
	Sing() (_ Audio, done bool)
}

func NewPolyphonicInstrument

func NewPolyphonicInstrument(x func(_ Note) Voice) (i Instrument)

type Line

type Line struct {
	Params Params
	Out    Audio
	// contains filtered or unexported fields
}

func (*Line) LineRate

func (x2 *Line) LineRate(rate float64) (x Audio)

type MultiVoice

type MultiVoice struct {
	Params Params
	Out    Audio
	// contains filtered or unexported fields
}

func NewMultiVoice

func NewMultiVoice() (x *MultiVoice)

func (*MultiVoice) Sing

func (x2 *MultiVoice) Sing() (x Audio, done bool)

func (*MultiVoice) StartVoice

func (x *MultiVoice) StartVoice(v Voice)

func (*MultiVoice) StopVoice

func (x *MultiVoice) StopVoice(v Voice)

type NormalOsc

type NormalOsc struct{ Sine SineOsc }

func (*NormalOsc) Osc

func (x *NormalOsc) Osc(freq float64, width float64) (x2 Audio)

type Note

type Note struct {
	Start      float64
	Attributes map[string][]ControlPeriod
}

type Params

type Params struct {
	SampleRate float64
	BufferSize int
	// contains filtered or unexported fields
}

func (*Params) Set

func (p *Params) Set(x interface{})

type Pattern

type Pattern struct {
	Params     Params
	Notes      []Note
	Instrument Instrument
	// contains filtered or unexported fields
}

func NewPattern

func NewPattern(x2 []Note, x Instrument) (x22 *Pattern)

func (*Pattern) Sing

func (x2 *Pattern) Sing() (x Audio, done bool)

type PolyphonicInstrument

type PolyphonicInstrument struct {
	*MultiVoice
	// contains filtered or unexported fields
}

func (*PolyphonicInstrument) Play

func (x *PolyphonicInstrument) Play(note Note)

type SineBeat

type SineBeat struct {
	Sine SineOsc
	Env  NormalOsc
	// contains filtered or unexported fields
}

func NewSineBeat

func NewSineBeat(amp float64, sineFreq float64, beatFreq float64, beatWidth float64) (x *SineBeat)

func (*SineBeat) Sing

func (x *SineBeat) Sing() (x2 Audio)

type SineBeats

type SineBeats struct {
	Out   Audio
	Beats []*SineBeat
}

func NewSineBeats

func NewSineBeats() (x *SineBeats)

func (*SineBeats) AddBeat

func (x *SineBeats) AddBeat(amp float64, sineFreq float64, beatFreq float64, beatWidth float64)

func (*SineBeats) Sing

func (x *SineBeats) Sing() (x2 Audio)

type SineOsc

type SineOsc struct {
	Params Params
	Out    Audio
	// contains filtered or unexported fields
}

func (*SineOsc) SineFreq

func (x2 *SineOsc) SineFreq(freq float64) (x Audio)

type Voice

type Voice interface{ Sing() (_ Audio, done bool) }

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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