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

Android sound problem

Discussion in 'Android' started by Dr. Argento, Oct 5, 2015.

  1. Dr. Argento

    Dr. Argento

    Joined:
    Jan 29, 2015
    Posts:
    23
    Hi there, before making a posting on forums I made here http://answers.unity3d.com/questions/1076570/android-sound-problem.html. My problem is the music or sounds its sooo slow and not fluid (like a "choppy") in my Galaxy S3 (whith android 5.1.1, also tested in same device with android 4.4.4), but in my Galaxy TAB 3 all works normally, the funny thing is that this problem is present starting from Unity version 5.2.0 (version 5.1.3 works fine). I tried FMOD too and nothing.

    If anyone has any solution and forgive me if I don't express well, my first language is not English.
     
    Haze-Games and BartNT like this.
  2. daudau505

    daudau505

    Joined:
    Jul 19, 2014
    Posts:
    27
    Same exact problem, still no fix.
     
  3. Dr. Argento

    Dr. Argento

    Joined:
    Jan 29, 2015
    Posts:
    23
    I have the solution after several days, implement this https://github.com/fadden/android-audio-bypass .. And remember, you only can test your sounds/music in real device.
    With this plugin all sounds play normally and without delay.

    PS: I'll still using Unity 5.1.3.. Because 5.2 have several bugs with sounds (at least in my case with my Galaxy S3)
     
    Last edited: Oct 7, 2015
  4. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    189
    Same problem here: Galaxy S3 audio is playing about half speed, both music and sfx.. Unity 5.2
     
  5. Dr. Argento

    Dr. Argento

    Joined:
    Jan 29, 2015
    Posts:
    23
    Yes, i tried the 5.2.1P4 version and the problem persists. I would love to know if they know of this problem.. is very annoying.
     
  6. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Same problem, all audio plays half speed on a Galaxy S3 I-9300.
     
  7. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    189
    Just submitted a bug report (736575)
     
  8. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    If you check the release notes for Unity 5.2, you will notice
    • Android: Audio - Enable OpenSL fast path for devices that support FEATURE_AUDIO_LOW_LATENCY
    Something must be wrong with fast path on Galaxy S3. Looks like a sampling frequency mismatch. I'll a take a look,
    but please can someone provide a full bug report: with the repro project attached (the sounds and the settings may matter), device model and build name (found in Settings > About). Thanks!
     
  9. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    736526
    Really simple project that plays a single streamed sound loop. Tested on Galaxy S3 I-9300 using Slimkat 4.4 ROM.
     
  10. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Thanks @iivo_k, I'll check it.

    Please be advised that we support only official firmware, so it will be checked with stock SGS3.
     
  11. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    We just tried Galaxy S3 I9300 with Android 4.3 and T-999 with Android 4.3 - no issues.
    The device reports that it does not support audio fast path.

    So I'm once again asking for the device model and Android version/fingerprint that reproduces the sound issues. :)

    My guess is that custom ROMs you are using are reporting that the device supports audio fast path (when actually it does not), Unity selects OpenSL output, and it ends up with sound glitches.

    Once again just to be clear - we support only stock ROMs, not the custom ones.
     
  12. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Could be it's because of the custom ROM. I hope the others with the same problem can tell what they're using. Although, it'd be nice if there was some fix/workaround to this.

    I replied to my bug report with the fingerprint anyway.
     
  13. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    QA closed my bug report due to custom ROMs not being supported, so if anyone has this happen on stock, let it be known.
     
  14. daudau505

    daudau505

    Joined:
    Jul 19, 2014
    Posts:
    27
    Could you test out android 5.0+ , that is the issue for me, still not working.
     
  15. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    You need to post the device info if you want them to be able to do anything.
     
  16. daudau505

    daudau505

    Joined:
    Jul 19, 2014
    Posts:
    27
    Oh, sorry, Would be nice if they can test a Tmobile Samsung Note 5 sm-n920T.
     
  17. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Thanks @iivo_k and @daudau505. I'll check on Galaxy S6 which is at hand and has similar hardware, if it works - will try to get a Note 5 to check.
     
  18. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    189
    Sorry, didn't receive any notifications about those replies.

    You're right, my S3s were both using Cyanogen Mod (v4.4 and v5); lack of "custom ROM support" sounds weird to me though, especially considering that Cyanogen is now extremely popular and it's often used as default stock ROM by some manufacturers (my OnePlus one, for example, was shipped with it).
     
  19. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    I agree. I understand they can't officially support every ROM, but custom ROMs are a big part of Android and not that uncommon. A fix or workaround would be quite welcome. For example:
    - Unity detecting if the fast path doesn't work properly and thus disabling it
    - A way to disable the audio fast path from code (so it could be disabled for specific devices / ROMs or even by a user setting in case they have problems)
     
    Menion-Leah likes this.
  20. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    We will probably allow Audio Fast Path to be explicitly disabled via Player Settings (Not from code - changing audio backend at runtime means reloading all sounds).
     
  21. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Do you mean reloading in memory? Like, would restarting the app and disabling the fast path from code before any sounds are loaded work?
     
  22. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Changing audio backend at runtime will reset FMOD, and it will take significant time to reinitialize everything, and reload the audio clips from disk. This is not a good option, so if we add the option to disable fast path - it will exist in the player settings, and will be applied before audio engine is initialized.
     
  23. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Wouldn't doing it from player settings affect every device though, even if they properly support the fast path? The optimal fix here would be just some way to disable it in case of problems, even if a restart is required afterwards. Could some value be read and applied before the FMOD initialization?
     
  24. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Yes it will affect every device.
    Anyway, we enable fast path only for the devices that report FEATURE_AUDIO_LOW_LATENCY, which is supposed to guarantee support for fast path (according to Google).
    The idea is to let the user disable fast path completely, not on a per-device basis.

    The way to detect "problems" is not very easy and will at least require access to microphone - I can imagine what will happen if we add a new permission :)

    @iivo_k, what would you expect from this feature? Just describe the scenario/usecase :)
     
  25. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Just checked on a Galaxy S6 - everything works fine. Looking for a Note5...
     
  26. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    If FMOD is loaded before any custom code can be run and the reinitialization is slow, then I see how this wouldn't work. But if it would be possible to set some initialization parameter from a startup script, that would be enough.

    I was thinking that if users experience problems with the slowed down audio, they could go to my app's settings and enable a checkbox and I save the flag value somewhere. When the app is restarted, the flag is checked and the audio fast path disabled before audio initialization, if possible. If this is mostly/only a custom ROM problem, you can probably leave it to the user to do that stuff.

    Also, if the disabling could be done from code during initialization, it would be possible to just check for certain devices or ROM versions and disable the fast path based on that.
     
  27. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    FMOD is initialized earlier than any scripts are run.
    On the flag and applying after restart - that were my thoughts as well. We'll consider that, but no promises :)
     
  28. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    194
    problem with sounds on M351 (Meizu MX3) - terrible crunch..(( demo was building on unity 5.2.2p1
    I tryed the UnityNativeAudioPluginSDK.zip - have a same bug
     
    Last edited: Nov 3, 2015
  29. noethis

    noethis

    Joined:
    Nov 11, 2013
    Posts:
    129
    Yeah, my users are reporting audio issues including static/skipping/crunch/buzzy/choppy sound. The following devices have had issues:

    -mx3
    -Galaxy Tab2 10.1 - with Cyanogen Mod
    -nexus 9
    -hltexx - Samsung Note3 w/ Cyanogen Mod
    -hlte - Samsung Note3 w/ Cyanogen Mod

    I'm also on 5.2.2p1. Not sure what I can do since I don't have any of these devices on hand.
     
    Last edited: Nov 5, 2015
    Yury-Habets, larku and yuliyF like this.
  30. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @noethis thanks for the update.

    I've already commented on custom ROMs. (I own a Galaxy Tab2 10.1 and I'm pretty sure it DOES NOT support fast path, so this is a bug in the ROM for reporting it as supported).

    Nexus 9 is very interesting. Can you please report the Android version and build code? Mine works fine.
    Same for MX3 would be appreciated.
     
  31. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    194
    M351
    Flyme OS 3.5.3(I19245)
     
  32. noethis

    noethis

    Joined:
    Nov 11, 2013
    Posts:
    129
    Waiting on more info from my customers, but I do know this about the Nexus 9: flounder / Android 6.0.

    So is there nothing to be done on the Unity side to support users with custom ROMs? Possibly a build/player setting to force disable fast path, or would that be a bad idea?

    Also, not sure if this is related but I'm also getting reports from users who only start to experience these audio stutter issues when they plugin their bluetooth headphones. Occurring on a Nexus 5 and a Nexus 6, both on Android 6.0 stock.
     
  33. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @noethis: I have just tried Nexus 9 (google/volantis/flounder:6.0/MRA58N/2289998:user/release-keys) - runs perfectly fine.
    If you still experience any issues with N9 - please file a bug report with your project and device details. I'm really interested in it working.

    On the bluetooth output devices - I've heard this issue before, will take a look shortly. Can you please also submit another bug report for it? QAs will then be able to reproduce/verify when it is fixed.

    Thanks!
     
  34. Dr. Argento

    Dr. Argento

    Joined:
    Jan 29, 2015
    Posts:
    23
    I understand UNITY can't officially support every ROM, (like custom ROM) but not all ppl use official builds (like me, cyanogenmod 12), and this "bug" is so annoying, I don't like posting a game with this error sound.
     
  35. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    @Dr. Argento

    We could start a blacklist on custom ROMs that lie about FEATURE_AUDIO_LOW_LATENCY unfortunately that may turn into a never ending story :-( Still if this hits all versions of Cyanogen it may be a good idea to do that. One thing you really should do as a Cyanogen user is to report the error to the cyanogen community so they can fix the issue in the next ROM update. It might even be they can enable the fastpath properly, who knows ;-)
     
  36. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Yeah thinking it over - should not really be a hardware issue, rather a combination of drivers + native libs + OS-side implementation.
     
  37. Yuqiyi

    Yuqiyi

    Joined:
    Aug 29, 2015
    Posts:
    6
    Still in 5.2.2P4.
     
  38. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    May I ask, what is "still in 5.2.2p4"?
    We are not going to fix issues with custom ROMs in foreseeable future.
    I have no confirmed issues with Nexus 9 at the moment.
     
  39. BartNT

    BartNT

    Joined:
    Sep 12, 2013
    Posts:
    15
    Guys, why you are so ignorant? This is a serious issue for all mobile developers.

    This is huge market for us. Can't you simple add disabling this new "feature" (Android: Audio - Enable OpenSL fast path for devices that support FEATURE_AUDIO_LOW_LATENCY) option in Player Settings? We didn't have these problems before 5.2 release. Many of us would prefer wider compatibility than low latency audio. :/

    Could you add it, please?
     
    Last edited: Nov 20, 2015
    Yuqiyi likes this.
  40. Yuqiyi

    Yuqiyi

    Joined:
    Aug 29, 2015
    Posts:
    6
    This Problem is Still in 5.3.0F1.My device not have this problem before Unity5.2.
    I think that's not the ROM's wrong.
     
  41. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    @Yuqiyi please file a bug report and attach a repro project. Right now the only issues we know of are on ROMs that lie about low latency support and the previously mentioned bluetooth issue.
     
  42. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    @BartNT calling us ignorant is not going to do you any favors. And I don't think a player setting is they way to go.

    The truth is that custom ROMs are breaking the rules all the time so it's very hard to trust a device running a custom ROM. This does not only apply to Audio but also other things. We recently had a case here all textures were black because the ROM / driver was faking a texture upload :-(

    I think maybe it would be better to just tag custom ROMs as non-trustworthy and pick the safe path when doing feature detection.
     
  43. BartNT

    BartNT

    Joined:
    Sep 12, 2013
    Posts:
    15
    @bitter Systems have bugs. drivers have bugs, middlewares have bugs, hardware has bugs - this is what in game development we have to deal with.

    Maybe there is additional way to detect whether feature FEATURE_AUDIO_LOW_LATENCY is truly available or not. Calling some audio methods and check for some wrong returns?
     
  44. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    We bought that device and checked the audio - it works fine. If you still have any issues - can you please report a bug and include full info about your device - the model and build fingerprint. Thanks!
     
  45. Yuqiyi

    Yuqiyi

    Joined:
    Aug 29, 2015
    Posts:
    6
    Why you ignored the Chinese's Mobile Device? Like @yuliyF says, the Meizu M351 has the same problem.And other device I know is Xiaomi Redmi 2A.
    Since I reply a bug in this forum, about most Meizu MX4Pro is black screen in Unity5.Even that's resolved in 5.2.2p4.None of yours reply one message.
    Is the Chinese's Wrong?
     
    BartNT likes this.
  46. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    194
    In 5.1 all worked perfect. Just return it, why are we suffer so long?
     
    BartNT likes this.
  47. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,594
    Has anyone reported this at the cyanogen developers?
     
  48. MigrantP

    MigrantP

    Joined:
    Jun 24, 2013
    Posts:
    118
    We have a report that sounds similar to this from a user on a Kindle Fire HDX 8.9" (2013). He reports that the music in our game is playing back at slow speed, but sound effects are fine. This version of the game was built on Unity 5.2.1p3. The device is running stock FireOS (not rooted) with Google Play components added.

    Our music files are set as Streaming, Vorbis and the sound effect files are set as Compressed in Memory, ADPCM.

    Device info:
    Device Model: Amazon KFAPWI
    OS: Android OS 4.4.3 / API-19 (KTU84M/14.4.5.5_user_455001820)
     
    Yury-Habets likes this.
  49. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    A coworker had slowed down music a few weeks ago on a stock OnePlus One, but that was fixed with a restart.

    Anyway, this problem seems to be pretty widespread and custom ROMs are very common. All in all, even if this is strictly a problem in the ROMs, I'd expect a fix from Unity.
     
    BartNT likes this.
  50. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @MigrantP - thanks for your report, we'll check it.
     
    MigrantP likes this.