Using Multiple Audio Formats

Hi,

Can someone post the correct way to deploy a game using multiple audio formats to cover the variety of devices out there?

I have seen some older code where the SimpleAudioEngine will select the proper file format at execution, as long as several types are included and use the same name. But I cannot seem to get that to work and it may already be phased out in the recent versions.

Alternately it seems like there is a method to use ‘isFormatSupported(ext)’ but that does not seem to work for me.

How are people distributing games across a variety of platforms with audio support? The examples in the code always use one type of audio file format only.

Thank you

I am discovering that audio issues occur when you compile all files together. I did test this on the Moon Warriors that was included with v 2.1.5, and even Moon Warriors audio no longer works when you use the compiler and run on single engine file.

Is this a bug in the builds, or with the new SimpleAudioEngine? To be clear, if you play Moon Warriors using the expanded library, the audio works, but if you run it with the included packed file (MoonWarriors-compress.js) the AUDIO WILL NO LONGER PLAY.

Please try this for yourself. It is very important that all audio works with the packed and compiled versions.

I have tested MoonWarriors on PC and my android device, and it works properly on all browsers on desktop and UC browser, QQ browsers on android.

The audio also works properly with a trigger of “Option” or “About” button on chrome android. As the trigger, it is maybe some bug of WebAudioEngine. I will find it out.

XingSen Ma will test all audio compatibility and try to get a spreadsheet about audio format supporting, multi audio feature supporting according to different browsers and OS version.

Hi,

Yes, I understand and this spreadsheet is a great idea.

But my question has to do with compiling a game down into a single packed release file, as is permitted in the cocos2d.js file.

s.src = 'Packed_Release_File.js'; //IMPORTANT: Un-comment this line if you have packed all files into one

If I do this and make a single file that can be played, the audio playback compatibility CHANGES. All else works the same, except audio that works on devices in expanded files, no longer works once packed. So something is not working with SimpleAudioEngine in terms of fallback when packed into single file.

I hope I am explaining this clearly. Let me know if I can send any additional information to illustrate the issue.

By the way, many thanks for the hard work of you and your team. I point out issues only to make the software better and reduce problems for other developers experiencing the same problems.

Thank you,
Sean

Yes, your expression is clear and clean. We will make it has same behavior between single file and expanded files. We will test it more and then show the result here.

Hi,Sean Carmody.
I have tested compile single file on MoonWarriors with version 2.2, audio works well.
My test condition:
Browser: chrome v28
Cocos2d-html5: v2.2

What about your test condition?

Thank you.

Hi,Sean Carmody.
Yes,it has a problem that audio does not play correctly in advanced compress.
I have fixed this issue:
https://github.com/cocos2d/cocos2d-html5/pull/1177

Hi,

I wanted to follow up on this thread in case someone else has found it looking for answers. This fix does seem to be working. Thank you for getting this resolved.

If anyone wants to test, I created a small app that will play the proper audio file for the device/platform it is played on. You can listen and hear which file type plays on each platform. You can also test if the platform allows sounds uninitiated by the user, as iOS does not.
You will also see that I created the same app as a single file app and it works the same.

http://welovebutterfly.com/clients/soundtest-single/
http://welovebutterfly.com/clients/soundtest/

You can hear which file format plays back on your platform. The test also shows how that even if you call a file format directly, it will be ignored and the proper file format for the platform is used instead.

Best,
Sean