# Module cocos.audio.pygame.mixer

Pygame module for loading and playing sounds.

This module contains classes for loading Sound objects and controlling playback. The mixer module is optional and depends on SDL_mixer. Your program should test that pygame.mixer is available and intialized before using it.

The mixer module has a limited number of channels for playback of sounds. Usually programs tell pygame to start playing audio and it selects an available channel automatically. The default is 8 simultaneous channels, but complex programs can get more precise control over the number of channels and their use.

All sound playback is mixed in background threads. When you begin to play a Sound object, it will return immediately while the sound continues to play. A single Sound object can also be actively played back multiple times.

The mixer also has a special streaming channel. This is for music playback and is accessed through the pygame.mixer.music module.

The mixer module must be initialized like other pygame modules, but it has some extra conditions. The pygame.mixer.init() function takes several optional arguments to control the playback rate and sample size. Pygame will default to reasonable values, but pygame cannot perform Sound resampling, so the mixer should be initialized to match the values of your audio resources.

NOTE: there is currently a bug on some windows machines which makes sound play back 'scratchy'. There is not enough cpu in the sound thread to feed the buffer to the sound api. To get around this you can increase the buffer size. However this means that there is more of a delay between the time you ask to play the sound and when it gets played. Try calling this before the pygame.init or pygame.mixer.init calls. pygame.mixer.pre_init(44100,-16,2, 1024 * 3)

## Classes

| Channel The Channel object can be used to get fine control over the playback of Sounds.
| Sound The Sound object represents actual sound sample data.

## Functions

| __PYGAMEinit__(frequency=None, size=None, stereo=None, buffer=None)
| fadeout(time) Fade out the volume on all sounds before stopping.
Channel | find_channel(force=False) Find an unused channel.
bool | get_busy() Test if any sound is being mixed.
(int, int, bool) or None | get_init() Determine if the mixer is initialized.
int | get_num_channels() Get the total number of playback channels.
| init(frequency=None, size=None, stereo=None, buffer=None) Initialize the mixer module.
| pause() Temporarily stop playback of all sound channels.
| pre_init(frequency=0, size=0, stereo=0, buffer=0) Preset the mixer init arguments.
| quit() Uninitialize the mixer.
| set_num_channels(channels) Set the total number of playback channels.
| set_reserved(channels) Reserve channels from being automatically used.
| stop() Stop playback of all sound channels.
| unpause() Resume paused playback of sound channels.

## Constants

