One of the new features introduced in Steam Audio 2.0-beta.14 is source directivity
. In the real world, sources emit sounds with different intensities in different directions. For example, when a person is speaking, their speech is louder in front of them than behind them. Source directivity is a way of modeling this phenomenon in virtual worlds.
Directivity affects reflections
Usually, source directivity only affects sound traveling in a straight line from the source to the listener. In Steam Audio, every individual reflection of sound is affected by source directivity, opening up new opportunities for designers. For example, the below video shows a rotating source with a cardioid directivity. When the source emits sound into the reverberant room, reverb can be heard at the listener position; when the source emits sound away from the reverberant room, almost no reverb is heard.https://youtu.be/VRS2rpC3LKg
How does directivity work?
A source directivity pattern specifies a scaling factor to be applied to sound as a function of direction relative to the source's coordinate system. The default directivity pattern in Steam Audio is a weighted sum of an omnidirectional (monopole) pattern and a dipole pattern oriented along the source's z-axis (front/back axis). This directivity pattern is controlled by two numbers: the dipole weight
, and the dipole power
. The dipole weight determines how "dipole-like" the final directivity pattern is: setting this to 0 gives an omnidirectional pattern, setting this to 1 gives a pure dipole pattern, and setting this to 0.5 gives a front-facing cardioid pattern. The dipole power determines how "sharp" or "focused" the dipole is.
Using directivity in Steam AudioUnity Plugin
To use source directivity in the Unity plugin, first attach a Steam Audio Source component to the Audio Source you want to specify a directivity pattern for. Next, use the Dipole Weight and Dipole Power sliders to specify the directivity pattern; the visualization will update in the Inspector tab and in the Scene tab as you adjust the sliders.C API
In the C API, directivity patterns are specified using the IPLDirectivity struct, an instance of which is contained in the IPLSource struct. The IPLSource struct, in turn, is passed to the iplGetDirectSoundPath function (when simulating direct sound), and the iplSetDryAudioForConvolutionEffect function (when simulating indirect sound). Use the dipoleWeight and dipolePower member variables of the IPLDirectivity struct to specify a directivity pattern.
Arbitrary Directivity Patterns
When using the C API, you can specify any arbitrary directivity pattern using a callback function: set the callback and userData member variables of the IPLDirectivity struct to use this functionality. The specified callback will be called by Steam Audio whenever it needs to evaluate a directivity pattern. Refer to the C API documentation for more details.