|
16
|
1 <html>
|
|
|
2 <title>Sound</title>
|
|
235
|
3 <body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
|
|
|
4
|
|
16
|
5
|
|
235
|
6 <table cellspacing=3 width=100%><tr><td bgcolor=#00000>
|
|
|
7 <table width=100%><tr><td bgcolor=c2fc20 align=center>
|
|
|
8 <a href=http://www.pygame.org>
|
|
250
|
9 <img src=../pygame_tiny.gif border=0 width=200 height=60></a><br>
|
|
235
|
10 <b>pygame documentation</b>
|
|
|
11 </td><td bgcolor=6aee28 align=center valign=top width=100%>
|
|
16
|
12
|
|
|
13 ||
|
|
178
|
14 <a href=http://www.pygame.org>Home</a> ||
|
|
16
|
15 <a href=../index.html>Help Contents</a> ||
|
|
|
16 <br> <br>
|
|
|
17
|
|
384
|
18 || <a href=pygame.html>pygame</a> ||
|
|
265
|
19 <a href=pygame_cdrom.html>cdrom</a> ||
|
|
|
20 <a href=pygame_constants.html>constants</a> ||
|
|
|
21 <a href=pygame_display.html>display</a> ||
|
|
384
|
22 <a href=pygame_draw.html>draw</a> ||
|
|
|
23 <a href=pygame_event.html>event</a> ||<br>
|
|
|
24 || <a href=pygame_font.html>font</a> ||
|
|
265
|
25 <a href=pygame_image.html>image</a> ||
|
|
|
26 <a href=pygame_joystick.html>joystick</a> ||
|
|
|
27 <a href=pygame_key.html>key</a> ||
|
|
384
|
28 <a href=pygame_mixer.html>mixer</a> ||
|
|
|
29 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
|
|
|
30 || <a href=pygame_mouse.html>mouse</a> ||
|
|
265
|
31 <a href=pygame_movie.html>movie</a> ||
|
|
370
|
32 <a href=pygame_sndarray.html>sndarray</a> ||
|
|
265
|
33 <a href=pygame_surfarray.html>surfarray</a> ||
|
|
384
|
34 <a href=pygame_time.html>time</a> ||
|
|
|
35 <a href=pygame_transform.html>transform</a> ||<br>
|
|
265
|
36 <br>|| <a href=CD.html>CD</a> ||
|
|
16
|
37 <a href=Channel.html>Channel</a> ||
|
|
277
|
38 <a href=Clock.html>Clock</a> ||
|
|
16
|
39 <a href=Font.html>Font</a> ||
|
|
|
40 <a href=Joystick.html>Joystick</a> ||
|
|
277
|
41 <a href=Movie.html>Movie</a> ||<br>
|
|
|
42 || <a href=Rect.html>Rect</a> ||
|
|
|
43 <a href=Sound.html>Sound</a> ||
|
|
265
|
44 <a href=Surface.html>Surface</a> ||<br>
|
|
299
|
45 <br>|| <a href=pygame_cursors.html>cursors</a> ||
|
|
375
|
46 <a href=pygame_sprite.html>sprite</a> ||<br>
|
|
16
|
47
|
|
|
48
|
|
235
|
49 </td></tr></table></td></tr></table>
|
|
16
|
50 <br>
|
|
|
51 <h2 align=center>Sound</h2>
|
|
|
52 Sound objects represent actual sound data. Sound objects are
|
|
151
|
53 created from the function <a href=pygame_mixer.html#Sound>pygame.mixer.Sound()</a>. Sound objects can
|
|
16
|
54 be playing on multiple channels simultaneously. Calling functions
|
|
88
|
55 like <a href=#stop>Sound.stop()</a> from the sound objects will effect all channels
|
|
16
|
56 playing that Sound object.
|
|
151
|
57 <br> <br>
|
|
16
|
58 All sound objects have the same frequency and format as the
|
|
|
59 pygame.mixer module's initialization.
|
|
|
60
|
|
|
61 <hr>
|
|
|
62
|
|
|
63 <table>
|
|
|
64 <tr><td><a href=#fadeout>fadeout</a></td><td> -
|
|
|
65 fadeout all channels playing this sound</td></tr>
|
|
|
66
|
|
|
67
|
|
|
68 <tr><td><a href=#get_num_channels>get_num_channels</a></td><td> -
|
|
|
69 number of channels with sound</td></tr>
|
|
|
70
|
|
|
71
|
|
|
72 <tr><td><a href=#get_volume>get_volume</a></td><td> -
|
|
|
73 query volume for sound</td></tr>
|
|
|
74
|
|
|
75
|
|
|
76 <tr><td><a href=#play>play</a></td><td> -
|
|
|
77 play sound</td></tr>
|
|
|
78
|
|
|
79
|
|
|
80 <tr><td><a href=#set_volume>set_volume</a></td><td> -
|
|
|
81 change volume for sound</td></tr>
|
|
|
82
|
|
|
83
|
|
|
84 <tr><td><a href=#stop>stop</a></td><td> -
|
|
|
85 stop all channels playing this sound</td></tr>
|
|
|
86
|
|
|
87
|
|
|
88 </table>
|
|
|
89
|
|
|
90 <hr>
|
|
|
91
|
|
|
92 <a name=fadeout><font size=+2><b>fadeout
|
|
|
93 </b></font><br><font size=+1><tt>
|
|
|
94 Sound.fadeout(millisec) -> None
|
|
|
95 </tt></font><ul>
|
|
|
96 Fade out all the playing channels playing this sound over the.
|
|
|
97 All channels playing this sound will be stopped after the given
|
|
|
98 milliseconds.
|
|
|
99 </ul><br> <br>
|
|
|
100
|
|
|
101 <a name=get_num_channels><font size=+2><b>get_num_channels
|
|
|
102 </b></font><br><font size=+1><tt>
|
|
|
103 Sound.get_num_channels() -> int
|
|
|
104 </tt></font><ul>
|
|
|
105 Returns the number of channels that have been using this sound.
|
|
|
106 The channels may have already finished, but have not started
|
|
|
107 playing any other sounds.
|
|
|
108 </ul><br> <br>
|
|
|
109
|
|
|
110 <a name=get_volume><font size=+2><b>get_volume
|
|
|
111 </b></font><br><font size=+1><tt>
|
|
|
112 Sound.get_volume() -> val
|
|
|
113 </tt></font><ul>
|
|
|
114 Returns the current volume for this sound object. The value is
|
|
|
115 0.0 to 1.0.
|
|
|
116 </ul><br> <br>
|
|
|
117
|
|
|
118 <a name=play><font size=+2><b>play
|
|
|
119 </b></font><br><font size=+1><tt>
|
|
|
120 Sound.play([loops, [maxtime]]) -> Channel
|
|
|
121 </tt></font><ul>
|
|
|
122 Starts playing a song on an available channel. If no channels are
|
|
|
123 available, it will not play and return None. Loops controls how
|
|
|
124 many extra times the sound will play, a negative loop will play
|
|
|
125 indefinitely, it defaults to 0. Maxtime is the number of total
|
|
|
126 milliseconds that the sound will play. It defaults to forever
|
|
|
127 (-1).
|
|
151
|
128 <br> <br>
|
|
16
|
129 Returns a channel object for the channel that is selected to play
|
|
|
130 the sound.
|
|
|
131 </ul><br> <br>
|
|
|
132
|
|
|
133 <a name=set_volume><font size=+2><b>set_volume
|
|
|
134 </b></font><br><font size=+1><tt>
|
|
|
135 Sound.set_volume(val) -> None
|
|
|
136 </tt></font><ul>
|
|
|
137 Set the play volume for this sound. This will effect any channels
|
|
|
138 currently playing this sound, along with all subsequent calls to
|
|
|
139 play. The value is 0.0 to 1.0.
|
|
|
140 </ul><br> <br>
|
|
|
141
|
|
|
142 <a name=stop><font size=+2><b>stop
|
|
|
143 </b></font><br><font size=+1><tt>
|
|
|
144 Sound.stop() -> None
|
|
|
145 </tt></font><ul>
|
|
|
146 This will instantly stop all channels playing this sound.
|
|
|
147 </ul><br> <br>
|
|
|
148
|
|
|
149
|
|
|
150 <hr>
|
|
|
151 </body></html>
|