| AUDIO_S16 = `32784`
| AUDIO_S16LSB = `32784`
| AUDIO_S16MSB = `36880`
| AUDIO_S16SYS = `32784`
| AUDIO_S8 = `32776`
| AUDIO_U16 = `16`
| AUDIO_U16LSB = `16`
| AUDIO_U16MSB = `4112`
| AUDIO_U16SYS = `16`
| AUDIO_U8 = `8`
| CD_ERROR = `-1`
| CD_FPS = `75`
| CD_PAUSED = `3`
| CD_PLAYING = `2`
| CD_STOPPED = `1`
| CD_TRAYEMPTY = `0`
| DEFAULT_MODE = `0`
| KMOD_ALT = `768`
| KMOD_CAPS = `8192`
| KMOD_CTRL = `192`
| KMOD_LALT = `256`
| KMOD_LCTRL = `64`
| KMOD_LMETA = `1024`
| KMOD_LSHIFT = `1`
| KMOD_META = `3072`
| KMOD_MODE = `16384`
| KMOD_NONE = `0`
| KMOD_NUM = `4096`
| KMOD_RALT = `512`
| KMOD_RCTRL = `128`
| KMOD_RESERVED = `32768`
| KMOD_RMETA = `2048`
| KMOD_RSHIFT = `2`
| KMOD_SHIFT = `3`
| MIX_CHANNELS = `8`
| MIX_CHANNEL_POST = `-2`
| MIX_DEFAULT_CHANNELS = `2`
| MIX_DEFAULT_FORMAT = `32784`
| MIX_DEFAULT_FREQUENCY = `22050`
| MIX_EFFECTSMAXSPEED = ``'``MIX_EFFECTSMAXSPEED``'``
| MIX_FADING_IN = `2`
| MIX_FADING_OUT = `1`
| MIX_MAX_VOLUME = `128`
| MIX_NO_FADING = `0`
| MUS_CMD = `1`
| MUS_MID = `4`
| MUS_MOD = `3`
| MUS_MP3 = `6`
| MUS_NONE = `0`
| MUS_OGG = `5`
| MUS_WAV = `2`
| NULL = `0`
| RTLD_GLOBAL = `0`
| RTLD_LOCAL = `0`
| RW_SEEK_CUR = `1`
| RW_SEEK_END = `2`
| RW_SEEK_SET = `0`
| SDLK_0 = `48`
| SDLK_1 = `49`
| SDLK_2 = `50`
| SDLK_3 = `51`
| SDLK_4 = `52`
| SDLK_5 = `53`
| SDLK_6 = `54`
| SDLK_7 = `55`
| SDLK_8 = `56`
| SDLK_9 = `57`
| SDLK_AMPERSAND = `38`
| SDLK_ASTERISK = `42`
| SDLK_AT = `64`
| SDLK_BACKQUOTE = `96`
| SDLK_BACKSLASH = `92`
| SDLK_BACKSPACE = `8`
| SDLK_BREAK = `318`
| SDLK_CAPSLOCK = `301`
| SDLK_CARET = `94`
| SDLK_CLEAR = `12`
| SDLK_COLON = `58`
| SDLK_COMMA = `44`
| SDLK_COMPOSE = `314`
| SDLK_DELETE = `127`
| SDLK_DOLLAR = `36`
| SDLK_DOWN = `274`
| SDLK_END = `279`
| SDLK_EQUALS = `61`
| SDLK_ESCAPE = `27`
| SDLK_EURO = `321`
| SDLK_EXCLAIM = `33`
| SDLK_F1 = `282`
| SDLK_F10 = `291`
| SDLK_F11 = `292`
| SDLK_F12 = `293`
| SDLK_F13 = `294`
| SDLK_F14 = `295`
| SDLK_F15 = `296`
| SDLK_F2 = `283`
| SDLK_F3 = `284`
| SDLK_F4 = `285`
| SDLK_F5 = `286`
| SDLK_F6 = `287`
| SDLK_F7 = `288`
| SDLK_F8 = `289`
| SDLK_F9 = `290`
| SDLK_FIRST = `0`
| SDLK_GREATER = `62`
| SDLK_HASH = `35`
| SDLK_HELP = `315`
| SDLK_HOME = `278`
| SDLK_INSERT = `277`
| SDLK_KP0 = `256`
| SDLK_KP1 = `257`
| SDLK_KP2 = `258`
| SDLK_KP3 = `259`
| SDLK_KP4 = `260`
| SDLK_KP5 = `261`
| SDLK_KP6 = `262`
| SDLK_KP7 = `263`
| SDLK_KP8 = `264`
| SDLK_KP9 = `265`
| SDLK_KP_DIVIDE = `267`
| SDLK_KP_ENTER = `271`
| SDLK_KP_EQUALS = `272`
| SDLK_KP_MINUS = `269`
| SDLK_KP_MULTIPLY = `268`
| SDLK_KP_PERIOD = `266`
| SDLK_KP_PLUS = `270`
| SDLK_LALT = `308`
| SDLK_LAST = `323`
| SDLK_LCTRL = `306`
| SDLK_LEFT = `276`
| SDLK_LEFTBRACKET = `91`
| SDLK_LEFTPAREN = `40`
| SDLK_LESS = `60`
| SDLK_LMETA = `310`
| SDLK_LSHIFT = `304`
| SDLK_LSUPER = `311`
| SDLK_MENU = `319`
| SDLK_MINUS = `45`
| SDLK_MODE = `313`
| SDLK_NUMLOCK = `300`
| SDLK_PAGEDOWN = `281`
| SDLK_PAGEUP = `280`
| SDLK_PAUSE = `19`
| SDLK_PERIOD = `46`
| SDLK_PLUS = `43`
| SDLK_POWER = `320`
| SDLK_PRINT = `316`
| SDLK_QUESTION = `63`
| SDLK_QUOTE = `39`
| SDLK_QUOTEDBL = `34`
| SDLK_RALT = `307`
| SDLK_RCTRL = `305`
| SDLK_RETURN = `13`
| SDLK_RIGHT = `275`
| SDLK_RIGHTBRACKET = `93`
| SDLK_RIGHTPAREN = `41`
| SDLK_RMETA = `309`
| SDLK_RSHIFT = `303`
| SDLK_RSUPER = `312`
| SDLK_SCROLLOCK = `302`
| SDLK_SEMICOLON = `59`
| SDLK_SLASH = `47`
| SDLK_SPACE = `32`
| SDLK_SYSREQ = `317`
| SDLK_TAB = `9`
| SDLK_UNDERSCORE = `95`
| SDLK_UNDO = `322`
| SDLK_UNKNOWN = `0`
| SDLK_UP = `273`
| SDLK_WORLD_0 = `160`
| SDLK_WORLD_1 = `161`
| SDLK_WORLD_10 = `170`
| SDLK_WORLD_11 = `171`
| SDLK_WORLD_12 = `172`
| SDLK_WORLD_13 = `173`
| SDLK_WORLD_14 = `174`
| SDLK_WORLD_15 = `175`
| SDLK_WORLD_16 = `176`
| SDLK_WORLD_17 = `177`
| SDLK_WORLD_18 = `178`
| SDLK_WORLD_19 = `179`
| SDLK_WORLD_2 = `162`
| SDLK_WORLD_20 = `180`
| SDLK_WORLD_21 = `181`
| SDLK_WORLD_22 = `182`
| SDLK_WORLD_23 = `183`
| SDLK_WORLD_24 = `184`
| SDLK_WORLD_25 = `185`
| SDLK_WORLD_26 = `186`
| SDLK_WORLD_27 = `187`
| SDLK_WORLD_28 = `188`
| SDLK_WORLD_29 = `189`
| SDLK_WORLD_3 = `163`
| SDLK_WORLD_30 = `190`
| SDLK_WORLD_31 = `191`
| SDLK_WORLD_32 = `192`
| SDLK_WORLD_33 = `193`
| SDLK_WORLD_34 = `194`
| SDLK_WORLD_35 = `195`
| SDLK_WORLD_36 = `196`
| SDLK_WORLD_37 = `197`
| SDLK_WORLD_38 = `198`
| SDLK_WORLD_39 = `199`
| SDLK_WORLD_4 = `164`
| SDLK_WORLD_40 = `200`
| SDLK_WORLD_41 = `201`
| SDLK_WORLD_42 = `202`
| SDLK_WORLD_43 = `203`
| SDLK_WORLD_44 = `204`
| SDLK_WORLD_45 = `205`
| SDLK_WORLD_46 = `206`
| SDLK_WORLD_47 = `207`
| SDLK_WORLD_48 = `208`
| SDLK_WORLD_49 = `209`
| SDLK_WORLD_5 = `165`
| SDLK_WORLD_50 = `210`
| SDLK_WORLD_51 = `211`
| SDLK_WORLD_52 = `212`
| SDLK_WORLD_53 = `213`
| SDLK_WORLD_54 = `214`
| SDLK_WORLD_55 = `215`
| SDLK_WORLD_56 = `216`
| SDLK_WORLD_57 = `217`
| SDLK_WORLD_58 = `218`
| SDLK_WORLD_59 = `219`
| SDLK_WORLD_6 = `166`
| SDLK_WORLD_60 = `220`
| SDLK_WORLD_61 = `221`
| SDLK_WORLD_62 = `222`
| SDLK_WORLD_63 = `223`
| SDLK_WORLD_64 = `224`
| SDLK_WORLD_65 = `225`
| SDLK_WORLD_66 = `226`
| SDLK_WORLD_67 = `227`
| SDLK_WORLD_68 = `228`
| SDLK_WORLD_69 = `229`
| SDLK_WORLD_7 = `167`
| SDLK_WORLD_70 = `230`
| SDLK_WORLD_71 = `231`
| SDLK_WORLD_72 = `232`
| SDLK_WORLD_73 = `233`
| SDLK_WORLD_74 = `234`
| SDLK_WORLD_75 = `235`
| SDLK_WORLD_76 = `236`
| SDLK_WORLD_77 = `237`
| SDLK_WORLD_78 = `238`
| SDLK_WORLD_79 = `239`
| SDLK_WORLD_8 = `168`
| SDLK_WORLD_80 = `240`
| SDLK_WORLD_81 = `241`
| SDLK_WORLD_82 = `242`
| SDLK_WORLD_83 = `243`
| SDLK_WORLD_84 = `244`
| SDLK_WORLD_85 = `245`
| SDLK_WORLD_86 = `246`
| SDLK_WORLD_87 = `247`
| SDLK_WORLD_88 = `248`
| SDLK_WORLD_89 = `249`
| SDLK_WORLD_9 = `169`
| SDLK_WORLD_90 = `250`
| SDLK_WORLD_91 = `251`
| SDLK_WORLD_92 = `252`
| SDLK_WORLD_93 = `253`
| SDLK_WORLD_94 = `254`
| SDLK_WORLD_95 = `255`
| SDL_ACTIVEEVENT = `1`
| SDL_ACTIVEEVENTMASK = `2`
| SDL_ADDEVENT = `0`
| SDL_ALLEVENTS = `4294967295`
| SDL_ALL_HOTKEYS = `4294967295`
| SDL_ALPHA_OPAQUE = `255`
| SDL_ALPHA_TRANSPARENT = `0`
| SDL_ANYFORMAT = `268435456`
| SDL_APPACTIVE = `4`
| SDL_APPINPUTFOCUS = `2`
| SDL_APPMOUSEFOCUS = `1`
| SDL_ASYNCBLIT = `4`
| SDL_AUDIO_PAUSED = `2`
| SDL_AUDIO_PLAYING = `1`
| SDL_AUDIO_STOPPED = `0`
| SDL_AUDIO_TRACK = `0`
| SDL_BIG_ENDIAN = `4321`
| SDL_BUTTON_LEFT = `1`
| SDL_BUTTON_MIDDLE = `2`
| SDL_BUTTON_RIGHT = `3`
| SDL_BUTTON_WHEELDOWN = `5`
| SDL_BUTTON_WHEELUP = `4`
| SDL_BYTEORDER = `1234`
| SDL_DATA_TRACK = `4`
| SDL_DEFAULT_REPEAT_DELAY = `500`
| SDL_DEFAULT_REPEAT_INTERVAL = `30`
| SDL_DISABLE = `0`
| SDL_DOUBLEBUF = `1073741824`
| SDL_ENABLE = `1`
| SDL_EVENT_RESERVED2 = `18`
| SDL_EVENT_RESERVED3 = `19`
| SDL_EVENT_RESERVED4 = `20`
| SDL_EVENT_RESERVED5 = `21`
| SDL_EVENT_RESERVED6 = `22`
| SDL_EVENT_RESERVED7 = `23`
| SDL_EVENT_RESERVEDA = `14`
| SDL_EVENT_RESERVEDB = `15`
| SDL_FULLSCREEN = `2147483648`
| SDL_GETEVENT = `2`
| SDL_GL_ACCELERATED_VISUAL = `15`
| SDL_GL_ACCUM_ALPHA_SIZE = `11`
| SDL_GL_ACCUM_BLUE_SIZE = `10`
| SDL_GL_ACCUM_GREEN_SIZE = `9`
| SDL_GL_ACCUM_RED_SIZE = `8`
| SDL_GL_ALPHA_SIZE = `3`
| SDL_GL_BLUE_SIZE = `2`
| SDL_GL_BUFFER_SIZE = `4`
| SDL_GL_DEPTH_SIZE = `6`
| SDL_GL_DOUBLEBUFFER = `5`
| SDL_GL_GREEN_SIZE = `1`
| SDL_GL_MULTISAMPLEBUFFERS = `13`
| SDL_GL_MULTISAMPLESAMPLES = `14`
| SDL_GL_RED_SIZE = `0`
| SDL_GL_STENCIL_SIZE = `7`
| SDL_GL_STEREO = `12`
| SDL_GL_SWAP_CONTROL = `16`
| SDL_GRAB_OFF = `0`
| SDL_GRAB_ON = `1`
| SDL_GRAB_QUERY = `-1`
| SDL_HAT_CENTERED = `0`
| SDL_HAT_DOWN = `4`
| SDL_HAT_LEFT = `8`
| SDL_HAT_LEFTDOWN = `12`
| SDL_HAT_LEFTUP = `9`
| SDL_HAT_RIGHT = `2`
| SDL_HAT_RIGHTDOWN = `6`
| SDL_HAT_RIGHTUP = `3`
| SDL_HAT_UP = `1`
| SDL_HWACCEL = `256`
| SDL_HWPALETTE = `536870912`
| SDL_HWSURFACE = `1`
| SDL_IGNORE = `0`
| SDL_INIT_AUDIO = `16`
| SDL_INIT_CDROM = `256`
| SDL_INIT_EVENTTHREAD = `16777216`
| SDL_INIT_EVERYTHING = `65535`
| SDL_INIT_JOYSTICK = `512`
| SDL_INIT_NOPARACHUTE = `1048576`
| SDL_INIT_TIMER = `1`
| SDL_INIT_VIDEO = `32`
| SDL_IYUV_OVERLAY = `1448433993`
| SDL_JOYAXISMOTION = `7`
| SDL_JOYAXISMOTIONMASK = `128`
| SDL_JOYBALLMOTION = `8`
| SDL_JOYBALLMOTIONMASK = `256`
| SDL_JOYBUTTONDOWN = `10`
| SDL_JOYBUTTONDOWNMASK = `1024`
| SDL_JOYBUTTONUP = `11`
| SDL_JOYBUTTONUPMASK = `2048`
| SDL_JOYEVENTMASK = `3968`
| SDL_JOYHATMOTION = `9`
| SDL_JOYHATMOTIONMASK = `512`
| SDL_KEYDOWN = `2`
| SDL_KEYDOWNMASK = `4`
| SDL_KEYEVENTMASK = `12`
| SDL_KEYUP = `3`
| SDL_KEYUPMASK = `8`
| SDL_LIL_ENDIAN = `1234`
| SDL_LOGPAL = `1`
| SDL_MAJOR_VERSION = `1`
| SDL_MAX_TRACKS = `99`
| SDL_MINOR_VERSION = `2`
| SDL_MIX_MAXVOLUME = `128`
| SDL_MOUSEBUTTONDOWN = `5`
| SDL_MOUSEBUTTONDOWNMASK = `32`
| SDL_MOUSEBUTTONUP = `6`
| SDL_MOUSEBUTTONUPMASK = `64`
| SDL_MOUSEEVENTMASK = `112`
| SDL_MOUSEMOTION = `4`
| SDL_MOUSEMOTIONMASK = `16`
| SDL_MUTEX_TIMEDOUT = `1`
| SDL_NOEVENT = `0`
| SDL_NOFRAME = `32`
| SDL_NUMEVENTS = `32`
| SDL_OPENGL = `2`
| SDL_OPENGLBLIT = `10`
| SDL_PATCHLEVEL = `10`
| SDL_PEEKEVENT = `1`
| SDL_PHYSPAL = `2`
| SDL_PREALLOC = `16777216`
| SDL_PRESSED = `1`
| SDL_QUIT = `12`
| SDL_QUITMASK = `4096`
| SDL_RELEASED = `0`
| SDL_RESIZABLE = `16`
| SDL_RLEACCEL = `16384`
| SDL_RLEACCELOK = `8192`
| SDL_SRCALPHA = `65536`
| SDL_SRCCOLORKEY = `4096`
| SDL_SWSURFACE = `0`
| SDL_SYSWMEVENT = `13`
| SDL_SYSWMEVENTMASK = `8192`
| SDL_TIMESLICE = `10`
| SDL_USEREVENT = `24`
| SDL_UYVY_OVERLAY = `1498831189`
| SDL_VIDEOEXPOSE = `17`
| SDL_VIDEOEXPOSEMASK = `131072`
| SDL_VIDEORESIZE = `16`
| SDL_VIDEORESIZEMASK = `65536`
| SDL_YUY2_OVERLAY = `844715353`
| SDL_YV12_OVERLAY = `842094169`
| SDL_YVYU_OVERLAY = `1431918169`
| SOUND_SAMPLEFLAG_CANSEEK = `1`
| SOUND_SAMPLEFLAG_EGAIN = `2147483648`
| SOUND_SAMPLEFLAG_EOF = `536870912`
| SOUND_SAMPLEFLAG_ERROR = `1073741824`
| SOUND_SAMPLEFLAG_NONE = `0`
| TIMER_RESOLUTION = `10`
| TTF_STYLE_BOLD = `1`
| TTF_STYLE_ITALIC = `2`
| TTF_STYLE_NORMAL = `0`
| TTF_STYLE_UNDERLINE = `4`

