Exemple #1
0
func NewBeatsKey(idx int) Key {
	osc := snd.NewOscil(sawsine, notes[idx], snd.NewOscil(triangle, 4, nil))
	dmp := snd.NewDamp(bpm.Dur(), osc)
	d := snd.BPM(float64(bpm) * 1.25).Dur()
	dmp1 := snd.NewDamp(d, osc)
	drv := snd.NewDrive(d, osc)
	mix := snd.NewMixer(dmp, dmp1, drv)

	frz := snd.NewFreeze(bpm.Dur()*4, mix)

	adsr := snd.NewADSR(250*ms, 500*ms, 300*ms, 400*ms, 0.85, 1.0, frz)
	key := &BeatsKey{snd.NewInstrument(adsr), adsr}
	key.Off()
	return key
}
Exemple #2
0
func (key *PianoKey) Freeze() {
	key.On()
	key.frz = snd.NewFreeze(key.dur, key.gain)
	key.Instrument = snd.NewInstrument(key.frz)
	key.Off()
}