Bizarre audio problem

0 favourites
From the Asset Store
100+ Musical High Quality Sound Effects for your game!
  • Hello there, (I am updating this thread as I find out more info)

    Got a very serious and bizarre audio problem on a released iOS app that has several symptoms (while only running on device):

      1) Can only be described as all sounds in the "Sounds" folder (SFX) becoming downpitched and low Q/bitcrushed. 2) Device will sometimes emit a loud BZZT or POP (no such sound exists in game) and after this, audio as a whole usually doesn't work, SOMETIMES EVEN IF you close the app and restart it. To get audio to work again you need to load another app to get some sound to play and then open ours again which forces it to work. It's as if something is temporarily BREAKING on the device. 3) Audio can just not work. EDIT: 4) Forgot to mention that if you press the home button to come out of the game (but game is still running in background), when you re-enter the game EVERY SFX that has been played so far inside that layout will play at the same time. Can be repeated.

    All of these problems generally happen quite randomly (and less than 50% of the time in our tests) with a slightly higher chance happening when a new layout is loaded or a new audio track plays, or after an Admob advert has been watched. Restarting the app can sometimes even cause or fix these problems!

    Only tested this on iOS so far but it does happen across different iOS devices (iPhone, iPad). The fact we had a few players tell us is pretty worrying.

    Some maybe relevant technical details (since I cannot provide CAPX):

      - 6 music tracks, on average 45s long for each.
      • 18 SFX files.
      • The most demanding layout will play all of these bar one music track.
      • Even so, the problems can still occur in the menu layout which is much less performance heavy.
      • EDIT: Minifying script changes nothing.

    We haven't got the slightest clue what's causing it, hence why I posted in General. So far we've suspected:

      - Bad audio code (done a complete overhaul, read below)
      • Bad audio performance (maybe something to do with bandwith or overloading the audio thing on the device, hence bitcrushing esque noise)
      • Construct bug
      • We updated Construct (EDIT: tests have now shown this is unlikely a cause)

    Something to do with the HTML5 limitation that requires a tap to trigger audio. Can sometimes emit the BZZT or POP on the first touch.

    I will now elaborate on a few of these below to try to give you as much info as pos. Brace for wall of text:

    We're leaning away from it being a problem in our code as we've since re-coded the whole audio system in the game to be more efficient, and the problem still exists. But just in case someone spots anything weird, here's the old audio system we had:

    The audio system always had to be a bit dodgy in the first place. We export as Cordova out of Construct and we use Intel XDK to wrap it as an app. Now, with this workflow, I've read Crosswalk cannot fire a "Set Silent" or similar event and I do remember we had problems with this way back in early dev. So we had to find ways around that to mute music and SFX independently.

    Our game is essentially an endless reaction game, and as you score higher you go through "zones" within the same game layout that each have a different audio track. Each audio track was composed to the second according to how long it would take to transition to the next zone. So when you hit a new zone, track 1 is already tailing off and track 2 begins. Due to latency issues/HTML5 only playing things when the screen has been touched, we had to set all music tracks to play on start of layout and then immediately pause all of them if they hadn't been set to muted (in that case, they were just stopped), meaning when we needed to play a certain one, we would tell which one to resume and it would play instantly as the screen had been touched way earlier in the game. This led us to think all this paused audio was sort of hogging resources. Oh and I forgot to mention, for all the SFX, when muted we would add a mute effect to every single one. Doesn't seem too efficient, adding a mute EFFECT? Which is why we did the following:

    All SFX now are inside a function in its own event sheet that gets included where needed in the project. No SFX ever has a mute effect any more, the function behaves in a way that just listens for when a SFX is needed, picks the appropriate SFX, and only plays it IF muting is OFF. A lot more efficient right? I have no idea why we didn't do that in the first place.

    As for the music, it now works as a sort of relay system, so that 2 tracks are only ever loaded at once instead of 5. So at the start of the layout track 1 and 2 are set to play but then 2 gets immediately paused. When 1 finishes, 2 resumes, 3 is set to play and then paused. And so on. So is it safe to say the sound in the game and the way it's coded is not the problem? We (maybe) think so! An update to the game that incorporates this new system will be pushed tomorrow (not that it fixes the problem...).

    Finally, we built the majority of the game in Construct version 200 and since about a month ago we've updated and are using the latest versions. We cannot help but wonder... is it related? We don't think we had these problems before then... Did any updates since 200 address or cause any audio issues?

    Anyway we haven't had the time to replicate the problem yet (nor do we even know how...).

    Apologies for lack of details, but given the nature of the problem... what can I do? I do apologize for not uploading a CAPX but we obviously don't want to give people our game. You can find the game on the App Store (search for Fallen). We would greatly appreciate if anyone could try and reproduce the bug and post their thoughts. Try opening/closing the app and muting/un-muting to try and get it to trigger. You'll know it when it happens! It will be updated to version 1.0.1 probably within the week. That version will have the new audio code as described above.

    Long post... but looking forward to see if anyone has any ideas!

    EDIT: We've opened an old build built with version 200 and and exported with the new and old sound code and the problems STILL OCCUR.

  • New post for a revelation on the problem:

    It's very likely the Intel XDK could be doing it. Made a blank app with some heavy audio usage in it and have experienced the 3rd and 4th points at the top of my previous post.

  • I also get the audio corruption infrequently on my ipad4, since I'm currently using intelxdk preview I assumed it was an issue downloading/streaming the audio. Very worrying if its happening on live apps too.

    I consistently get the play every audio in the level on app resume also (annoying)

    Bugs for Intel XDK maybe.

  • I'm having no joy with the audio corruption, but something Ignaci mentioned in another thread (thanks!) gave me the idea of setting the audio to silent on browser suspend and back on with resume and a 2 second wait and this stopped all the horrible playback of all sfx effects at once bug.

    You have to put in a long enough wait for the duration of your longest sample, for me 2 seconds was enough.

    It's not great but better than the alternative!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm having no joy with the audio corruption, but something Ignaci mentioned in another thread (thanks!) gave me the idea of setting the audio to silent on browser suspend and back on with resume and a 2 second wait and this stopped all the horrible playback of all sfx effects at once bug.

    You have to put in a long enough wait for the duration of your longest sample, for me 2 seconds was enough.

    It's not great but better than the alternative!

    I am very glad that this helped You!

  • I'm also having a very similar problem. Sometimes when I open the app the audio is very distorted, like a bit-crusher type sound. Even closing the app from the app switcher and re-opening it doesn't help. The only way to fix it is by resetting my iPhone. I'm currently using XDK, I'm going to try switching over to phonegap and see if it makes any difference.

  • I think that this problem might be caused by some kind of sample rate error. It sounds to me like the kind of bit crushing / aliasing sounds that you would get when connecting an 48kHz output into a 44.1kHz input. I was wondering if it could be anything to do with a 48kHz sample rate being set after watching a video on the phone? Or maybe even taking a phone call sets the device to a different sample-rate?

    Is there any way to reset the audio engine, perhaps using javascript? I've been doing a bit of research on it but it's all a bit too complicated for me. If there was a way to do this then maybe it could help the problem of having no sound after re-opening the app too.

  • Every time I've had this issue it has been switching from an audio heavy app to my game so you might be on the right lines. Though frustratingly I'm not able to reproduce it on demand.

    I'd be interested to know your experiences with other export methods.

  • Hi, just letting you know I've switched over to Cordova CLI now (which is great and easier than I was expecting), but still getting the same problem with audio. Sometimes no audio at all on re-opening the app, and sometimes really bad bit-crusher type distortion. Only way to fix it is with a restart, or to open another app which plays audio and then switch back to my app (this only works some of the time, maybe related to the sample rate again?). I've now tried frameless browser, phonegap build, intel xdk and cordova cli, and it happens in all of them, next one to check is cocoon, I'll let you know how it goes...

  • I've just had the audio corruption presented exactly the same as before using C2 preview so it is not an export bug.

    I could repeat it with every preview at the time, closing all the apps in the background fixed the issue, this included rayman run - an obviously audio heavy game.

  • I'm experiencing this exact same problem with my release iOS game: a very rare thing but disconcerting nonetheless.

    Audio becomes 'bitcrushed' and pitch shifted, even restating the app doesn't help. Seems to happen regardless of the iPhone model. Possibly to-do with unlocking the hardware mute button after the game has launched.

  • I'm experiencing the same problem on my iOS game (music is sometimes fine, other times the music is horribly distorted or absent entirely). Has anyone been able to find a solution?? The issue seems to happen regardless of whether the phone was on mute prior to the app being launched.

  • Same problem here as well on iOS..

    Does anyone know a solution? Ashley ?

  • I'm not sure it explains the original post in this thread, but there are reports of a bug in iOS 9.2 that breaks audio playback. I investigated it and concluded that the nature of the problem combined with the fact that it's a bug in iOS itself means there's not much we can do other than wait for Apple to fix it.

  • Ashley

    It’s not only a iOS 9.2 bug. This bug is also in iOS 8 as well as it is on iOS 9.

    This sound bug is a big problem if you are an iOS developer.

    Please, take a look at this video. My English is bad, so you understand better what I mean by watching the video:

    (Tested on iPhone 5, iOS 8.4.1, Intel XDK.

    Same bug on iPhone 6/iOS9 / or iPad)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)