## Variables

| GetLastError = `<_FuncPtr object at 0x00AFEBE8>`
| NeedFunctionPrototypes = `1`
| SDLK_a = `97`
| SDLK_b = `98`
| SDLK_c = `99`
| SDLK_d = `100`
| SDLK_e = `101`
| SDLK_f = `102`
| SDLK_g = `103`
| SDLK_h = `104`
| SDLK_i = `105`
| SDLK_j = `106`
| SDLK_k = `107`
| SDLK_l = `108`
| SDLK_m = `109`
| SDLK_n = `110`
| SDLK_o = `111`
| SDLK_p = `112`
| SDLK_q = `113`
| SDLK_r = `114`
| SDLK_s = `115`
| SDLK_t = `116`
| SDLK_u = `117`
| SDLK_v = `118`
| SDLK_w = `119`
| SDLK_x = `120`
| SDLK_y = `121`
| SDLK_z = `122`
| __package__ = ``'``cocos.audio.pygame``'``
| cdll = `<ctypes.LibraryLoader object at 0x00BF39B0>`
| event_queue = `<Queue.Queue instance at 0x0469F828>`
| memmove = `<CFunctionType object at 0x00AFEC60>`
| memset = `<CFunctionType object at 0x00AFEDC8>`
| oledll = `<ctypes.LibraryLoader object at 0x00BF3A10>`
| pydll = `<ctypes.LibraryLoader object at 0x00BF39D0>`
| pythonapi = `<PyDLL 'python dll', handle 1e000000 at bf39f0>`
| windll = `<ctypes.LibraryLoader object at 0x00BF3A30>`

