Phonegap / Cordova Change the volume of an individual sound?

Using Phonegap / Cordova 2.2 with its API to download loops for playback in my application. (Http://docs.phonegap.com/en/2.2.0/cordova_media_media.md.html#Media)

We work perfectly, but I would like to be able to change the relative levels of each sound programmatically. Does anyone know if this is possible?

The only opportunity I see is to avoid using the Native Phonegap solution and using Web Audio / html5, but this will limit the applications to ios6 devices only.

PS. I also know about the volume plugin for iOS, but you need a solution that only affects single sounds.

+2
source share
2 answers

From Cordova 2.0 and above (as I found out) there is a way to change the sound volume programmatically. Undocumented but something like this goes (where x = 0 to 1)

MySound.setVolume(x); 

Please note that it only plays sound before it starts playing. It will not change the volume of an already playing sound (I sent a function request)

+2
source

You might want to check out the low latency audio cable. Some people have to pull requests against him in order to maintain volume control. Check comments:

http://www.tricedesigns.com/2012/01/25/low-latency-polyphonic-audio-in-phonegap/

+1
source

All Articles