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.assets.Asset)[source]

Fire to start a sound playing.

class ppb.Sound(name)[source]

The asset to use for sounds. A variety of file formats are supported.