You are viewing PyUnity docs under the
As such, they are only applicable if you installed from source.
Go to https://docs.pyunity.x10.bz/en/latest/ for the most recent
Classes to manage the playback of audio.
It uses the sdl2.sdlmixer library.
A variable in the
config module called
audio will be set to
False if the
mixer module cannot be initialized.
- class pyunity.audio.AudioClip¶
Class to store information about an audio file.
- class pyunity.audio.AudioSource¶
Manages playback on an AudioSource.
- clip = None¶
Clip to play. Best way to set the clip is to use the
Sets a clip for the AudioSource to play.
clip (AudioClip) – AudioClip to play
Plays the AudioClip attached to the AudioSource.
Stops playing the AudioClip attached to the AudioSource.
Pauses the AudioClip attached to the AudioSource.
Unpauses the AudioClip attached to the AudioSource.
- property Playing¶
Gets if the AudioSource is playing.
- class pyunity.audio.AudioListener¶
Class to receive audio events and to base spatial sound from. By default the Main Camera has an AudioListener, but you can also remove it and add a new one to another GameObject in a Scene. There can only be one AudioListener, otherwise sound is disabled.
Initializes the AudioListener.
Stops all AudioSources and frees memory that is used by the AudioClips.