## Function Details

### fadeout

fadeout(time)

Fade out the volume on all sounds before stopping.

This will fade out the volume on all active channels over the time argument in milliseconds. After the sound is muted the playback will stop.

Parameters:
  time : int
    Time to fade out, in milliseconds.

### find_channel

find_channel(force=False)

Find an unused channel.

This will find and return an inactive Channel object. If there are no inactive Channels this function will return None. If there are no inactive channels and the force argument is True, this will find the Channel with the longest running Sound and return it.

If the mixer has reserved channels from pygame.mixer.set_reserved() then those channels will not be returned here.

Parameters:
  force : bool
    If True, a playing channel will be returned if no free ones are available.
Returns: Channel

### get_busy

get_busy()

Test if any sound is being mixed.

Returns True if the mixer is busy mixing any channels. If the mixer is idle then this return False.

Returns: bool

### get_init

get_init()

Determine if the mixer is initialized.

If the mixer is initialized, this returns the playback arguments it is using. If the mixer has not been initialized this returns None

The value of `size` follows the same conventions as in init.

Returns:
  (int, int, bool) or None: (frequency, size, stereo)

### get_num_channels

get_num_channels()

Get the total number of playback channels.

Returns the number of currently active playback channels.

Returns: int

### init

init(frequency=None, size=None, stereo=None, buffer=None)

