Source

pygame / docs / ref / Sound.html

Full commit
<html>
<title>Sound</title>
<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><table border=0 cellpadding=5 cellspacing=0 bgcolor=#333377>
<tr height=86 align=left><td valign=middle><font color=#ffffff size=+5>
	<a href=../index.html><font size=+5 color=#ffffff><i><b>
      pygame</b></i></font></a>&nbsp;&nbsp;</td>
<td valign=middle><tt><font color=#dddddd><br>
	pygame<br>documentation</font>
</td></tr></table></td><td width=100% align=center valign=middle>

	||&nbsp;
	<a href=http://pygame.seul.org>Home</a> &nbsp;||&nbsp;
	<a href=../index.html>Help Contents</a> &nbsp;||
	<br>&nbsp;<br>

|| <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> || 
<a href=Sound.html>Sound</a> || 
<a href=Surface.html>Surface</a> ||<br>
|| <a href=pygame.html>pygame</a> || 
<a href=pygame_UserRect.html>UserRect</a> || 
<a href=pygame_cdrom.html>cdrom</a> || 
<a href=pygame_constants.html>constants</a> || 
<a href=pygame_cursors.html>cursors</a> || 
<a href=pygame_display.html>display</a> || 
<a href=pygame_event.html>event</a> ||<br>
|| <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> || 
<a href=pygame_mixer.html>mixer</a> || 
<a href=pygame_mixer_music.html>mixer_music</a> || 
<a href=pygame_mouse.html>mouse</a> ||<br>
|| <a href=pygame_surfarray.html>surfarray</a> || 
<a href=pygame_time.html>time</a> || 
<a href=pygame_version.html>version</a> ||<br>


</td></tr></table>
<br>
<h2 align=center>Sound</h2>
Sound objects represent actual sound data. Sound objects are
created from the function pygame.mixer.load(). Sound objects can
be playing on multiple channels simultaneously. Calling functions
like Sound.stop() from the sound objects will effect all channels
playing that Sound object.
<br>&nbsp;<br>
All sound objects have the same frequency and format as the
pygame.mixer module's initialization.

<hr>

<table>
<tr><td><a href=#fadeout>fadeout</a></td><td> -
fadeout all channels playing this sound</td></tr>


<tr><td><a href=#get_num_channels>get_num_channels</a></td><td> -
number of channels with sound</td></tr>


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


<tr><td><a href=#play>play</a></td><td> -
play sound</td></tr>


<tr><td><a href=#set_volume>set_volume</a></td><td> -
change volume for sound</td></tr>


<tr><td><a href=#stop>stop</a></td><td> -
stop all channels playing this sound</td></tr>


</table>

<hr>

<a name=fadeout><font size=+2><b>fadeout
</b></font><br><font size=+1><tt>
Sound.fadeout(millisec) -> None
</tt></font><ul>
Fade out all the playing channels playing this sound over the.
All channels playing this sound will be stopped after the given
milliseconds.
</ul><br>&nbsp;<br>

<a name=get_num_channels><font size=+2><b>get_num_channels
</b></font><br><font size=+1><tt>
Sound.get_num_channels() -> int
</tt></font><ul>
Returns the number of channels that have been using this sound.
The channels may have already finished, but have not started
playing any other sounds.
</ul><br>&nbsp;<br>

<a name=get_volume><font size=+2><b>get_volume
</b></font><br><font size=+1><tt>
Sound.get_volume() -> val
</tt></font><ul>
Returns the current volume for this sound object. The value is
0.0 to 1.0.
</ul><br>&nbsp;<br>

<a name=play><font size=+2><b>play
</b></font><br><font size=+1><tt>
Sound.play([loops, [maxtime]]) -> Channel
</tt></font><ul>
Starts playing a song on an available channel. If no channels are
available, it will not play and return None. Loops controls how
many extra times the sound will play, a negative loop will play
indefinitely, it defaults to 0. Maxtime is the number of total
milliseconds that the sound will play. It defaults to forever
(-1).
<br>&nbsp;<br>
Returns a channel object for the channel that is selected to play
the sound.
</ul><br>&nbsp;<br>

<a name=set_volume><font size=+2><b>set_volume
</b></font><br><font size=+1><tt>
Sound.set_volume(val) -> None
</tt></font><ul>
Set the play volume for this sound. This will effect any channels
currently playing this sound, along with all subsequent calls to
play. The value is 0.0 to 1.0.
</ul><br>&nbsp;<br>

<a name=stop><font size=+2><b>stop
</b></font><br><font size=+1><tt>
Sound.stop() -> None
</tt></font><ul>
This will instantly stop all channels playing this sound.
</ul><br>&nbsp;<br>


<hr>

</body></html>