sdl2.sdlmixer - Python bindings for SDL_mixer¶
sdl2.sdlmixer module provides bindings for wrapper the SDL_mixer
audio playback library. It supports loading, playing, and mixing audio from a
wide range of popular formats (e.g. WAV, FLAC, MP3, OGG).
The SDL_mixer library is designed around the concept of virtual channels, each of which can be set to different volumes, have different left/right panning, and play different effects and sounds simultaneously (like a mixing board in a recording studio). In addition to the main mixing channels, SDL_mixer also provides a single channel for music playback, which is less flexible than the other channels but supports a wider range of playback formats (including MIDI) and requires less memory for playback.
Music playback is performed using
Mix_Music objects and their
corresponding functions. All other audio playback is performed using
Table Of Contents
- Main data types
- Initialization and library information functions
- Audio loading and closing functions
- Decoder availability & info functions
- Channel functions
- Playback functions
- Volume functions
- Playback status functions
- Effects-processing functions
- Decoder-specific functions
The PySDL2 documentation for this module is currently a work-in-progress, and not all functions are documented. The official C documentation (linked below) can be used in the meantime to fill in any gaps.
The official documentation for the SDL_mixer library can be found here. Note that not all functions may be documented, as the official doucmentation is currently several releases out-of-date.
Returns the most recently encountered SDL2 error message, if any.
This function is a simple wrapper around
Retuns: A UTF-8 encoded string describing the most recent SDL2 error. Return type: bytes
These functions affect regular mixer channels. Music is not affected by these functions.