pygame   documentation
||  Home  ||  Help Contents  ||
 
|| pygame || cdrom || constants || cursor || display || draw ||
|| event || font || image || joystick || key || mixer ||
|| mixer_music || mouse || movie || sndarray || surfarray || time ||
|| transform ||
 
|| CD || Channel || Clock || Font || Joystick || Movie ||
|| Overlay || Rect || Sound || Surface ||
 
|| color || cursors || sprite ||

pygame.mixer.music

The music module is tied closely to the pygame.mixer module. It is an optional module since it depends on the SDL_mixer library. You should not manually import the music library. Instead it is automatically included as a part of the mixer library. The default module path to music is pygame.mixer.music.
 
The difference between playback of music and playback of sounds is that the music object is not loaded and decoded all at once, instead the music data is streamed and decoded during playback. There can only be one music file loaded at a single time. Loading a new music file will replace any currently loaded music.
 
The music module has many of the same types of functions as the Sound objects. The main difference is only one music object can be loaded at a time, with the load() function. Music must be stored in an individual file on the system, it cannot be loaded from special file-like objects through python.
fadeout - fadeout current music
get_busy - query state of the music
get_endevent - query the current music finished event
get_pos - query music position
get_volume - query music volume
load - load current music
pause - pause the playing music
play - play the current loaded music
queue - preload and queue a music file
rewind - restarts music
set_endevent - sets music finished event
set_volume - set music volume
stop - stop the playing music
unpause - restarts the paused music

fadeout
pygame.mixer.music.fadeout(millisec) -> None
 
get_busy
pygame.mixer.music.get_busy() -> bool
 
get_endevent
pygame.mixer.music.get_endevent([eventid]) -> int
 
get_pos
pygame.mixer.music.get_pos() -> val

 
get_volume
pygame.mixer.music.get_volume() -> val
 
load
pygame.mixer.music.load(filename) -> None
 
pause
pygame.mixer.music.pause() -> None
 
play
pygame.mixer.music.play(loops=0, startpos=0.0) -> None
 
queue
pygame.mixer.music.queue(soundfile) -> None
 
rewind
pygame.mixer.music.rewind() -> None
 
set_endevent
pygame.mixer.music.set_endevent([eventid]) -> None
 
set_volume
pygame.mixer.music.set_volume(val) -> None
 
stop
pygame.mixer.music.stop() -> None
 
unpause
pygame.mixer.music.unpause() -> None