sound — Play simple sounds
The sound module contains functions for playing simple sound effects on iOS.
# Play a short melody
notes = 'C3', 'D3', 'E3', 'C3'
for note in notes:
sound.play_effect('Piano_' + note)
Functions in the sound module:
- Preload the sound effect with the given name to reduce latency when using play_effect().
- Plays the sound effect with the given name.
Playback is asynchronous, i.e. the function returns before the sound has finished playing.
- Sets the volume for all sound effects (between 0.0 and 1.0, the default is 0.1).