Enhanced Audio foundations
Choose which low-level, platform audio layer to act as the bridge between Unity's audio engine and the hardware or operating system of a device.
Read time 4 minutesLast updated 5 days ago
Audio Foundation is a setting in the Audio project settings that lets you choose which low-level, platform audio layer to act as the bridge between Unity's audio engine and the hardware or operating system of a device. It's responsible for end-of-pipeline audio processing right before handing the output stream to the device.
The Classic Audio Foundation is the platform layer used in Unity 6.6 and below which relies on external audio engine output layers.
The Enhanced Audio Foundation (EAF) is a platform audio layer that introduces significant improvements to the Classic audio foundation. This page goes over the benefits of EAF and how it compares to the classic version.
Supported platforms
You can use EAF on any supported platform, including:
- Windows, macOS, and Linux
- iOS and Android (8.1 and later)
- XBOX Series X|S and XBOX One
- PlayStation®5
- Nintendo Switch™ and Nintendo Switch™ 2
Other platforms continue to use the Classic Audio Foundation.
EAF benefits and features
EAF has the following benefits and features:
- Seamless device switching
- No main thread stalls
- Device enumeration
- Higher quality sample rate conversion
- Set channel layout and sampling rates
Seamless device switching
When the default device changes- for example, when the user connects headphones- and if any playback property like the sampling rate is different between the old device and the new one, the two audio foundations react differently.
In the Classic Audio Foundation, the entire audio engine resets and all engine state, including any playing sounds, stops. Any operating system (OS) that doesn't support EAF continues to use this audio layer.
However, in the Enhanced Audio Foundation, you can prevent the reset if you set Output Channel Layout and Output Sampling Rate in the Audio project settings to any setting other than Device Native.
No main thread stalls
When the user connects or disconnects a device, Unity re-enumerates to keep an updated list of available devices. If the default audio output device changes, it stops the previous device and starts the new device. Whenever an application starts or stops recording, the requested recording device starts or stops. These operations can be resource-intensive.
With EAF, these operations all execute asynchronously off the main thread, so you avoid long main thread CPU stalls, which can affect your application’s frame rate.
Device enumeration
Even though Unity still outputs audio exclusively through the default output device, the Enhanced Audio Foundation (EAF) improves microphone detection. It provides a complete list of all connected microphones, and you can select any of them for recording. In contrast, the Classic Audio Foundation might not detect all available microphones on certain platforms.
Higher quality sample rate conversions
When your app is running at an explicit sampling rate, like 48Khz, the Enhanced Audio Foundation does the sample-rate conversion to match the default output device’s sampling rate. This algorithm is much higher-quality now.
Set channel layout and sampling rates
With EAF, you can set an explicit channel layout (Output Channel Layout) and sampling rate (Output Sampling Rate), or refer to the device's settings instead (Device Native).
If you choose a channel layout or sampling rate that's different to the output device, EAF handles any necessary up-mixing, down-mixing, or sample rate conversions.
7.1.4 channel layout
7.1.4 is a 12-channel surround layout: the eight channels of 7.1 (front left/right, center, LFE, two side surrounds, two rear surrounds) plus four height speakers. These additional height channels create a more realistic spatial audio experience on home theaters and high-end setups.
If you select this layout, Unity queries the OS for native 7.1.4 support, regardless of the output device's capabilities. If supported, Unity passes the full 12-channel stream directly to the OS rather than downmixing the audio to flatter layouts. The OS then uses its specialized hardware and APIs to spatialize and downmix the audio to the device's built-in layout, which can provide more advanced spatialization than Unity's default panning.
Some important notes:
-
If the device doesn't support 7.1.4 passthrough, Unity still pans the audio to the virtual speaker positions, and then downmixes the audio stream to the device’s native layout.
-
Passthrough to the OS spatializer is only supported on Windows, XBOX, Quest and Android devices that support spatial audio.
Device Native
The Device Native setting ensures the entire audio engine runs at the device’s built-in layout and sampling rate. This avoids the sample-rate conversion and up/down-mixing operations right before output. This can be more CPU-efficient.
However, you lose EAF's device switching benefits. If the default device’s layout or sampling rate changes at runtime (for example, when a user connects headphones), the entire audio engine must reset.
Note: If you set these properties to Device Native, it closely mimics how the Classic Audio Foundation works on most platforms. The device’s built-in settings typically override the user’s requested project settings.