Exemplo n.º 1
0
func (s *noiseForcedSines) Play(n struct{ Pitch, Amplitude []*audio.ControlPoint }) {
	releaseTime := 1.0
	s.Add(&voice{
		Pitch: audio.NewControl(n.Pitch),
		Amp:   audio.NewControl(n.Amplitude),
		rand:  rand.New(rand.NewSource(time.Now().UnixNano())),
		b:     -math.Log(.001) / 2 / releaseTime,
		RMS:   audio.NewRMS(.05),
	})
}
Exemplo n.º 2
0
func newPluckedTone(amp, freq float64) *pluckedTone {
	v := &pluckedTone{Amp: audio.NewControl([]*audio.ControlPoint{{0, -12}, {.05, amp}, {4, -12}})}
	v.Osc.SetFreq(freq)
	return v
}
Exemplo n.º 3
0
func (s *sines) Play(n struct{ Pitch, Amplitude []*audio.ControlPoint }) {
	s.Add(&sineVoice{
		Pitch: audio.NewControl(n.Pitch),
		Amp:   audio.NewControl(n.Amplitude),
	})
}