1. pygame
  2. Untitled project
  3. pygame


pygame / docs / pygame_music.html

<body bgcolor=#dddddd text=#333377 link=#7777bb vlink=#7777bb>

<table border=0 width=100% cellpadding=0 cellspacing=0 bgcolor=#f5f5f5><tr valign=top>
<td rowspan=2 width=60%><table border=0 cellpadding=5 cellspacing=0 bgcolor=#333377>
<tr height=86 align=left><td valign=top><font color=#ffffff size=+5>
	<a href=../>
      <img src=mainlogo.gif width=300 height=100 alt="PyGame Logo" border=0></a></td>
<td valign=middle><tt><font color=#dddddd><br>
</td></tr></table></td><td width=100% height=100% align=center valign=middle>

	<a href=../>Home</a> &nbsp;||&nbsp;
	<a href=index.html>Help Contents</a> &nbsp;||

|| <a href=CD.html>CD</a> || 
<a href=Channel.html>Channel</a> || 
<a href=Font.html>Font</a> || 
<a href=Joystick.html>Joystick</a> || 
<a href=Rect.html>Rect</a> ||<br>
|| <a href=Sound.html>Sound</a> || 
<a href=Surface.html>Surface</a> || 
<a href=pygame.html>pygame</a> || 
<a href=pygame_cdrom.html>cdrom</a> || 
<a href=pygame_display.html>display</a> ||<br>
|| <a href=pygame_event.html>event</a> || 
<a href=pygame_font.html>font</a> || 
<a href=pygame_image.html>image</a> || 
<a href=pygame_joystick.html>joystick</a> || 
<a href=pygame_key.html>key</a> ||<br>
|| <a href=pygame_mixer.html>mixer</a> || 
<a href=pygame_mouse.html>mouse</a> || 
<a href=pygame_music.html>music</a> || 
<a href=pygame_surfarray.html>surfarray</a> || 
<a href=pygame_time.html>time</a> ||<br>

<h2 align=center>pygame.music</h2>
Contains music routines


<tr><td><a href=#fadeout>fadeout</a></td><td> -
fadeout current music</td></tr>

<tr><td><a href=#get_busy>get_busy</a></td><td> -
query state of the music</td></tr>

<tr><td><a href=#get_init>get_init</a></td><td> -
query the music module</td></tr>

<tr><td><a href=#get_volume>get_volume</a></td><td> -
query music volume</td></tr>

<tr><td><a href=#init>init</a></td><td> -
initialize the music module</td></tr>

<tr><td><a href=#load>load</a></td><td> -
load current music</td></tr>

<tr><td><a href=#pause>pause</a></td><td> -
pause the playing music</td></tr>

<tr><td><a href=#play>play</a></td><td> -
play the current loaded music</td></tr>

<tr><td><a href=#quit>quit</a></td><td> -
uninitialize music module</td></tr>

<tr><td><a href=#rewind>rewind</a></td><td> -
restarts music</td></tr>

<tr><td><a href=#set_volume>set_volume</a></td><td> -
set music volume</td></tr>

<tr><td><a href=#stop>stop</a></td><td> -
stop the playing music</td></tr>

<tr><td><a href=#unpause>unpause</a></td><td> -
restarts the paused music</td></tr>



<a name=fadeout><font size=+2><b>fadeout
</b></font><br><font size=+1><tt>
pygame.music.fadeout(millisec) -> None
Fades out the current playing music and stops it
over the given milliseconds.

<a name=get_busy><font size=+2><b>get_busy
</b></font><br><font size=+1><tt>
pygame.music.get_busy() -> bool
Returns true if music is currently playing

<a name=get_init><font size=+2><b>get_init
</b></font><br><font size=+1><tt>
pygame.music.get_init() -> bool
Returns true if the music module is initialized.

<a name=get_volume><font size=+2><b>get_volume
</b></font><br><font size=+1><tt>
pygame.music.get_volume() -> val
Get the current volume for the music. Value is
between 0.0 and 1.0.

<a name=init><font size=+2><b>init
</b></font><br><font size=+1><tt>
pygame.music.init([freq, [size, [stereo]]]) -> None
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

<a name=load><font size=+2><b>load
</b></font><br><font size=+1><tt>
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.

<a name=pause><font size=+2><b>pause
</b></font><br><font size=+1><tt>
pygame.music.pause() -> None
Temporarily stops the current music.

<a name=play><font size=+2><b>play
</b></font><br><font size=+1><tt>
pygame.music.play([loops]) -> 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.

<a name=quit><font size=+2><b>quit
</b></font><br><font size=+1><tt>
pygame.music.quit() -> None
Stops playback of any music and uninitializes the

<a name=rewind><font size=+2><b>rewind
</b></font><br><font size=+1><tt>
pygame.music.rewind() -> None
Restarts playback of the current music.

<a name=set_volume><font size=+2><b>set_volume
</b></font><br><font size=+1><tt>
pygame.music.set_volume(val) -> None
Sets the current volume for the music. Value is
between 0.0 and 1.0.

<a name=stop><font size=+2><b>stop
</b></font><br><font size=+1><tt>
pygame.music.stop() -> None
Stops playback of the current music.

<a name=unpause><font size=+2><b>unpause
</b></font><br><font size=+1><tt>
pygame.music.unpause() -> None
Restarts playback of the current music object when