Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bluetooth headphones sound problems

Discussion in 'Audio & Video' started by Justin-Wasilenko, Dec 30, 2015.

  1. Justin-Wasilenko

    Justin-Wasilenko

    Joined:
    Mar 10, 2015
    Posts:
    103
    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.
     
    yuliyF likes this.
  2. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Hi!

    Can you please submit a bug report and let me know the case #?

    Thanks!
     
  3. Justin-Wasilenko

    Justin-Wasilenko

    Joined:
    Mar 10, 2015
    Posts:
    103
    Case number 758142.

    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."
     
  4. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Thanks! I've forwarded the case for QAs to confirm.
     
  5. iregretjumping

    iregretjumping

    Joined:
    Jan 4, 2016
    Posts:
    1
    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.
     
  6. kenmoore

    kenmoore

    Joined:
    Jan 4, 2016
    Posts:
    3
    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.
     
  7. BrycePresenceLabs

    BrycePresenceLabs

    Joined:
    Jun 15, 2015
    Posts:
    2
    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);
     
  8. Wollan

    Wollan

    Joined:
    Feb 13, 2014
    Posts:
    6
    I have the same issue.
    - Samsung Galaxy S6
    - Samsung Level On Bluetooth-headset.
    - 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).
     
  9. Wollan

    Wollan

    Joined:
    Feb 13, 2014
    Posts:
    6
    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.
     
    IMC-Lab likes this.
  10. dylangreene

    dylangreene

    Joined:
    Feb 6, 2016
    Posts:
    1
    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.
     
    KoalityGame likes this.
  11. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    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.
     
  12. Egil-Sandfeld

    Egil-Sandfeld

    Joined:
    Oct 8, 2012
    Posts:
    72
    Thanks for the heads up, Yury.
    Thanks for the fix, BrycePresenceLabs!

    With Wwise + Unity this problem also persists using Bluetooth, so any work regarding lower audio latency in Unity is much appreciated.
     
  13. Sylafrs

    Sylafrs

    Joined:
    Jun 25, 2013
    Posts:
    65
    What does the '4' mean, Is it the count of channels? (Isn't Stereo or Mono by default?)
     
  14. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    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.
     
  15. SimonFireproof

    SimonFireproof

    Joined:
    May 20, 2013
    Posts:
    16
    Has there been any progress on a better fix for this issue which doesn't increase latency?
     
  16. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    The fix is cooking :)

    There won't be any other fix for Bluetooth than increasing latency. You can't expect good latency from wireless audio because of power restrictions.
     
  17. michaelBaobab

    michaelBaobab

    Joined:
    Mar 15, 2016
    Posts:
    1
    Two questions:
    1. Any details you can give on the ETA of the fix?
    2. 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.)
     
  18. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Hi @michaelBaobab!

    1. No ETA on the fix yet. I tried the thing suggested by Google as a proof-of-concept yesterday, but it does not look like a solution to go.
    2. On the backporting - as you know, there are no more releases of 5.2.
     
  19. BrycePresenceLabs

    BrycePresenceLabs

    Joined:
    Jun 15, 2015
    Posts:
    2
    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?
     
  20. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Hi folks!

    Thank you for your patience.
    With Unity 5.3.4p6, Bluetooth and casting audio issues should be fixed.

    Please let me know if it works for you.
     
  21. Justin-Wasilenko

    Justin-Wasilenko

    Joined:
    Mar 10, 2015
    Posts:
    103
    Well that is certainly good news. So many bad reviews on my apps because of this issue :(
     
  22. laggyluk

    laggyluk

    Joined:
    Oct 7, 2011
    Posts:
    32
    choppy framerate and no sound at all when using bluetooth headphones on nexus 6p, Unity 5.3.5f1
    reported as 806931
     
    Last edited: Jun 19, 2016
  23. dpgSam

    dpgSam

    Joined:
    Jan 8, 2015
    Posts:
    10
    Bump.
    I test apps now professionally for Android, and there's still plenty of Games (not every game) I've been testing that are still experiencing this exact same issue with Bluetooth audio.

    I will assume that these select games that I came across with this audio problem are built using Unity, since this topic seems to only be discussed here in the Unity forums, haven't found any other discussions outside of Unity relating to this audio issue.

    Unity devs out there are still building games with this bluetooth audio problem, patch Unity soon with a fix as Wireless Bluetooth market continues to grow (and rumors grow relating to Apple's upcoming phones using wireless audio as well).
     
  24. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @dpgSam : thank you for your message. I've fixed Bluetooth issue a while ago. Unfortunately, I cannot make all the game developers build their games with latest version of Unity and update it on Google Play.
     
  25. anthonydane

    anthonydane

    Joined:
    Aug 15, 2016
    Posts:
    1
    I am also facing the same issue. In some games i am having issue. there is problem when im playing boom beach, but not with CoC.
     
  26. laggyluk

    laggyluk

    Joined:
    Oct 7, 2011
    Posts:
    32
    when was that? My app built with 5.4.0p1 has this problem
     
  27. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @laggyluk 5.4 beta 18. Please submit a bug report.
     
  28. greenmonster

    greenmonster

    Joined:
    Jan 18, 2013
    Posts:
    26
    A playtester has just reported this issue in a Gear VR build using Unity 5.3.8f1 on a Note 5. Can I confirm whether this was supposed to be fixed in that version of Unity?

    If not, I will need to try the DSPbuffersize workaround mentioned above and focus my time on testing audio latency per device (of which I am missing several, hence the need for playtesters).

    Thank you!

    edit: I got some clarification, the playtester only saw this issue when using MirrorOP software to record a video/audio stream, and he was listening to the audio from that stream. So maybe not widespread as I'm fearing, but would still be good to get confirmation that I'm in the clear on this Unity version. Thanks!
     
    Last edited: Mar 27, 2017
  29. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
  30. greenmonster

    greenmonster

    Joined:
    Jan 18, 2013
    Posts:
    26
    I don't know - I can't upgrade to later versions yet.
     
  31. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Could you elaborate a bit more about the course of action and the observations?
    Are you using Bluetooth headphones with GearVR?
    Or is it wired headphones with a screen recording software?
     
  32. greenmonster

    greenmonster

    Joined:
    Jan 18, 2013
    Posts:
    26
    This particular playtester was using software called MirrorOP to stream both audio and video from the Gear VR device to his PC, and then he had bluetooth headphones hooked up to his PC. The recorded audio (and thus the audio he heard on his headphones) was the same slowed down stuttery audio described in this thread. Fortunately I haven't heard of this happening from any other playtester on any device, even when using a variety of headset streaming solutions. Now that I've heard back from more testers, it's not something I'm too concerned about at this point. Thanks!
     
  33. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Sounds like the external software issue to me. If you can reproduce the issue yourself - could you submit a bug report, with the project attached and as much info as possible (device models, additional software version etc.). We'll take a look into the issue then.
     
  34. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    Wanted to add something to this thread what I found, that it is officially stated that Fast Audio Track does not work with bluetooth headphones. https://developer.android.com/ndk/guides/audio/opensl/opensl-prog-notes#perform

    Quoted from that page :

    Lower latency audio is possible for these outputs only:
    By their "low latency" it is not generally low latency, but being able to get a special fast mixer track from Android. When you have a wireless device connected all requests for fast mixer track automatically fails.
     
  35. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    That's correct, Unity disables OpenSL fast path if bluetooth output is selected.
     
  36. nikokoneko

    nikokoneko

    Joined:
    Feb 20, 2015
    Posts:
    35
    I have the same problems using bluetooth headphones with MacOS, in Unity Editor. The audio clip plays more slowly when using a bluetooth headset, at about 90% of natural speed. I use Decompress on Load/ Vorbis / Preload Audio Data options. Again, it's not that audio has latency, which I would expect, but the actual speed of the playback changes, it slows down.