QSpatialSound#

A sound object in 3D space. More

Inheritance diagram of PySide6.QtSpatialAudio.QSpatialSound

Synopsis#

Properties#

Functions#

Slots#

Signals#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

QSpatialSound represents an audible object in 3D space. You can define its position and orientation in space, set the sound it is playing and define a volume for the object.

The object can have different attenuation behavior, emit sound mainly in one direction or spherically, and behave as if occluded by some other object.

class PySide6.QtSpatialAudio.QSpatialSound(engine)#
Parameters:

enginePySide6.QtSpatialAudio.QAudioEngine

Creates a spatial sound source for engine. The object can be placed in 3D space and will be louder the closer to the listener it is.

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property PᅟySide6.QtSpatialAudio.QSpatialSound.autoPlay: bool#

Determines whether the sound should automatically start playing when a source gets specified.

The default value is true.

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.directivity: float#

Defines the directivity of the sound source. A value of 0 implies that the sound is emitted equally in all directions, while a value of 1 implies that the source mainly emits sound in the forward direction.

Valid values are between 0 and 1, the default is 0.

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.directivityOrder: float#

Defines the order of the directivity of the sound source. A higher order implies a sharper localization of the sound cone.

The minimum value and default for this property is 1.

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.distanceCutoff: float#

Defines a distance beyond which sound coming from the source will cutoff. If the listener is further away from the sound object than the cutoff distance it won’t be audible anymore.

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.distanceModel: DistanceModel#

Defines distance model for this sound source. The volume starts scaling down from size to distanceCutoff . The volume is constant for distances smaller than size and zero for distances larger than the cutoff distance.

See also

DistanceModel

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.loops: int#

Determines how many times the sound is played before the player stops. Set to Infinite to play the current sound in a loop forever.

The default value is 1.

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.manualAttenuation: float#

Defines a manual attenuation factor if distanceModel is set to ManualAttenuation .

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.nearFieldGain: float#

Defines the near field gain for the sound source. Valid values are between 0 and 1. A near field gain of 1 will raise the volume of the sound signal by approx 20 dB for distances very close to the listener.

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.occlusionIntensity: float#

Defines how much the object is occluded. 0 implies the object is not occluded at all, 1 implies the sound source is fully occluded by another object.

A fully occluded object will still be audible, but especially higher frequencies will be dampened. In addition, the object will still participate in generating reverb and reflections in the room.

Values larger than 1 are possible to further dampen the direct sound coming from the source.

The default is 0.

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.position: PySide6.QtGui.QVector3D#

Defines the position of the sound source in 3D space. Units are in centimeters by default.

See also

distanceScale

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.rotation: PySide6.QtGui.QQuaternion#

Defines the orientation of the sound source in 3D space.

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.size: float#

Defines the size of the sound source. If the listener is closer to the sound object than the size, volume will stay constant. The size is also used to for occlusion calculations, where large sources can be partially occluded by a wall.

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.source: PySide6.QtCore.QUrl#

The source file for the sound to be played.

Access functions:
property PᅟySide6.QtSpatialAudio.QSpatialSound.volume: float#

Defines the volume of the sound.

Values between 0 and 1 will attenuate the sound, while values above 1 provide an additional gain boost.

Access functions:
PySide6.QtSpatialAudio.QSpatialSound.Loops#

Lets you control the sound playback loop using the following values:

Constant

Description

QSpatialSound.Infinite

Playback infinitely

QSpatialSound.Once

Playback once

PySide6.QtSpatialAudio.QSpatialSound.DistanceModel#

Defines how the volume of the sound scales with distance to the listener.

Constant

Description

QSpatialSound.DistanceModel.Logarithmic

Volume decreases logarithmically with distance.

QSpatialSound.DistanceModel.Linear

Volume decreases linearly with distance.

QSpatialSound.DistanceModel.ManualAttenuation

Attenuation is defined manually using the manualAttenuation property.

PySide6.QtSpatialAudio.QSpatialSound.autoPlay()#
Return type:

bool

See also

setAutoPlay()

Getter of property autoPlay .

PySide6.QtSpatialAudio.QSpatialSound.autoPlayChanged()#

Notification signal of property autoPlay .

PySide6.QtSpatialAudio.QSpatialSound.directivity()#
Return type:

float

See also

setDirectivity()

Getter of property directivity .

PySide6.QtSpatialAudio.QSpatialSound.directivityChanged()#

Notification signal of property directivity .

PySide6.QtSpatialAudio.QSpatialSound.directivityOrder()#
Return type:

float

Getter of property directivityOrder .

PySide6.QtSpatialAudio.QSpatialSound.directivityOrderChanged()#

Notification signal of property directivityOrder .

PySide6.QtSpatialAudio.QSpatialSound.distanceCutoff()#
Return type:

float

Getter of property distanceCutoff .

PySide6.QtSpatialAudio.QSpatialSound.distanceCutoffChanged()#

Notification signal of property distanceCutoff .

PySide6.QtSpatialAudio.QSpatialSound.distanceModel()#
Return type:

DistanceModel

Getter of property distanceModel .

PySide6.QtSpatialAudio.QSpatialSound.distanceModelChanged()#

Notification signal of property distanceModel .

PySide6.QtSpatialAudio.QSpatialSound.engine()#
Return type:

PySide6.QtSpatialAudio.QAudioEngine

Returns the engine associated with this listener.

PySide6.QtSpatialAudio.QSpatialSound.loops()#
Return type:

int

See also

setLoops()

Getter of property loops .

PySide6.QtSpatialAudio.QSpatialSound.loopsChanged()#

Notification signal of property loops .

PySide6.QtSpatialAudio.QSpatialSound.manualAttenuation()#
Return type:

float

Getter of property manualAttenuation .

PySide6.QtSpatialAudio.QSpatialSound.manualAttenuationChanged()#

Notification signal of property manualAttenuation .

PySide6.QtSpatialAudio.QSpatialSound.nearFieldGain()#
Return type:

float

Getter of property nearFieldGain .

PySide6.QtSpatialAudio.QSpatialSound.nearFieldGainChanged()#

Notification signal of property nearFieldGain .

PySide6.QtSpatialAudio.QSpatialSound.occlusionIntensity()#
Return type:

float

Getter of property occlusionIntensity .

PySide6.QtSpatialAudio.QSpatialSound.occlusionIntensityChanged()#

Notification signal of property occlusionIntensity .

PySide6.QtSpatialAudio.QSpatialSound.pause()#

Pauses sound playback. Calling play() will continue playback.

PySide6.QtSpatialAudio.QSpatialSound.play()#

Starts playing back the sound. Does nothing if the sound is already playing.

PySide6.QtSpatialAudio.QSpatialSound.position()#
Return type:

PySide6.QtGui.QVector3D

See also

setPosition()

Getter of property position .

PySide6.QtSpatialAudio.QSpatialSound.positionChanged()#

Notification signal of property position .

PySide6.QtSpatialAudio.QSpatialSound.rotation()#
Return type:

PySide6.QtGui.QQuaternion

See also

setRotation()

Getter of property rotation .

PySide6.QtSpatialAudio.QSpatialSound.rotationChanged()#

Notification signal of property rotation .

PySide6.QtSpatialAudio.QSpatialSound.setAutoPlay(autoPlay)#
Parameters:

autoPlay – bool

See also

autoPlay()

Setter of property autoPlay .

PySide6.QtSpatialAudio.QSpatialSound.setDirectivity(alpha)#
Parameters:

alpha – float

See also

directivity()

Setter of property directivity .

PySide6.QtSpatialAudio.QSpatialSound.setDirectivityOrder(alpha)#
Parameters:

alpha – float

Setter of property directivityOrder .

PySide6.QtSpatialAudio.QSpatialSound.setDistanceCutoff(cutoff)#
Parameters:

cutoff – float

See also

distanceCutoff()

Setter of property distanceCutoff .

PySide6.QtSpatialAudio.QSpatialSound.setDistanceModel(model)#
Parameters:

modelDistanceModel

See also

distanceModel()

Setter of property distanceModel .

PySide6.QtSpatialAudio.QSpatialSound.setLoops(loops)#
Parameters:

loops – int

See also

loops()

Setter of property loops .

PySide6.QtSpatialAudio.QSpatialSound.setManualAttenuation(attenuation)#
Parameters:

attenuation – float

Setter of property manualAttenuation .

PySide6.QtSpatialAudio.QSpatialSound.setNearFieldGain(gain)#
Parameters:

gain – float

See also

nearFieldGain()

Setter of property nearFieldGain .

PySide6.QtSpatialAudio.QSpatialSound.setOcclusionIntensity(occlusion)#
Parameters:

occlusion – float

Setter of property occlusionIntensity .

PySide6.QtSpatialAudio.QSpatialSound.setPosition(pos)#
Parameters:

posPySide6.QtGui.QVector3D

See also

position()

Setter of property position .

PySide6.QtSpatialAudio.QSpatialSound.setRotation(q)#
Parameters:

qPySide6.QtGui.QQuaternion

See also

rotation()

Setter of property rotation .

PySide6.QtSpatialAudio.QSpatialSound.setSize(size)#
Parameters:

size – float

See also

size()

Setter of property size .

PySide6.QtSpatialAudio.QSpatialSound.setSource(url)#
Parameters:

urlPySide6.QtCore.QUrl

See also

source()

Setter of property source .

PySide6.QtSpatialAudio.QSpatialSound.setVolume(volume)#
Parameters:

volume – float

See also

volume()

Setter of property volume .

PySide6.QtSpatialAudio.QSpatialSound.size()#
Return type:

float

See also

setSize()

Getter of property size .

PySide6.QtSpatialAudio.QSpatialSound.sizeChanged()#

Notification signal of property size .

PySide6.QtSpatialAudio.QSpatialSound.source()#
Return type:

PySide6.QtCore.QUrl

See also

setSource()

Getter of property source .

PySide6.QtSpatialAudio.QSpatialSound.sourceChanged()#

Notification signal of property source .

PySide6.QtSpatialAudio.QSpatialSound.stop()#

Stops sound playback and resets the current position and current loop count to 0. Calling play() will start playback at the beginning of the sound file.

PySide6.QtSpatialAudio.QSpatialSound.volume()#
Return type:

float

See also

setVolume()

Getter of property volume .

PySide6.QtSpatialAudio.QSpatialSound.volumeChanged()#

Notification signal of property volume .