Initialize the mixer module.

Initialize the mixer module for Sound loading and playback. The default arguments can be overridden to provide specific audio mixing. The size argument represents how many bits are used for each audio sample. If the value is negative then signed sample values will be used. Positive values mean unsigned audio samples will be used. If the stereo argument is false the mixer will use mono sound.

The buffer argument controls the number of internal samples used in the sound mixer. The default value should work for most cases. It can be lowered to reduce latency, but sound dropout may occur. It can be raised to larger values to ensure playback never skips, but it will impose latency on sound playback. The buffer size must be a power of two.

Some platforms require the pygame.mixer module to be initialized after the display modules have initialized. The top level pygame.init() takes care of this automatically, but cannot pass any arguments to the mixer init. To solve this, mixer has a function pygame.mixer.pre_init() to set the proper defaults before the toplevel init is used.

It is safe to call this more than once, but after the mixer is initialized you cannot change the playback arguments without first calling pygame.mixer.quit().

Parameters:
  frequency : int
    Sample rate, in Hertz; defaults to 22050
  size : int
    Bits per sample per channel; defaults to -16. Positive values for unsigned values, negative for signed.
  stereo : int
    Number of output channels: 1 for mono, 2 for stereo; defaults to 2.
  buffer : int
    Byte size of each output channel's buffer; a power of two; defaults to 1024.

