mixer
pykraken.mixer Sound mixer and audio management system.
More about mixer
The mixer manages a pool of 64 mixer tracks/voices for playing
:class:Sample (short polyphonic sounds) and :class:Stream
(long music files). It handles automatic track acquisition and
priority-based sound stealing when the track pool is exhausted.
At a glance
4 membersReference
PYTHON APIget_master_volume
functionget_master_volume() -> floatGet the current global mixer gain.
Returns
- float — Master volume (0.0 to 1.0).
load_sample
functionload_sample(path: str | PathLike, predecode: bool = True) -> mixer.SampleLoad an audio sample (SFX) from disk.
Args
- path (
str | PathLike[str]) — File path to load. - predecode (
bool) — Whether to decode into memory now. Defaults to True.
Returns
- Sample — The loaded audio object.
load_stream
functionload_stream(path: str | PathLike, predecode: bool = False) -> mixer.StreamLoad an audio stream (Music) from disk.
Args
- path (
str | PathLike[str]) — File path to load. - predecode (
bool) — Whether to decode into memory now. Defaults to False.
Returns
- Stream — The loaded audio object.
set_master_volume
functionset_master_volume(volume: float) -> NoneSet the global mixer gain.
This affects all playing samples and streams. Individual audio volume is multiplied by this value. Default is 1.0.
Args
- volume (
float) — Master volume scalar (0.0 to 1.0).