valueerror Posted April 23, 2015 Share Posted April 23, 2015 in my games it usually takes a very long time (on mobile) to load my audio files.. i use audacity to export them as OGG (preset - quality 4) it takes at least 20 seconds to decode the maintheme ( only 500kb in size) .. nothing else is decoded when the game starts.. i set autodecode to false on all other sounds so it really is just this one file.. i tried to convert it as mp3 (ca. 600kb) but it needed the same amount of time to decode.. so i'm asking here.. has anyone else problems with slow audiodecoding ? how EXACTLY do you export/create your audio files? thx in advance Link to comment Share on other sites More sharing options...
stupot Posted April 24, 2015 Share Posted April 24, 2015 I use ffmpeg to convert source sounds to various output types. I load in lower quality sounds to mobile devices (tablet/phone), best quality goes to desktop browsers. On a desktop browser, conversion is very quick or not needed. On a mobile device, decoding time increases with filesize, there's little difference with file formats but I do find .mp3 to be slighly slower. You can't avoid slow decoding on mobile, but you can manage the situation by prioritising the order of decoding if sound files are separate. There's not much to be done with large sound sprite files, just gotta wait. That's my experience, let me know if you find out something good. Link to comment Share on other sites More sharing options...
valueerror Posted April 24, 2015 Author Share Posted April 24, 2015 so you would suggest that i use higher compression to make the filesize smaller.. i tried reeeaally low quality settings and it's still ok on a mobile phone... i'll give it a try and see if it helps Link to comment Share on other sites More sharing options...
stupot Posted April 24, 2015 Share Posted April 24, 2015 sorry, I just meant simply that a longer sound file will contain more audio data, thus longer to decode. Higher compression might result in a smaller file (faster download) but a longer (more cpu intensive) decode. For mobile, I find it adequate to reduce sounds to a single channel. When it comes to sampling frequency, I've had playback problems on some browsers when going too low (ogg's I think) so had to stay in the mid-range anyway. As always in HTML5 game dev, there's an upside and downside for just about everything, hardly any single strategy works out best for every device! Link to comment Share on other sites More sharing options...
valueerror Posted April 25, 2015 Author Share Posted April 25, 2015 thx for clarification.. (i tried to compress the file even more and only got 50kb smaller filesize so this wasn't the way to go anyways) going to try a mono track now thx! Link to comment Share on other sites More sharing options...
valueerror Posted April 25, 2015 Author Share Posted April 25, 2015 tried exporting to mono track ... its now 100kb smaller so the 1.20 minute track is about 420kb in size.. it's a little bit better now but still very annoying.. i'd rather see the splash screen longer and have the music starting when the game starts instead.... you can still count to 10 before the music starts Link to comment Share on other sites More sharing options...
woubuc Posted April 25, 2015 Share Posted April 25, 2015 Have you tried not encoding it (e.g. as a .wav file)? Of course in a production environment this would create a lot of additional overhead (unless your sounds are really short and limited) and it probably won't be viable, but it should theoretically move the waiting process to the loading screen as it's loading the audio file, in exchange for removing the decoding wait time (since if the audio is not encoded there's no decoding that needs to be done). So you could test with something like that to see if the audio plays right away when it's loaded. ...Just thinking outside the box here, no idea if this would be viable for your project. Link to comment Share on other sites More sharing options...
valueerror Posted April 25, 2015 Author Share Posted April 25, 2015 thx for putting thought into it.. unfortunately this is not an option.. i don't want to increase the filesize of my game by 10mb just because of one music file Link to comment Share on other sites More sharing options...
stupot Posted April 26, 2015 Share Posted April 26, 2015 start your sound files loading 1st, before gfx, so they can start decoding asap, ie. while the other resources are still downloading Yanifska 1 Link to comment Share on other sites More sharing options...
Recommended Posts