Search Unity

Question Noise or something similar to crackling on android devices

Discussion in 'Audio & Video' started by user404X, Dec 20, 2021.

  1. user404X

    user404X

    Joined:
    Nov 28, 2019
    Posts:
    3
    Hello everyone,
    I have a super annoying problem. My project's android builds have noise on the smartphones. This noise is always present, no matter if the volume of the smartphone is set to 100% or if it is completely turned off. Its loudness also does not depend on the volume of the smartphone, but if the game plays any sound, the noise increases its volume instead of the sound. This only affects smartphones (tested on 4 devices), there is no noise on emulators like LDPlayer or BlueStacks. I tried all the settings in "Audio" (Edit > Project Settings), the noise disappears only when "Disable Unity Audio" is enabled, which is logical. I tried different audio file formats, different types of compression, but this is not the problem, because there is noise even when there is not a single sound in the project. Engine versions: 2020.2.1f1 / 2020.3.23f1 LTS

    I can't find any solution for a couple of months now, it's very annoying. What is it? How to fix it?
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
  3. user404X

    user404X

    Joined:
    Nov 28, 2019
    Posts:
    3
    I have read these branches and tried to change dspBufferSize with the script and through the audio settings - this does not work
     
  4. user404X

    user404X

    Joined:
    Nov 28, 2019
    Posts:
    3
    Okay. I read the existing threads on the forum and the unity bug tracker, it says about changing dspBufferSize, but in my case it did not solve the problem. It turned out that on the android devices that I tested the noise from the speakers disappear when you plug in a headphones. I decided to check the games of other developers and downloaded a random game from the market made in unity, but the game was not of the best quality, if you know what I mean, there is also the same problem. I remembered "Monument Valley" game which was released in 2014 and it has exactly the same problem, noise from the speakers. On the iPhone everything is fine. Only on android. How so? A problem that has existed for more than 7 years. What is wrong with android builds? What's wrong with unity? What is the cause of this noise? I want to see an answer from unity's technical specialist on how to fix it, but if it's a bug, how soon will it be fixed?
     
  5. stphonclark45

    stphonclark45

    Joined:
    Jan 10, 2022
    Posts:
    1
    Likewise, I am experiencing the same problem and do not know how to fix it.
     
    Last edited: Jan 29, 2022
  6. Rogerjohn45

    Rogerjohn45

    Joined:
    Apr 17, 2022
    Posts:
    1
    The option "Disable Unity Audio" is selected, which is logical. I tried different audio file formats, different kinds of compression, but this is not the problem, because there is noise even when there is no sound in the project. I have read the branches and tried to change DSp Buffer Size using the script and through the audio settings - but it does not work.
     
    Last edited: Jun 1, 2022
  7. officialkoreanjesus

    officialkoreanjesus

    Joined:
    Apr 19, 2022
    Posts:
    3
    My guess would be a sample rate mismatch.
     
  8. abile01

    abile01

    Joined:
    May 27, 2023
    Posts:
    1
    Likewise, I am experiencing the same problem and do not know how to fix it.
     
  9. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    410
    Are you using multiple layers of effects in the audio mixer?
    I've seen many cases of audio crackling that were only due to intense audio processing. It might not be that you have too many effects, some native audio plugins can sometime have an exponential cost bound to a single parameter.
     
  10. jschoener

    jschoener

    Joined:
    Sep 20, 2019
    Posts:
    9
    I have the same issue at least for some clips. I also tried changing AudioConfiguraiton.dspBufferSize and sampleRate, but without success. I'm not using any audio mixer groups and it even happens when there's only one single AudioSource in the scene. Apparently the noise and crackling only affect some clips and others play out well, but I couldn't figure out a pattern so far. Still it works once you use headphones, tested it on several devices. Any more ideas on this topic?
     
  11. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    410
    I'd be curious to know what is the format of the files working and the format of those that don't (mp3? ogg? sampling rate? compression setting? etc...)

    Generally plugging headphones would trigger an audio engine reset (sorry) so maybe there is something wrong with AudioSettings initially. Are you tweaking these settings at runtime?
     
  12. jschoener

    jschoener

    Joined:
    Sep 20, 2019
    Posts:
    9
    Thanks for your answer!

    On of the clips not working is a mp3 file, but I already tried converting it to a wav and ogg but the result was the same for both. The sampling rate of the file is 48000 Hz, I added a screenshot of the import settings. There is no Android override. I already tried several settings here but without any success, but frankly at this point it don't really know what I'm doing so it was mainly trail and error.

    Here's a link to the original mp3 file.When looping the file in an Android build you will hear a background noise and a crackling noise at the end of each loop. This is what it's supposed to sound like when it's looped. And this is what it sounds like on Android. You can cleary hear the noise and the cracking. Note that both files were recorded during the same session with the noisy record having used the devices microphone (so what you actually here) and the other one having used the phone's internal sound output of the app for recording.

    settings.PNG

    Here are the audio settings. I used to change them on runtime for debugging purposes but not in the current builds. The AudioConfigurations sampleRate is 48000 and the dspBufferSize is 1024, changing them on runtime did not fix the issue so far. Btw for this project the Unity Version is 2021.3.11f1.

    audio settings.PNG
     
    Last edited: Oct 25, 2023
  13. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    388
  14. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    410
    @jschoener
    Just to be clear, is the "broken" sound is the result of looping the original sound or is it another sound and the weird part is just the noise/crackling?

    Also to clarify: how did you gather the broken sound? Is it playing this way in the editor when you switched to the Android platform in Project Settings or is this directly from an Android device? Also bonus, what is the device and Android version you're using?

    I see nothing wrong with your settings, but it could be interesting to check if this still happens with different compression/loading/normalization strategies.
     
  15. jschoener

    jschoener

    Joined:
    Sep 20, 2019
    Posts:
    9
    @SeventhString
    It's all the same sound and what you hear is it being looped.

    It was played directly from the Android device. It's a Samsung Galaxy M30 using Android 11, but I also tested it on another Samsung device.

    Anyway, turns out that apparently the problem is the phone and not Unity, since opening the link I posted before to play the sound on the device results in the same noise and cracking. Still weird, but I guess exchanging the affected sound files it is then :/
     
  16. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    388
    In my case, the sound is not looped, and the problem only appears on device. It also depends on the device type. It's worst on my brand-new Google Pixel 8 Pro. After changing the audio buffer size to 64, the sounds play fine. But that's a pretty weird workaround, if you ask me.

    Also, the sound is not really "crackling" in my case, it's completely distorted, with some of the audio being delayed weirdly. Unbareable user experience.
     
  17. jschoener

    jschoener

    Joined:
    Sep 20, 2019
    Posts:
    9
    Just in case anyone knows more about sounds on Android and is motivated to find out more about this problem: besides this file I linked above, theses files from freesound.org are also not working properly:

    Heavy Stone Push
    Blip (SFX)

    To me it looks like maybe this problem only occurs for bass heavy sounds since they all are.
     
  18. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    388
    Nope, my soudns are not bass heavy, and they sound completely distorted.