Playing Multiple Sounds in Android - android

I want to Play Multiple sounds. I know how to play them, but i want to play them synchronously. For example i have all my sounds of length 4 second. if i play first sound at 04:00:00 and second play on 04:00:02 then the second one start on 04:00:04 not in middle.
Is there any framework available in android to do this Or any other Help...

Related

Playing sound fast as possible

Now like does the question says, I need a way to play a small sound that lasts for like 1 second or less to play really quickly/fast in my Xamarin Android app. I am using .mp3 files and MediaPlayer class, is there any way to get as fast as possible to play a particular sound?

Android play two different songs on different earphones at the same time

I need to play different audio at the same time, one to the normal earphones and another one to the bluetooth earphones. (on Android...)
someone know if i can do this? how?
thanks!
android has three Streaming Types:
Ringtone & Notification, Media and Alarm.
you can use them to play different sounds but you can't play them in same time. there is an priority rank.

how to play different songs on left and right channels simultaneously on android device

Is it possible to play 2 different songs simultaneously on the left and the right channel on android device? I searched a lot to see if MediaPlayer class provides APIs to support that but in vain.
SoundPool has the file size restriction and I need to play files larger than 2 MB. Basically, I have a android player which plays single zone. Now I need the player to play 2 different songs simultaneously on the left and right output (speakers/earphone etc.) Is this possible? Any help is greatly appreciated.
Use two instances of AudioTrack.
I create plenty of them.
Usually devices let you go up to 24 or so.
All you need is two :-)
android play sound with AudioTrack
The setVolume() method takes two parameters, one for left, one for right.

How to play multiple sounds simultaneously in Android?

I've been trying to make multiple sounds work simultaneously but I kept getting errors like Sample not ready and Error creating AudioTrack. Though I've taken care of the first error, the other error persists.
I'm using two mp3 files, that are away above 5 mb(>4 minutes) and thus was wondering if SoundPool is the right way to go about it? I can use Media Manager but it doesn't let me play multiple files simultaneously.
SoundPool is recommended for <1MB sound clips, so I'd use MediaPlayer in your case. You can call the following for each sound and they will play simultaneously:
MediaPlayer.create(YourActivity.this, R.raw.your_sound).start();
Or you can create multiple MediaPlayer objects and play a sound on each, then release() them.

Android, load sounds and play immediately?

I have been attempting to play a bunch of sounds in my app as some views switch. The sound is narrative for the views and is between 3 and 10 seconds each, of which there are about 30.
First, I tried loading them all into a sound pool and passing it to a hashmap on program load, then I simply play them when required. This worked for the first 5 or 6 sounds but once I started to add more sounds to the sound pool, the later ones did not play. I assume this is due to the 1MB limit I have read about on soundpool.
I tried switching to just loading the sound and passing it straight to play on the next line however, no sounds play. Logcat just shows a reset and command cancelled for the player.
I switched then to loading the file and pointing to it with the hash map, however, even after doing an unload and loadimg a new sound at the same index it would just play the same sound every time.
I have tried MediaPlayer but it is ineffective for my desired application.
Can anyone suggest a way I should look to implement this properly? And should I be trying to load all sounds before hand or not?
I think you need to wait for the load to complete before you can play it. Add an onLoadCompleteListener and then play it when that is invoked.

Categories

Resources