CLASS v1.8.0

mixer.Sample

pykraken.mixer.Sample

A sound effect sample loaded entirely into memory.

More about mixer.Sample

Samples support polyphony (multiple simultaneous instances). If tracks are full, samples attempt to steal tracks from lower-priority or older sounds.

Attributes

  • priority (AudioPriority) — Acquisition priority level. Defaults to SFX.
  • can_steal (bool) — Whether this sound can interrupt others to acquire a track. Defaults to True.
  • max_polyphony (int) — Maximum simultaneous instances of this specific sample (Range 1-32). Defaults to 1.

Inherits Audio

Reference

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

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

can_steal

property
can_steal: bool

Whether can interrupt others to acquire a track.

max_polyphony: int

Max simultaneous instances of sample (1-32).

playing

property
playing: bool

True if currently playing.

priority

property
priority: mixer.AudioPriority

Acquisition priority level.

volume

property
volume: float

Volume scalar (0.0 to 1.0).

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.

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.