Ejemplo n.º 1
0
// A run of quavers in the treble clef
func notesTQRun(notes ...float64) s.Sound {
	sounds := make([]s.Sound, len(notes), len(notes))
	for i, note := range notes {
		sounds[i] = noteTMidi(note, 1.0)
	}
	return s.ConcatSounds(sounds...)
}
Ejemplo n.º 2
0
func SampleAddDelay() s.Sound {
	// Includes: Concat, TimedSound and MidiToSound
	return s.AddDelay(s.ConcatSounds(
		s.NewTimedSound(u.MidiToSound(55), 678),
		s.NewTimedSound(u.MidiToSound(59), 678),
		s.NewTimedSound(u.MidiToSound(62), 678),
	), 123)
}
Ejemplo n.º 3
0
func SampleMultiply() s.Sound {
	// Includes: TimedSound and SineWave
	all := make([]s.Sound, 20)
	for i := 0; i < len(all); i++ {
		all[i] = s.MultiplyWithClip(s.NewTimedSound(s.NewSineWave(659.25), 200), 0.2+float64(i)/10.0)
	}
	return s.ConcatSounds(all...)
}
Ejemplo n.º 4
0
func SampleConcat() s.Sound {
	// Includes: TimedSound and MidiToSound
	return s.ConcatSounds(
		s.NewTimedSound(u.MidiToSound(72), 400),
		s.NewTimedSound(u.MidiToSound(74), 400),
		s.NewTimedSound(u.MidiToSound(76), 400),
		s.NewTimedSound(u.MidiToSound(60), 400),
		s.NewTimedSound(u.MidiToSound(67), 1200),
	)
}
Ejemplo n.º 5
0
func SampleDenseIIR() s.Sound {
	// Includes: TimedSound and SineWave
	all := make([]s.Sound, 10)
	for i := 0; i < len(all); i++ {
		all[i] = s.NewTimedSound(s.NewSineWave(600*float64(i)/4), 200)
	}
	return s.NewDenseIIR(s.ConcatSounds(all...),
		[]float64{0.8922, -2.677, 2.677, -0.8922},
		[]float64{2.772, -2.57, 0.7961},
	)
}
Ejemplo n.º 6
0
func SampleRepeater() s.Sound {
	// Includes: Concat, TimedSound and MidiToSound
	return s.RepeatSound(s.ConcatSounds(
		s.NewTimedSound(u.MidiToSound(50), 400),
		s.NewTimedSound(u.MidiToSound(45), 400),
		s.NewTimedSound(u.MidiToSound(47), 400),
		s.NewTimedSound(u.MidiToSound(42), 400),
		s.NewTimedSound(u.MidiToSound(43), 400),
		s.NewTimedSound(u.MidiToSound(38), 400),
		s.NewTimedSound(u.MidiToSound(43), 400),
		s.NewTimedSound(u.MidiToSound(45), 400),
	), 3)
}