Sound Effects¶
Sound effects can be triggered by sending an event:
def on_button_pressed(self, event, signal):
signal(PlaySound(sound=ppb.Sound('toot.ogg')))
The following sound formats are supported:
Additionally, MIDI may be supported.
Note
As is usual with assets, you should instantiate your ppb.Sound
as soon as possible, such as at the class level.
Reference¶
- class ppb.events.PlaySound(sound: ppb.assetlib.Asset)[source]
An object requested a sound be played.
Signal in an event handler to have a sound played.
Example:
signal(PlaySound(my_sound))
- sound: ppb.assetlib.Asset
A
Sound
asset.