Jump to content

.wav files loaded as .mp3 from game engine


Recommended Posts

Using MelonJS 5.1, I'm trying to load a .wav audio file named data/bgm/Spywatch_Music_Overworld_v3_Spanish.wav but it's reading it as a .mp3.

modules.js:30156 GET 404 (Not Found)

My resources object is loaded via Grunt:

        files: [
            src: ['build/data/bgm/**/*', 'build/data/sfx/**/*'],
            type: 'audio'

Which results in

game.resources = [
        "name": "Spywatch_Music_Overworld_v3_Spanish",
        "type": "audio",
        "src": "build/data/bgm/"

https://melonjs.github.io/melonJS/docs/me.audio.html states "melonJS supports a wide array of audio codecs that have varying browser support : ("mp3", "mpeg", opus", "ogg", "oga", "wav", "aac", "caf", "m4a", "mp4", "weba", "webm", "dolby", "flac")."

so in game.js I initialize the sound engine as me.audio.init('mp3,ogg,wav');

Why is the engine defaulting to .mp3? Do I have to manually specify the audio file extension?

@obiot  @Parasyte

Link to comment
Share on other sites

Hi, well this is just not how the current implementation works, the engine will just pick up one that is supported by the target broswer based on the given priority, and if you want to provide the 3 formats, you cannot therefore mix&match them.

Keep in mind also that not all browsers will support ogg for example. I would personnaly recommend to stick to mp3 amd webm (wav files are just to big), and it’s pretty simple to convert them (some website even provide some online converter).

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...