Search Unity

Bug Sound Repeating/Echoing Problem - Safari Big Sur Only

Discussion in 'Web' started by John-B, Jun 6, 2021.

  1. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I recently updated about 40 apps from 2018 to Unity 2020.3.9f1, and 10 of them now have a problem with their sound, at least for one user in Safari 14.1.1 on macOS 11.4.

    For this user, every time a sound is played, it repeats several times at a lower volume each time, like an echo. The sounds fade out after repeating about half a dozen times. Some of these sounds play on user interactions (e.g., clicking a button), and others play when triggered by collisions (OnCollisionEnter). These apps only have a few sounds that play only occasionally, but it looks like all sounds in the affected apps have the same problem. (I have an audio recording, but it doesn't look like I can attach it.) Though the repeating sounds only start after a few sounds have played, the first few times the sounds do not repeat. Other similar apps that I updated at the same time play sounds normally.

    I cannot reproduce this in the Editor, and the apps work correctly for me in Safari 14.1 on macOS 10.14.6. The user reporting this problem does not see it in Chrome and says they won't run at all in Firefox 89 on the same Mac, just in Safari. Other users report no problems in various Windows browsers.

    Anybody else run into this? Any ideas what might be the cause? I can find nothing in the code, the audio files, or the AudioSources out of the ordinary.

    FYI, this is NOT the WebGL/Safari sound bug present in 2018 and earlier. That bug prevented sounds from playing, this is the exact opposite.
     
    Last edited: Jun 7, 2021
  2. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Here is the JS console for one of the WebGL apps with the repeating sound problem. I don't see anything that looks relevant, no different than the apps where the sound works correctly. Am I missing something?

    Console.jpg
     
  3. Deleted User

    Deleted User

    Guest

    I have a very similar problem on Safari 14.1.1/macOS 10.15.7 on a 2020 iMac. Audio starts out fine but after a minute or so becomes garbled and starts echoing. Also reproducible on iOS 14.6. Works fine on Chrome.
    It could be a browser issue, as the echoes continue and slowly die down after muting the browser.
     
  4. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I've discovered that this only happens in projects that I converted from UnityScript to C#. Other similar projects updated at the same time that were originally written in C# do not have this problem after updating to 2020. Though I have no idea why that would be the source of the problem. There's nothing off in the converted code that I can find.

    Have you found a fix or workaround? Or something in the code that's causing it? I can't make these updates live if even a small number of users have a serious problem.
     
  5. peanutoik

    peanutoik

    Joined:
    Feb 22, 2021
    Posts:
    1
    I'm in trouble that I have to force the app to shut down for sound echo problems.
    When an echo begins to occur in a sound, it begins to overlap with dozens.
    It uses apps that play sound frequently in one scene, and audio sources are frequently called to Play(). (over 300 times)
    The project confirmed that there was no problem with the previous version of IOS14.6 and confirmed that the problem occurred immediately after updating IOS14.6 with the same project without any changes.
     
  6. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I've learned a bit more about this problem, when it happens and doesn't happen.

    PROBLEM:
    • MacBook Air, 13-inch, 2020, macOS 11.4, Safari
    • iMac 2020, Safari 14.1.1/macOS 10.15.7 (u7ku in this thread)

    NO PROBLEM:
    • MacBook Air, 13-inch, 2020, macOS 11.4, Firefox, Chrome
    • MacBook Air, 13-inch, early 2015, macOS 11.4, Safari, Firefox
    • iMac, Retina 5K, late 2015, macOS 10.14, Safari, Firefox, Unity Editor
    • All Windows browsers tested
    • All projects NOT converted from UnityScript

    We only have a few people testing the updates. This was supposed to be the kind of update users should not even notice happened.

    In one of the affected apps, I output to the console when a sound is played. On the problem machine, in the problem browser, all sounds played the proper number of times. That is, when a sound was repeating, the console output showed that it was played only once. That suggests to me that it's not a stuck coroutine or timing issues.

    I don't know where to go from here. I don't really see how the US-C# conversion could be the cause, but it's only those apps that have the problem. And if it's a Safari problem, I don't know what I could do about it. Sooner or later though, the updates must be completed and made available to our users.
     
  7. Deleted User

    Deleted User

    Guest

    My project wasn't converted from UnityScript. I haven't found out much more about this but I'm pretty convinced it's a macOS/Safari bug because when it happens, it also affects sound from other apps and even system sounds.
     
  8. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    589
    Try to compare the ProjectSettings asset of the working projects and the bug projects.
    Also try to compare the audio assets files settings of those projects.
     
  9. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I've checked and compared every setting I could think of that might be relevant, project settings, import, audio format. An incorrect setting could be responsible, things get changed during updating all the time, but I can't figure out what it might be. Is there any other project setting that could conceivably have an affect on audio?

    These projects are part of a set, they're all very similar. They share many of the same assets (sounds, textures, code). The newer projects (no sound bug, written in C#) use the same audio assets used in the older, problem projects.
     
  10. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    Are you able to provide a repo case for a bug report? It's hard to identify what the problem might be from this and I have not seen this problem myself. The conversion from UnityScript seems suspect, but without something to test and verify, we won't be able to say for sure what the problem or fix is.
     
  11. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I can provide a project that has the problem (several). It's not something that can be reproduced in a new project, which is part of the problem. Should I submit this as a bug report?
     
  12. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    Yes please, that way we can take a look at it and figure out why it's repeating.
     
  13. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Case 1348348.
     
    brendanduncan_u3d likes this.
  14. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    Got it, thanks. I'll take a look.
     
  15. YarrySP

    YarrySP

    Joined:
    Sep 20, 2012
    Posts:
    10
    We've encountered the same issue.

    First we thought it was a WebGL1 issue, since Safari defaults to WebGL1, but testing a webgl1 build in any other environment proved the problem relates specifically the Mac Big Sur OS, and not the webgl version or browser version.
     
  16. YarrySP

    YarrySP

    Joined:
    Sep 20, 2012
    Posts:
    10
    Hi Brendan, I took the liberty of reporting the bug with a minimal reproducible case (Case 1350204). I also attacked a video demonstrating the issue and a built webgl player for testing. For us, it's enough to create a new project and add a single looping soundfile to an empty scene. After ~10min runtime in Safari 14 (MacOS Big Sur) the sound is completely glitchy - it gradually gets worse from about ~5min.
     
    brendanduncan_u3d likes this.
  17. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    FWIW, my sounds do not loop. At least they're not supposed to.
     
    brendanduncan_u3d likes this.
  18. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Where can I check on the status of my bug report? The Issue Tracker link in the Bug Reporter shows a different bug report with my number, and I can't find anything on this site.
     
  19. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    437
    We have an internal bug database that links to the external one, I'm not sure what the external issue link is, but we have yours in our list. I'm having others on the team work on reproducing the issue since I was unable to so far. It's clear some Macs are having the issue, and very frustrating that not all of them are.
     
  20. YarrySP

    YarrySP

    Joined:
    Sep 20, 2012
    Posts:
    10
    Neither do ours, this was just the easiest way to reproduce the issue. A single looping audio file.
     
    brendanduncan_u3d likes this.
  21. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    So there's no way to check on the status? I've got several app updates ready and waiting, but I've been holding off. I'm a little hesitant to have to tell some of our Mac users that our updated apps no longer work in Safari. I also have more updates to do that I quit working on when I discovered the bug.

    Do you have any more info at all? Like how widespread the problem is? Does it only affect newer Macs? What about M1 Macs (we don't have any to test)? Do you think it would be a bad idea to release the updates as is?
     
  22. Deleted User

    Deleted User

    Guest

    Have you seen this thread? I haven't tried the workaround mentioned there but it might help. Otherwise I wouldn't hold my breath for a fix as it seems to be on Apple; I'd just release the updates with a note that if Safari users experience audio issues, they should try using Chrome for now.
     
    soyesdeveloper likes this.
  23. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Except that it affects only SOME of my apps. So it's possible to do a WebGL build that doesn't show the problem. That suggests to me that there is a fix/workaround, I just haven't figured it out.
     
  24. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    273
    The good news I have for you is that we have an engineer actively looking at this bug, the bad news is that it's a tricky bug and we've had trouble reliably reproducing it. We had someone reproduce it after leaving the browser page open for almost an hour, and others haven't been able to reproduce it at all. We're hoping to have more answers this week.
     
    John-B likes this.
  25. ShadowHealth

    ShadowHealth

    Joined:
    Apr 2, 2015
    Posts:
    6
    We're having the same issue with 2020 LTS in Safari 14.x.1 on Catalina 10.15.x -- not Big Sur only!
    All of our audio is speech (one shot, not repeating). By the 3rd or 4th character speech it kicks into extreme reverb and static. Nothing else notable from logs at the time.
     
  26. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    273
    Does this issue happen reliably in your project? if it does, can I convince you to open a bug report with the project attached? and if you DM me or share here the bug report number, I'll make sure to follow up on it and use it in our investigation.
     
  27. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Our user who reported the problem can reproduce it 100% of the time in our affected apps, typically after sounds play only a few times (i.e., right away), and has never been able to make it happen in our other apps, 0%. With the right configuration, it's completely reproducible, at least for us.
     
  28. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I tried it. It did not help.
     
  29. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I don't know if this is related, but the user who's reporting the sound echoing problem just said this about some videos we have on the same site:

    "If I try hard enough, I can get an echo - more like static - on videos. That seems to happen when I stop and start the video partway through and is of short duration."​
     
  30. Deleted User

    Deleted User

    Guest

    I filed bug #1360344 with an example project attached.
     
  31. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    273
    Hello again.

    We've been looking (and looking) into this issue, and have found plenty of Webkit bugs related to audio distortion in Safari that have been fixed in the past year, such as https://bugs.webkit.org/show_bug.cgi?id=215314 and https://bugs.webkit.org/show_bug.cgi?id=222098
    Googling "audio distortion in Big Sur/Catalina" will also show a lot of Mac users reporting problems.

    I've been looking at two bug reports with sample projects (including yours, @u7ku ), and I noticed the distortion immediately on Safari 14 + Big Sur, I tested them on Safari 15 Beta, and the audio issues dramatically improved. For the other test project, the problems disappeared completely.

    So I have a request, can you (@ShadowHealth , @John-B , and @u7ku ) test your projects with Safari 15 Beta (You can download it here: https://developer.apple.com/safari/download/ ) and see if the audio problems are better? But please be aware that reverting back to "regular" Safari will require you to reinstall the OS, because, unfortunately, Apple couples Safari very tightly with the OS.
     
  32. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Unfortunately, I'm on macOS 10.14, so I can't install Safari 15. Though I can't reproduce the problem on my machine, so it wouldn't really tell me anything. The only person who's reported the problem is one of our users, and I can't ask them to do something that would require them reinstalling the OS.
     
  33. Deleted User

    Deleted User

    Guest

    Thanks for investigating. I'm not able to install the Safari beta either but I imagine the final macOS/iOS releases should be fairly close.
     
  34. Deleted User

    Deleted User

    Guest

    Safari 15 is out, unfortunately this audio bug isn't fixed, though it doesn't corrupt all system audio anymore.
     
  35. soyesdeveloper

    soyesdeveloper

    Joined:
    Jul 28, 2021
    Posts:
    2
    In my case of running WebGL on mobile, it worked.
    Thank you.
     
  36. ShadowHealth

    ShadowHealth

    Joined:
    Apr 2, 2015
    Posts:
    6
    @unityruba anecdotally for some testers Safari 15 on macOS 11.x has been an improvement. However for Safari 15 on macOS 10.15 we are seeing an inability to play any audio; error is as follows. Not only in our builds but also seeing this on simmer.io games with audio.

    This doesn't appear to be new; seeing this from Unity 2020.3 & back to 2018.x builds


    image not embedding: https://imgur.com/a/2TdomIU
     
  37. ShadowHealth

    ShadowHealth

    Joined:
    Apr 2, 2015
    Posts:
    6
  38. nolap

    nolap

    Joined:
    Dec 17, 2021
    Posts:
    1
    Hello, I'm developing a web app and noticing an echoing issue in Safari Version 15.1 (15612.2.9.1.30, 15612) under Mac OS 10.15.7. Everything is perfect when I open a popup (magnificPopup.js) to display a video for the very first time and close the popup. But the echoing issue is appearing when I try to play the same video again in the popup. More: that second time, when I close the popup, the sound of the video is continuously played. The only way to stop it is by reloading the whole page.
    It seems to be a pure Safari issue since everything is perfect under Chrome and Firefox.
    I've tried several things for hours : calling the pause() function in callbacks on close or afterClose events, removing the video src value on the fly when the popup is closed, removing the full video tag from the DOM...... but nothing changed.

    Wouldn't it be a caching issue?

    I have just one video tag on my page but everything is like if Safari was caching the first video tag (the one used to play the video for the first time) and not destroying it but calling it again when another video tag (the one used to play the video for the second time) with the same src is created and used to replay the video in the popup... Then, closing the lastly opened popup, will correctly stop the video linked to the second video tag, ending the echoing effect, but not the "ghost" and relaunched first video tag continuing to play in background. Anyway, if my cache hypothesis was true, Safari would be doing as if both videos were different (although if they have the same src and id!) to stop them but as if both were like only one video at launch time...