I want to make an android program to play several sounds from the raw folder.And each sound can be controlled by its own play/pause button and the other thing is, this program can run in background also(as a service) How do i do that please some one help me to do this I already tried this but it is not working.Any help would be appreciated...
I think it is better to use SoundPool class to manage multiple sounds at the same time.
Related
I need to play sound effects in my game such as jump, failed, shot etc.
So for this purpose I have selected SoundPool class. But there were some times when it lagged.
So I wonder what is correct way to use this class. I have tried to use play method in new thread, it seems work better but I don't know if I am correct.
Please advice how to use object of this class correctly for better performance.
Best way to implement Sound / Music into your game is by using Service component. Read this answer here for an example.
I am currently trying to create an android app that plays a different sequence of sounds based on user input. Is there a simple way to play a sequence of sounds I have looked at mediaplayer and soundpool but it does not look like they where designed for sequential.
Thank you RandyFreak that is probably the better way. But I actually Ended up doing it a little differently.
I created a list of fileDescriptors pointing to sounds and added an oncomplete listener to mediaplayer. And every time the media player completed it's current sound it would play the first sound in the list and remove it from the list.
I came across this issue a few months ago.
How I overcame this was I created a different mediaplayer for each sound and played them in the order that I needed.
That would be the simplest method.
I hope this helps
RF
For my application I need to play multiple tracks simultaneously and some kinf of listener to know when a track is finished.
SoundPool seems to be the obvious choice, but unfortunately I could't find a solution to get notified when a track ends.
I also thought about using multiple instances of Android's MediaPlayer, but I'm afraid of getting performance issues.
Are there any other options?
If you use MediaPlayer, you can use OnCompletionListener. It also has no problem of playing multiple tracks at the same time. Like gian1200 says. Try it, perhaps the performance is not really an issue.
I need some help in the concept of Services in Android? Actually i want to Play some sounds with animation in Android. I'm done with frame by frame animation successfully but want to play some audio with animation. I got some ideas about Services from google but I'm unable to get their point, so that i am posting it over here. If anyone has any idea about how can i do this please give me some suggestion to do this. It would be very helpful to me.
Have a nice day ahead...
Thank you!!
You'd need to take a look at,
MediaPlayer
I think the documentation given is self-explanatory. Also you need not make use of a separate Service for playing the sounds, unless of course you have a special need.
I'm pretty sure this must be possible...
But is there a way to find the 'noise produced' by a currently playing sound (MediaPlayer)
-Like in many music editor software you import a song and it does a graphical layout of the song -like a graph with it higher up at louder bits.
Hard to explain.
But there must be a way to do this on android...
Does anyone know?
Thanks alot.
James
(Not the whole graph thing -just like, the noise/decibels currently playing or something...)
AFAIK, you cannot intercept the audio output of another application, if that is what you are asking.