Not signed in
Copyright © 2026 Unity Technologies
Added support for Android's AAudio engine, so on Android 8.1 and later, Unity Audio is now layered over AAudio. This fixes 4 audio bugs, related to built-in stereo speaker output, built-in vs. Bluetooth microphone selection, Microphone.Start and Microphone.Stop CPU spikes, and low-latency audio output.
The worst Microphone.Start and Microphone.Stop CPU spikes, that could be 300-400ms, were on iOS. Those were fixed in all Unity versions 2019.4 and later. The CPU spikes on Android are much smaller and only happen on certain devices. We've fixed this bug in Unity 2023.1 by implementing Android AAudio support, which works on Android 8.1 and later (which is currently 85-90% of Android devices). AAudio has more of an asynchronous interface, so we are not blocking the main thread if these operations take a long time. We are not planning to back-port this change because it is new functionality and it is risky. AAudio has its own set of challenges and we are focusing on making it as robust as possible as 2023.1 matures.
The worst Microphone.Start and Microphone.Stop CPU spikes, that could be 300-400ms, were on iOS. Those were fixed in all Unity versions 2019.4 and later. The CPU spikes on Android are much smaller and only happen on certain devices. We've fixed this bug in Unity 2023.1 by implementing Android AAudio support, which works on Android 8.1 and later (which is currently 85-90% of Android devices). AAudio has more of an asynchronous interface, so we are not blocking the main thread if these operations take a long time. We are not planning to back-port this change because it is new functionality and it is risky. AAudio has its own set of challenges and we are focusing on making it as robust as possible as 2023.1 matures.
The worst Microphone.Start and Microphone.Stop CPU spikes, that could be 300-400ms, were on iOS. Those were fixed in all Unity versions 2019.4 and later. The CPU spikes on Android are much smaller and only happen on certain devices. We've fixed this bug in Unity 2023.1 by implementing Android AAudio support, which works on Android 8.1 and later (which is currently 85-90% of Android devices). AAudio has more of an asynchronous interface, so we are not blocking the main thread if these operations take a long time. We are not planning to back-port this change because it is new functionality and it is risky. AAudio has its own set of challenges and we are focusing on making it as robust as possible as 2023.1 matures.
How to reproduce:
1. Open the attached 'MicrophoneSpike.zip' project
2. Set Platform Target to Android
3. Make sure that 'Development Build' and 'Deep Profiling Support' flags are ticked in the Build Settings
4. Build and run
5. Attach the Profiler to the Autoconnected Player
6. Press the record button in the Profiler
7. Click the 'Start Recording' button in the launched application
8. Stop recording
9. Search for 'Microphone.StartRecord()' in Profiler
Expected result: There are no spikes in the Profiler when the 'Microphone.StartRecord()' method is called
Actual result: 'Microphone.StartRecord()' method causes about 400ms spikes
Reproducible with: 2018.4.27f1, 2019.4.12f1, 2020.1.8f1, 2020.2.0b6
Reproducible with:
iPad Air 2 (iOS 11.0.3) (352ms)
iPhone 8+ (iOS 12.0) (436ms)
iPhone XR (iOS 13.4.1) (415ms)
iPad 9.7’ 6th gen (iOS 14.2) (398ms)
Huawei HUAWEI Mate 20 Pro (LYA-L29), Android 9, CPU: HiSilicon Kirin 980, GPU: Mali-G76 (130ms IL2CPP, 60ms Mono)
VLNQA00001, Google Pixel 2 (Pixel 2), Android 11, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540 (30ms Mono and IL2CPP)
Oneplus OnePlus 6 (ONEPLUS A6003), Android 10, CPU: Snapdragon 845 SDM845, GPU: Adreno (TM) 630 (50ms Mono and IL2CPP)
Not reproducible with:
VLNQA00012, Samsung Galaxy S6 (SM-G920F), Android 7.0, CPU: Exynos 7 Octa 7420, GPU: Mali-T760 (4ms both Microphone.Start() and Microphone.StartRecord() tested 10 times)
VLNQA00122, Samsung Galaxy S9 (SM-G960F), Android 9, CPU: Exynos 9 Series 9810, GPU: Mali-G72 (20ms both Microphone.Start() and Microphone.StartRecord() tested 10 times)
VLNQA00125, Google Pixel 2 (Pixel 2), Android 8.1.0, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540 (10ms both Microphone.Start() and Microphone.StartRecord() tested 10 times)
VLNQA00321, Xiaomi MI 9 (MI 9), Android 9, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640 (27ms both Microphone.Start() and Microphone.StartRecord() tested 10 times)
VLNQA00013, Samsung Galaxy S6 edge+ (SM-G928F), Android 7.0, CPU: Exynos 7 Octa 7420, GPU: Mali-T760 (5ms)
VLNQA00078, Motorola Nexus 6 (Nexus 6), Android 7.1.1, CPU: Snapdragon 805 APQ8084AB, GPU: Adreno (TM) 420 (20ms)
35465210338 Samsung Galaxy S10 (SM-G975F), Android 10.0, CPU: Exynos 9820 (ARMv8), GPU: Mali-G76 (22 ms)
Notes:
-100% reproduction rate with iOS, and a 60% reproduction rate with Android
-The spike seems worse on iOS, with a range 400ms - 800ms, however it is also present on Android even though the spike is slightly less there with a range of 150ms - 300ms
Sign in to see your voted issues