Jump to content

Converting .ogg files


Recommended Posts

From what I can tell, PandaJS needs both an .ogg and .m4a file for each sound.  I'm assuming that's because certain browsers/devices use one or the other.


I have a bunch of .ogg files that I need to convert to .m4a.  I have tried some online converters with no luck.  The resulting .m4a file seems to work, but PandaJS refuses to load it.


game.addSound('media/sounds/death.m4a', 'death');Uncaught Error loading: media/sounds/death.m4a audio.js:164game.Audio.game.Class.extend.loadError audio.js:164(anonymous function)core.js:586

At first I thought I was just loading assets wrong, but when I use a file from one of the PandaJS examples it works fine. Is there a way to "correctly" convert these files?

Link to comment
Share on other sites

  • 2 weeks later...

You can use avconv with a bash script.


Example on linux :

#!/bin/bashfor filepath in sounds/*; do    filename=$(basename "$filepath")    filename="${filename%.*}"    avconv -i "$filepath" -c:a libvo_aacenc -b:a 128k -y "../media/sounds/${filename}.m4a"    avconv -i "$filepath" -c:a libvorbis -b:a 128k -y "../media/sounds/${filename}.ogg"donemedia=""for filepath in ../media/sounds/*.m4a; do    filename=$(basename "$filepath")    filename="${filename%.*}"    media+="game.addAudio('sounds/$filename.m4a','$filename');"doneecho "game.module('game.media.sounds').body(function(){$media});" > ../src/game/media/sounds.js
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...