Pygame - Mixer Channels

The Sound object can be played on a specific channel instead of the default channel automatically chosen. First create a channel object using the following command −


Following functions are defined in the class −

play(Sound, loops=0, maxtime=0, fade_ms=0) This will begin playback of a Sound on a specific Channel.
stop() Stop sound playback on a channel. After playback is stopped the channel becomes available for new Sounds to play on it
pause() Temporarily stop the playback of sound on a channel.
unpause() Resume the playback on a paused channel.
set_volume(value) Set the volume (loudness) of a playing sound. The value argument is between 0.0 and 1.0.
queue(Sound) When a Sound is queued on a Channel, it will begin playing immediately after the current Sound is finished.
Kickstart Your Career

Get certified by completing the course

Get Started