Device¶
-
class
aud.
Device
¶ Device objects represent an audio output backend like OpenAL or SDL, but might also represent a file output or RAM buffer output.
-
channels
¶ The channel count of the device.
-
distance_model
¶ The distance model of the device.
-
doppler_factor
¶ The doppler factor of the device. This factor is a scaling factor for the velocity vectors in doppler calculation. So a value bigger than 1 will exaggerate the effect as it raises the velocity.
-
format
¶ The native sample format of the device.
-
listener_location
¶ The listeners’s location in 3D space, a 3D tuple of floats.
-
listener_orientation
¶ The listener’s orientation in 3D space as quaternion, a 4 float tuple.
-
listener_velocity
¶ The listener’s velocity in 3D space, a 3D tuple of floats.
-
lock
()¶ Locks the device so that it’s guaranteed, that no samples are read from the streams until
unlock()
is called. This is useful if you want to do start/stop/pause/resume some sounds at the same time.Note
The device has to be unlocked as often as locked to be able to continue playback.
Warning
Make sure the time between locking and unlocking is as short as possible to avoid clicks.
-
play
(sound, keep=False)¶ Plays a sound.
Parameters: - sound (
Sound
) – The sound to play. - keep (bool) – See
Handle.keep
.
Returns: The playback handle with which playback can be controlled with.
Return type: - sound (
-
rate
¶ The sampling rate of the device in Hz.
-
speed_of_sound
¶ The speed of sound of the device. The speed of sound in air is typically 343.3 m/s.
-
stopAll
()¶ Stops all playing and paused sounds.
-
volume
¶ The overall volume of the device.
-