Cordova Native Audio - Multi audio at same time

Hi!

I did a search, but I did not found anything. If I am wrong, please feel free to point me to the right topic.

How can we play at exactly the same time multi sounds selected with check boxes?

For example, lets say, we have 5 check boxes and we select 3 of them to play at the same time.

I am trying to use the Cordova Native Audio plugging to implement this. This plugging supports polyphony and low latency.

Thanks
Richard

Hi!

Right now, following the docs, i have this:

// Preload audio resources
	window.plugins.NativeAudio.preloadComplex( 'pewpewpew', 'assets/pewpewpew.mp3', 1, 1, 0, function(msg){
	}, function(msg){
		console.log( 'error: ' + msg );
	});

	
	window.plugins.NativeAudio.preloadComplex( 'soldier', 'assets/soldier.mp3', 1, 1, 0, function(msg){
	}, function(msg){
		console.log( 'error: ' + msg );
	});
	

	window.plugins.NativeAudio.preloadComplex( 'effects', 'assets/effects.mp3', 1, 1, 0, function(msg){
	}, function(msg){
		console.log( 'error: ' + msg );
	});
	
// Play
	window.plugins.NativeAudio.play( 'pewpewpew' );
	window.plugins.NativeAudio.loop( 'soldier' );
        window.plugins.NativeAudio.loop( 'effects' );

and this checkboxes example:

http://play.ionic.io/app/89d16b54285b

Who can I implement the checkbox with the sound, and start the selected sounds at same time?

Why aren’t you using Ionic Native? https://ionicframework.com/docs/native/native-audio/

Hi Sujan,

I am not a software developer. I build electronics. So, my coding isn´t that great. I have this problem to solve, and I discovered that Cordova Native Audio can solve the problem.

If I execute the above code, the 3 mp3 files play simultaneous. But i need to play them selectively.

Can somebody give some clues or teach me how can I solve this?

The link I posted gives you a better code interface to the same underlying Cordova plugin.

What does

mean? One after another like in a playlist?

Then you will have to somehow handle this by listening for the stop event, then trigger the play of the next one.

Or maybe there is a plugin or way to directly give some code a list of files to play consecutively?

Hi Sujan, thanks for the replay.

Sorry, I am Portuguese, English is not my main language.

What I am trying to say is : if you select 3 check boxes (from a total of 5 boxes), the associated sound will play at the same time. In this case 3 different files play at the same time.

If you select 4 boxes, 4 sounds will play at the same time, and so on.

:slight_smile:

I would start by making a backing form using FormBuilder to control your checkboxes. Then you would loop across the form’s value when a “play” button is pressed playing whichever sounds are selected.

Now, given what you’ve said earlier, that paragraph is probably going to sound to you as if it was written in ancient Chinese, and I’m sorry but I can’t really do anything about that. I think you should team up with somebody who has experience building Angular apps.

Ok, so you are only missing the buttons to start and stop each individual sound, right?
Right now it just starts playing when oyu open the page, correct?

Sujan, yes is that! First let me try something.