Growler Posted August 25, 2018 Share Posted August 25, 2018 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 http://127.0.0.1:3000/data/bgm/Spywatch_Music_Overworld_v3_Spanish.mp3 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 Quote Link to comment Share on other sites More sharing options...
Growler Posted August 25, 2018 Author Share Posted August 25, 2018 @obiot @Parasyte any ideas on this? Quote Link to comment Share on other sites More sharing options...
obiot Posted August 26, 2018 Share Posted August 26, 2018 Hi, the list of extensions is also a list of priority, which means that in this case melonjs will check if mp3 is supported, and if yes try to load the corresponding mp3 assets. if you need .wav, just put it first, or only that extension. Quote Link to comment Share on other sites More sharing options...
Growler Posted August 26, 2018 Author Share Posted August 26, 2018 @obiot but I have a mix of wav, oggs and mp3s. Why can't I load each as an audio file in their own format? Quote Link to comment Share on other sites More sharing options...
obiot Posted August 26, 2018 Share Posted August 26, 2018 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). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.