### pause

pause()

Temporarily stop playback of all sound channels.

This will temporarily stop all playback on the active mixer channels. The playback can later be resumed with pygame.mixer.unpause()

### pre_init

pre_init(frequency=0, size=0, stereo=0, buffer=0)

Preset the mixer init arguments.

Any nonzero arguments change the default values used when the real pygame.mixer.init() is called. The best way to set custom mixer playback values is to call pygame.mixer.pre_init() before calling the top level pygame.init().

Parameters:
  frequency : int
    Sample rate, in Hertz
  size : int
    Bits per sample per channel. Positive values for unsigned values, negative for signed.
  stereo : bool
    Number of mixdown channels: False for 1, True for 2.
  buffer : int
    Bytes for mixdown buffer size; a power of two.

### quit

quit()

Uninitialize the mixer.

This will uninitialize pygame.mixer. All playback will stop and any loaded Sound objects may not be compatable with the mixer if it is reinitialized later.

### set_num_channels

set_num_channels(channels)

Set the total number of playback channels.

Sets the number of available channels for the mixer. The default value is 8. The value can be increased or decreased. If the value is decreased, sounds playing on the truncated channels are stopped.

Parameters:
  channels : int
    Number of channels

### set_reserved

set_reserved(channels)

Reserve channels from being automatically used.

The mixer can reserve any number of channels that will not be automatically selected for playback by Sounds. If sounds are currently playing on the reserved channels they will not be stopped.

This allows the application to reserve a specific number of channels for important sounds that must not be dropped or have a guaranteed channel to play on.

Parameters:
  channels : int
    Number of channels to reserve.

### stop

stop()

Stop playback of all sound channels.

This will stop all playback of all active mixer channels.

### unpause

unpause()

Resume paused playback of sound channels.

This will resume all active sound channels after they have been paused.