Audio

An audio buffer loaded completely in memory.

Constructor

Audio(file_path: str, volume: float = 1.0)

Parameters

  • file_path : Path to the audio file to load.
  • volume : Initial volume level (0.0 to 1.0+). Defaults to 1.0.

Note:

Audio file formats supported are WAV, FLAC, and MP3.

Properties


NameDescriptionType
volumeThe volume of the audio, from 0.0-1.0, with values above 1.0 allowed for amplification.float

Methods


Play

play() None

Play the audio.

Note:

Playing the audio again while it's already playing plays a separate sound instance, meaning multiple plays can overlap.

Stop

stop() None

Stop all instances of currently playing audio.