I have users reporting slow / stuttering sound while using Bluetooth headphones in my game. Has anyone else experienced this? I don’t have a pair of bluetooth headphones to test it my self but I’ve had a couple of e-mails and bad reviews now.
In the latest build of the game I’m using Unity 5.3.1p1, and the reports seem to be mostly on Google Nexus devices. Using wired headphones the sound plays as it should with no problems.
Sorry I don’t have Bluetooth headphones to test it myself.
But here are some quotes from users:
“The app keeps crashing on my Nexus 5 with Android 6 Marshmallow and the sound plays like it is going in slow motion.”
“Hello I really like your game. I am using a nexus 6p and today I tried to use Bluetooth headphones. Well the sound just stutters like crazy only over Bluetooth. Wired in or using the phones sound no problem.”
“Hi Justin, I’ve been playing end space and I’m having a problem. Sound on my Bluetooth headset is coming out really choppy. I’m using a stock, non-rooted Nexus 5. The frame rate is great and the game is fun, just a minor issue I noticed.”
I have a stock Nexus 6 running 5.1.1 Android. I can confirm this issue on my phone on several apps I’ve downloaded for the Google Cardboard from the play store. Each game that uses Unity has the same jittering problem, even if the Bluetooth headphones are turned off while the app is open. Restarting with no Bluetooth devices connected seems to resolve the issue. This happened in Minecraft Story Mode, DinoTrek VR, AND VR Silent Home: Horror House.
I’m likely experiencing the same bug: with a Nexus 5x / Android 6.0.1 and Beats Studio Wireless headphones, I have a very simple demo where a single audio source mp3 is played and very little else going on in the scene. The audio sounds chopped and robotic through the Bluetooth headphones but perfect through wired headphones. Would love to know what’s causing that.
We were experiencing the same sound stuttering with Bluetooth Headphones on the GearVR with Unity 5.2 as well and I found a fix for the stuttering. If you increase the audio dspbuffersize past what “Best Performance” normally gives you it will make the audio sound correct. However Bluetooth headphones will experience noticeable audio lag (probably a combination of the increased buffer size and Bluetooth’s inherit slowness)
Code:
AudioConfiguration config = AudioSettings.GetConfiguration();
config.dspBufferSize = 2048; // Best Performance is 1024 on Samsung S6 in the GearVR
AudioSettings.Reset(config);
Unity v.5.3.1, Gear VR app
Added a MP3 music track to my scene and it plays slow & garbled like described in the other cases.
Works fine if I use the phone’s native speakers or a wired headset.
If I have used Bluetooth once it will continue to play slow & garbled. Even if I jump out of the particular scene, turn-off Bluetooth and re-load the scene it will now still play slow & garbled via the native speakers.
I also tested it with existing and well-regarded Gear VR apps like ‘Land’s End’. The game noticeably drops frames as long as the Bluetooth-headset is active (sound is okay actually but dropping frames in VR is a big no no making the user sick).
Thanks for that. This worked for me. ‘Best Performance’ setting was not sufficient.
I notice a slightly longer delay now when loading the scene but definitely worth it.
I had two more lines of code as I exposed a public AudioSource variable and I called .Play(); on this after running your code.
Hi, I’ve noticed with most, maybe all, Unity-based games I’ve played on my Nexus 6P with bluetooth audio have this choppy/stuttering issue.
I was surprised the otherwise well-polished The Room Three had the issue, and I just noticed it today with End Space VR today. I was hoping to experience spatialized sound support, but at least I now know I’m not alone with this issue.
Interestingly, if I turn off my bluetooth headphones, the choppy/stuttery audio continues through the phone’s speakers. I have to close the app and re-open it to get non-choppy audio to work.
Also, even though audio is choppy from the game, I am always able to mute the problematic games and get perfect bluetooth audio through my podcast player while the game is playing.
We’re working with Google engineers to solve the issue. In the meanwhile, setting buffersize to 2048 looks like the way to workaround the issue. I admit this results in huge latency, and appreciate your patience while we are trying to fix it the best way.
* more technical details
Looks like when the output goes through Bluetooth, audio driver is trying to consume a huge pile of audio info and then sleep for quite a while. I presume this is happening as a part of power conserving strategy. The amount of audio data consumed per each callback is ~5000 samples, while the default buffer size in Unity is 512x4 samples. This results in a weird “looping” sound that slowly progresses through the clip. Setting the buffer size to 2048x4 samples fixes the issue.
The “4” means the number of audio buffers. We have 4 of them, each 512 samples by default, to avoid underruns.
This is an internal number, I’m not sure it is exposed to external API. What you need to do is just set the DSPBufferSize to 2048, this results in 4 buffers 2048 samples each.
What versions will the fix be patched into? Will those only go into 5.4, or will 5.3 and 5.2 get it as well? (We’re using 5.2 and are affected by this bug, but it would be risky to move to another version at this point.)
Heads up, I noticed with the Samsung Galaxy S7 that 2048 was too low for dspBufferSize when using Bluetooth Headphones in the Gear. I ended up increasing it to 2700 for that phone.
I did originally up it to 4096 but the latency became unbearable, so eventually settled on 2700 on a value that fixed the stuttering without horrible latency.
Any further information on a more long-term solution Yury?