Sign in to follow this  
valueerror

could use some advice for optimal audio encoding :)

Recommended Posts

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 :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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 :(

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.