shortwave's Forum Posts

  • Ashley Just thought I'd let you know that I restored my iPad and the problem is completely fixed. Very strange as it was 9.3.2 before so shouldn't be any different, maybe when iOS update happens there are underlying files which aren't changed? Anyway thanks for the help, I'll change those "is touching" events to "on touched"!

  • Hmmm I'm starting to think it's just me! I've posted a .capx to the bugs section. I think I've followed the guidelines correctly.

    It's just a button that should play a middle c, on my iPad Air it plays at the correct pitch about 10% of the time at the moment....

  • Hi Ashley, it's iOS 9.3.2

  • Hi Ashley thanks for getting back to me. I don't know then, maybe it's just something wrong with my iPad? It does seem to be fine on my iPhone. I'm using an iPad Air 2 and any audio files I attempt to play are coming out almost an octave lower, and using audio.samplerate I can see the project sometimes starts in 22.5kHz (wrong but sound works ok) or 44.1kHz (correct but distorted). I've checked all my audio files are good and tried lots of different formats and sample rates.

    I'm using r227 but I also tried r229 to see if it helped, I've also posted a capx to the bug section. I'll try to get hold of a friends iPad to double check, maybe it's just my one.

  • Currently it seems that iOS 9 has some serious problems with HTML5 audio (and therefore Construct 2). I personally can't release anything I've been working on lately because of the distortion / sample-rate mismatch problems. I understand that it's not specifically a Construct problem. Current issues include:

    • Audio not working after a video has been played on the device.

    • Audiocontext starting in different sample rates randomly

    • Sounds playing an octave lower than intended due to sample rate

    • Sample rate mismatch resulting in horrible distortion of sounds

    • Sound not working after an app is closed / opened

    I know that Ashely said this a few months ago:

    "I am guessing this is just another case of the same iOS bug, and playing the video also causes a sample rate change. Apple have apparently fixed the underlying issue so hopefully it's fixed in the next iOS update.

    I don't want to add any more hacks to try to work around this: the hacks tend to be so ugly they cause as many problems as they solve, which is exactly what's happened with some other recent sound bugs as well."

    Does anyone think it's likely that iOS 10 will make all this stuff better? If so I'll take a few months off developing and continue with Construct, if not I'm going to need to start learning a non HTML5 based engine. I'm sure lots of other people are in the same position.

  • Ashley Haven't you got an iPad Air 2 as one of your test devices? If you get 5 mins spare could you please check if the audio is working correctly on it?

    At the moment any new project I create is unable to play audio correctly on an iPad, all other devices are fine.

  • Problem Description

    Audio playback is distorted or pitch is reproduced incorrectly when running on iPad Air 2.

    Attach a Capx

    h*t*t*p://w*w*w.dropbox.com/s/ia6bebnrrm7eurn/Audio%20Test.capx?dl=0

    Description of Capx

    Button plays a sample which should be middle C (261Hz), two text displays; current sample rate and sample rate at start of layout.

    Steps to Reproduce Bug

    • Run the project on an iPad or compile an iOS app
    • Press button

    Observed Result

    Button plays a sample which should be middle C (261Hz), upon repeatedly refreshing the project, it will usually start with a correct sample rate of 44.1kHz, the sound is played back almost (not exactly) an octave lower than it should be. Either that or very distorted. Sometimes (about 10% of the time) the page will load with a sample rate of 22kHz and the sound will play correctly. The audio file is 44.1kHz and works fine on iPhones.

    The problem persists after app is compiled with Cordova CLI, XDK or Phonegap. I am finding it impossible to make an iPad app because of this.

    Expected Result

    Sound should play correctly.

    Affected Browsers

    • Safari on mobile
    • Phonegap
    • Cordova CLI
    • Intel XDK

    Operating System and Service Pack

    Windows 10

    Construct 2 Version ID

    r227

  • Is anyone else still experiencing problems with this? I seemed fine for a while after Ashley posted the fix, but has now come back even worse than before.

    I'm using r227 and the audio is very distorted 2 out of 3 times I run my app. It is the same testing on browser and publishing with xdk and phonegap. I'm testing using an iPad air 2. I've tried importing audio files at various sample rates.

    I've also made a test app with just one button and one audio file and it still has the same problem.

  • Ashley Yes I do see your point. Usually music based apps ignore the ringer-mute switch, Garageband for example. In fact pretty much every musical app, also apps like Youtube, and anything based on playing videos or music, podcasts etc. It's actually quite a standard behaviour. I suppose the reasoning is that you wouldn't be playing an on-screen piano if you didn't want to make a noise...

    I get an email probably 2-3 times a week from users asking why the sound doesn't work on my app, and I have to reply with the default "turn the mute switch off" email. As this is the normal behaviour for an app, I think users get confused when it acts differently.

  • Is there any way I can make the app still remain un-muted while the iPhone has the mute switch on? Or is this just a limitation of running through a browser?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have been getting exactly the same problem since iOS 8 on my iPhone and both test iPads (3 and Air 2). I'm trying to figure out a reliable way of reproducing it but it is quite random. If I spend a full day working on an app I will probably have to restart my iPad once or twice to fix it.

    Ashley I found a discussion on stack overflow which might be of help. The last post seems to be a fix for the problem, definitely looks like it is related to a sample rate mis-match.

    stackoverflow.com /questions/17892345/ webkit-audio-distorts-on-ios-6-iphone-5-first-time-after-power-cycling /34501159#34501159

    This is also interesting stackoverflow.com /questions/29901577 /distorted-audio-in-ios-7-1- with-webaudio-api

    Had to put spaces in the links because it wouldn't let me post them otherwise.

  • I'm also still having problems with this issue, it is hugely frustrating as the apps I make are music based, and the audio is the main feature.

    I have found that the most reliable way to reproduce the issue is to watch a video on the device before switching back to the app. This is consistent with it being a sample rate issue. Most audio for video / tv tends to be recorded at a 48 / 96kHz sample rate to match the 24 fps of film without aliasing. Music is almost always recorded at 44.1 / 88.2kHz. I am wondering if the switch between sample rates is not happening correctly and the construct app is trying to play a 44.1Khz file at 48kHz or something like that?

    If I am using a mic preamp with a digital output like adat / spdif and not syncing with word clock, I can produce very similar distortion by setting my preamp to 44.1kHz and my audio interface to 48kHz. Ashley perhaps there could be a piece of code in the html audio api that resets the sample rate to 44.1kHz when the app is opened?

    By the way sorry I couldn't reply to your message, I don't have enough points on my account to send private messages..

  • I'm also having exactly the same problem with the sound becoming distorted. Can't seem to find any way to fix it...

  • It sounds great on the browser, but when I export with Cordova nothing happens. All the other audio effects work fine but for some reason the distortion doesn't.

    Does anyone have any experience with audio effects on iOS? I've tried setting it differently to see if it is just interpreting it slightly differently, but no luck so far. Seems strange that all the other effects work ok though.

  • First of all I'll just say I am a huge fan of Construct. I've published games to the app store using most of the well know engines, and Construct is definitely the best one I've tried so far. Really easy to use and also very powerful at the same time.

    I've been working on a very audio heavy musical app, for a few months now (for iOS), and I've experienced lots of very serious problems with the audio that I just can't seem to fix... I realise this probably isn't a problem with Construct, and more likely something to do with the HTML5 audio engine, but at this point I'm willing to try almost anything to get it working! I have tried using XDK, Phonegap Build, Cordova CLI and Cocoon JS to build the app, so at this point there really is no other option, I'm looking into moving the project over to another program, but I really really don't want to.

    First off all, sometimes when I close the app and then reopen it there is no audio at all, this can only be fixed by shutting the app down from the task manager, or sometimes requires a reboot of the iPhone / iPad. I think it's something to do with the app not re-capturing the audio device, as the hardware volume controls will only control the ringer when this happens. I'd imagine that this also happens with all games made for iOS?

    Secondly, sometimes when I open the app, the sound is there, but very distorted, this also requires the same steps to fix.

    The third, and most serious problem for me, is that the audio engine seems to get worse the longer the app is running. If have a piano keyboard on the screen for example, I can run up and down the keys playing all the notes for about 10-20 seconds, then the audio gradually starts to pop and click more and more, until eventually there is nothing but pops and clicks. If I wait until all the notes stop playing, and then play a single key, the sound is still distorted and horrible. It's almost like the audio engine crashes or something? This also requires the to be shut down and reopened. Could the audio not be unloading itself from the memory properly? They are all very short samples, and do not cause any problems when they are playing together at first. It really seems like it is dependent on how long the app is open.

    I can reproduce this with a simple project with one audio file and one button, if you hold the button down to play a sample repeatedly, it will eventually degrade into pops and clicks.

    Ashley I know this is probably an HTML related problem but if there's anything you could suggest I'd be really grateful, as I know you are an expert on the audio side of things. I've used the analyser effect to make sure I'm not clipping anywhere along the chain.

    Thanks!