module music

The music module provides some facilities for handling music. Individual pieces of music can be started and stopped, or playlists can be constructed and played sequentially or randomly. There are also some control and dialog classes available for setting music-related options.

See also: PlayList, EnableMusicControl, MusicVolumeControl, MusicOptionsDialog


Time in seconds over which the currently playing music is faded out when stopping or changing to a different piece of music.

Time in seconds between stopping the previously playing music and starting the next piece of music.


get_music(name, ..., prefix = "music")
Returns the full pathname of a music resource.

get_playlist(name, ..., prefix = "music", random = False, repeat = False)
Returns a PlayList constructed from a resource consisting of a directory of music files. The random and repeat arguments are passed on to the PlayList constructor.

change_music(new_music, repeat = False)
Fades out any currently playing music and starts playing the specified music file. If repeat is true, the file will be repeated indefinitely, otherwise it will only play once.

Fades out any currently playing music and starts playing from the specified playlist.

Returns true if music is currently enabled.

Enables or disables music. Note: To work around a bug in the pygame music system, disabling music will cause the currently playing music to be started again from the beginning when music is re-enabled.