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) }
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), ) }
func SampleNormalSum() s.Sound { // Includes: TimedSound and MidiToSound return s.SumSounds( s.NewTimedSound(u.MidiToSound(55), 333), s.NewTimedSound(u.MidiToSound(59), 333), s.NewTimedSound(u.MidiToSound(62), 333), s.NewTimedSound(u.MidiToSound(65), 333), s.NewTimedSound(u.MidiToSound(67), 333), ) }
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) }
// Converts a treble note offset to a midi offset func noteTMidi(note float64, quaverCount float64) s.Sound { // NOTE: Only [-8, 8] allowed for 'note'. bFloat, sharp := math.Modf(note) base := int(bFloat) if sharp < 0 { sharp += 1.0 base-- } // 0 = B = offset 8 midi := trebleMidi[base+8] + trebleKeys[base+8] if sharp > 0.1 { midi++ } midiToSound := s.NewTimedSound(util.MidiToSound(midi), quaverCount*q) return s.NewADSREnvelope(midiToSound, 15, 50, 0.5, 20) }