Пример #1
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)
}
Пример #2
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),
	)
}
Пример #3
0
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),
	)
}
Пример #4
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)
}
Пример #5
0
// 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)
}