Trees | Indices | Toggle frames |
---|
The Sound object represents actual sound sample data.
Methods that change the state of the Sound object will the all instances of the Sound playback.
__del__(self) | |
__init__(self,
file,
_chunk=None)
Create a new Sound object from a file.
|
|
fadeout(self,
time)
Stop sound playback after fading out.
|
|
float |
get_length(self)
Get the length of the Sound.
|
int |
get_num_channels(self)
Count how many times this Sound is playing.
|
float |
get_volume(self)
Get the playback volume.
|
Channel |
play(self,
loops=0,
maxtime=-1)
Begin sound playback.
|
set_volume(self,
volume)
Set the playback volume for this Sound.
|
|
stop(self)
Stop sound playback.
|
Create a new Sound object from a file.
Load a new sound buffer from a filename or from a python file object. Limited resampling will be performed to help the sample match the initialize arguments for the mixer.
The Sound can be loaded from an OGG audio file or from an uncompressed WAV.
Stop sound playback after fading out.
This will stop playback of the sound after fading it out over the time argument in milliseconds. The Sound will fade and stop on all actively playing channels.
Get the length of the Sound.
Return the length of this Sound in seconds.
Count how many times this Sound is playing.
Return the number of active channels this sound is playing on.
Get the playback volume.
Return a value from 0.0 to 1.0 representing the volume for this Sound.
Begin sound playback.
Begin playback of the Sound (i.e., on the computer's speakers) on an available Channel. This will forcibly select a Channel, so playback may cut off a currently playing sound if necessary.
The loops argument controls how many times the sample will be repeated after being played the first time. A value of 5 means that the sound will be played once, then repeated five times, and so is played a total of six times. The default value (zero) means the Sound is not repeated, and so is only played once. If loops is set to -1 the Sound will loop indefinitely (though you can still call stop() to stop it).
The maxtime argument can be used to stop playback after a given number of milliseconds.
Set the playback volume for this Sound.
This will set the playback volume (loudness) for this Sound. This will immediately affect the Sound if it is playing. It will also affect any future playback of this Sound. The argument is a value from 0.0 to 1.0.
Stop sound playback.
This will stop the playback of this Sound on any active Channels.
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Wed Jul 07 22:46:51 2010 | http://epydoc.sourceforge.net |