CLASS v1.8.0

mixer.Stream

pykraken.mixer.Stream

A streaming audio resource intended for long music files.

More about mixer.Stream

Streams occupy exactly one track while active. They are protected and will not be stolen by incoming :class:Sample requests.

Attributes

  • playback_pos (float) — (Read-only) Current playback position in seconds.
  • looping (bool) — Whether the stream should loop when it reaches the end.

Methods

pause(): Pause playback, preserving position. resume(fade_in=0.0): Resume playback from a paused state. seek(seconds): Jump to a specific time in the audio file.

Inherits Audio

Reference

PYTHON API
mixer.Stream(/, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

looping

property
looping: bool

Whether the stream should loop when it reaches the end.

playback_pos

property
playback_pos: float

Current position in seconds. 0.0 if stopped/never played, paused position if paused.

playing

property
playing: bool

True if currently playing.

volume

property
volume: float

Volume scalar (0.0 to 1.0).

pause

method
pause(self) -> None

Pause playback. Releases the hardware track but preserves position.

play

method
play(self, fade_in: float = 0.0) -> None

Start audio playback.

Args

  • fade_in (float) — Fade in duration in seconds. Defaults to 0.0.

resume

method
resume(self, fade_in: float = 0.0) -> None

Resume playback from a paused state.

Args

  • fade_in (float) — Duration in seconds to fade back in. Defaults to 0.0.

seek

method
seek(self, seconds: float) -> None

Jump to a specific time in the audio file.

Args

  • seconds (float) — Target position in seconds from the start.

stop

method
stop(self, fade_out: float = 0.0) -> None

Stop all playing instances of this audio.

Args

  • fade_out (float) — Fade out duration in seconds. Defaults to 0.0.

Find your next step

Start typing to search the manual.