AudioStream
An audio stream that streams data from disk.
Constructor
AudioStream(file_path: str, volume: float = 1.0)Parameters
file_path: Path to the audio file to stream.volume: Initial volume level (0.0 to 1.0+). Defaults to 1.0.
Note:
Audio file formats supported are WAV, FLAC, and MP3.
Properties
| Name | Description | Type |
|---|---|---|
volume | The volume of the audio stream, from 0.0-1.0, with values above 1.0 allowed for amplification. | float |
current_time | The current playback time of the audio stream in seconds. | float |
Methods
Play
play(
fade_in_ms: int = 0,
loop: bool = false,
start_time_seconds: float = 0.0
) → NonePlay the audio stream with optional fade-in, looping, and start time.
Parameters
fade_in_ms: The duration in milliseconds to fade in the audio.loop: Whether to loop the audio stream.start_time_seconds: The time in seconds to start playback from.
Stop
stop(fade_out_ms: int = 0) → NoneStop the audio stream.
Parameters
fade_out_ms: The duration in milliseconds to fade out the audio.
Seek
seek(time_seconds: float) → NoneSeek to a specific time in the audio stream.
Parameters
time_seconds: The time in seconds to seek to.
Pause
pause() → NonePause the audio stream.
Resume
resume() → NoneResume the audio stream.
Rewind
rewind() → NoneRewind the audio stream.
Set Looping
setLooping() → NoneSet whether the audio stream should loop.