Contains music routines


  • pygame.music.quit() -> None
  • - uninitialize music module
  • pygame.music.init([freq, [size, [stereo]]]) ->
  • - None
  • pygame.music.get_init() -> bool
  • - query the music module
  • pygame.music.play([loops, [fadein]]) -> None
  • - play the current loaded music
  • pygame.music.get_busy() -> bool
  • - query state of the music
  • pygame.music.fadeout(millisec) -> None
  • - fadeout current music
  • pygame.music.stop() -> None
  • - stop the playing music
  • pygame.music.pause() -> None
  • - pause the playing music
  • pygame.music.unpause() -> None
  • - restarts the paused music
  • pygame.music.rewind() -> None
  • - restarts music
  • pygame.music.set_volume(val) -> None
  • - set music volume
  • pygame.music.get_volume() -> val
  • - query music volume
  • pygame.music.load(filename) -> None
  • - load current music


    pygame.music.quit() -> None

    Stops playback of any music and uninitializes the module.


    pygame.music.init([freq, [size, [stereo]]]) ->

    Initializes the music module. Since the music requires use of the mixer, the mixer module will also be initialized with this call. See the mixer init function for more details on the arguments. Don't be fooled though, just because the mixer module is initialized, does not mean the music is initialized.


    pygame.music.get_init() -> bool

    Returns true if the music module is initialized.


    pygame.music.play([loops, [fadein]]) -> None

    Starts playing the current loaded music. This will restart the sound if it is playing. Loops controls how many extra time the sound will play, a negative loop will play indefinitely, it defaults to 0. Fadein will ramp the volume up over the given milliseconds.


    pygame.music.get_busy() -> bool

    Returns true if music is currently playing


    pygame.music.fadeout(millisec) -> None

    Fades out the current playing music and stops it over the given milliseconds.


    pygame.music.stop() -> None

    Stops playback of the current music.


    pygame.music.pause() -> None

    Temporarily stops the current music.


    pygame.music.unpause() -> None

    Restarts playback of the current music object when paused.


    pygame.music.rewind() -> None

    Restarts playback of the current music.


    pygame.music.set_volume(val) -> None

    Sets the current volume for the music. Value is between 0.0 and 1.0.


    pygame.music.get_volume() -> val

    Get the current volume for the music. Value is between 0.0 and 1.0.


    pygame.music.load(filename) -> None

    Load a music object as the current music. The music only handles one music as the current. If music is currently playing, it will be stopped and replaced with the given one. Loading music only supports filenames, not file-like objects.