1. pygame
  2. pygame
  3. pygame


pygame / docs / Sound.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>Sound</h2>
Sound object represents actual sound data.


<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>



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

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

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

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

Returns a channel object for the channel that is
selected to play the sound.

<a name=set_volume><font size=+2><b>set_volume
</b></font><br><font size=+1><tt>
Sound.set_volume(val) -> None
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.

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