- class arcade.Sound(file_name: Union[str, Path], streaming: bool = False)#
This class represents a sound you can play.
- get_stream_position(player: Player) float #
Return where we are in the stream. This will reset back to zero when it is done playing.
player (pyglet.media.Player) – Player returned from
- get_volume(player: Player) float #
Get the current volume.
- is_playing(player: Player) bool #
Return if the sound is currently playing or not
- play(volume: float = 1.0, pan: float = 0.0, loop: bool = False, speed: float = 1.0) Player #
Play the sound.
- set_volume(volume, player: Player) None #
Set the volume of a sound as it is playing.
- arcade.load_sound(path: Union[str, Path], streaming: bool = False) Optional[Sound] #
Load a sound.
path (Path) – Name of the sound file to load.
streaming (bool) – Boolean for determining if we stream the sound or load it all into memory. Set to
Truefor long sounds to save memory,
Falsefor short sounds to speed playback.
Sound object which can be used by the
- Return type:
- arcade.play_sound(sound: Sound, volume: float = 1.0, pan: float = 0.0, looping: bool = False, speed: float = 1.0) Player #
Play a sound.
volume (float) – Volume, from 0=quiet to 1=loud
pan (float) – Pan, from -1=left to 0=centered to 1=right
looping (bool) – Should we loop the sound over and over?
speed (float) – Change the speed of the sound which also changes pitch, default 1.0