Re: [android-developers] Re: Regarding play audio files using SoundPool class

2012-06-07 Thread Narendra Singh Rathore
On Wed, Dec 21, 2011 at 2:05 PM, kumar kkvarm...@gmail.com wrote:

 Hi,

 Thanks for your early reply Md.Fazla Rabbi.

 * I have noted your point, in my app  I am  also using same as this,  but
 here is  my requirement below*:
 1. Once i click on a button, it should give me three different sounds one
 after the other?  I have three music files, which should be run one after
 the other as soon as the music of first complete, then second should start,
 once the second is completed then third should start, and complete. How to
 provide duration for each audio file?

 *Here the problem is: *
 In my app audio files are with different duration lengths.
 How can I find the duration length and play each audio file?
 If anyone knows soon for this, Please provide me.


I got your problem, you want to play audio files one after the other.

*Here the solution is: *

Firstly, play the first audio file.
Then call the setOnCompletionListener on MediaPlayer like this:

mp.setOnCompletionListener()   // called on completion of the
currently playing audio.

start second audio file here, and similarly the third one.


*Note*: if you are using single MediaPlayer (object), you must have to use
if...else condition in onCompletionListener to check the currently playing
file, and switch to the next file according to it.


With Regards
NSR

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Regarding play audio files using SoundPool class

2011-12-21 Thread kumar
Hi,

Thanks for your early reply Md.Fazla Rabbi.

* I have noted your point, in my app  I am  also using same as this,  but
here is  my requirement below*:
1. Once i click on a button, it should give me three different sounds one
after the other?  I have three music files, which should be run one after
the other as soon as the music of first complete, then second should start,
once the second is completed then third should start, and complete. How to
provide duration for each audio file?

*Here the problem is: *
In my app audio files are with different duration lengths.
How can I find the duration length and play each audio file?
If anyone knows soon for this, Please provide me.


Thanks  Regards,
Kumar Varma.





On Wed, Dec 21, 2011 at 10:59 AM, Md.Fazla Rabbi OPU 
md.fazlara...@gmail.com wrote:

 Hi Verma,
 I have developed a app which holds some audio files(50 sound files). For
 my app  i have used *MediaPlayer* Object which play one sound file at a
 time. So for these 50 sound files i have stored sound files in 
 *res/raw*folder. Then in my code i use an array which holds the
 *id* of the sounds. After that i pass one sound file at a time to *
 MediaPlayer* Object using the index number of the array.

 This is something like this:

 *int [] sounds=new int[] {R.raw.sound1, R.raw.sound2, R.raw.sound3};

 MediaPlayer mp=new MediaPlayer( MyActivity.this, sounds[i] );///*Where *i*is 
 the index no. of the
 *sounds array
 mp.start();*

 Hope this will helpful for you.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Regarding play audio files using SoundPool class

2011-12-21 Thread Md.Fazla Rabbi OPU
Hi Kumar ,

Hope this link will be helpful for you.

*
http://stackoverflow.com/questions/3288513/how-to-play-audio-files-one-after-the-other
*

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Regarding play audio files using SoundPool class

2011-12-20 Thread Jeffrey Dunbar
What requirements are you needing. I would suggest amrnb or ogg to
keep them small,
ogg for quality, never wav or mp3. I personally would put them in the
asset directory
it seemed to work better for my app

Jeff

On Dec 19, 11:15 pm, kumar varma kkvarm...@gmail.com wrote:
 I've created an application which uses around 40 small audio files.
 Right now I'm using mp3 files and each is around 250KB. These files
 are stored in my res/raw directory.
 I'm using SoundPool class to play the files in my application.

 Can one of you suggest what is the best way to store so many audio
 files? Will my application be scalable?
 Is wav or ogg format better approach instead of mp3? Please let me
 know. and one more doubt every time I wanna play  3 audio files one by
 one using SoundPool class can you
  please any one suggest me  to do this

 Thanks ,
 Kumar.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Regarding play audio files using SoundPool class

2011-12-20 Thread kumar
Hi

 thanks for the reply .

On Wed, Dec 21, 2011 at 12:13 AM, Jeffrey Dunbar 
nightsbird.mob...@gmail.com wrote:

 What requirements are you needing. I would suggest amrnb or ogg to
 keep them small,
 ogg for quality, never wav or mp3. I personally would put them in the
 asset directory
 it seemed to work better for my app

 Jeff

 On Dec 19, 11:15 pm, kumar varma kkvarm...@gmail.com wrote:
  I've created an application which uses around 40 small audio files.
  Right now I'm using mp3 files and each is around 250KB. These files
  are stored in my res/raw directory.
  I'm using SoundPool class to play the files in my application.
 
  Can one of you suggest what is the best way to store so many audio
  files? Will my application be scalable?
  Is wav or ogg format better approach instead of mp3? Please let me
  know. and one more doubt every time I wanna play  3 audio files one by
  one using SoundPool class can you
   please any one suggest me  to do this
 
  Thanks ,
  Kumar.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Regarding play audio files using SoundPool class

2011-12-20 Thread Md.Fazla Rabbi OPU
Hi Verma,
I have developed a app which holds some audio files(50 sound files). For my
app  i have used *MediaPlayer* Object which play one sound file at a time.
So for these 50 sound files i have stored sound files in *res/raw* folder.
Then in my code i use an array which holds the *id* of the sounds. After
that i pass one sound file at a time to *MediaPlayer* Object using the
index number of the array.

This is something like this:

*int [] sounds=new int[] {R.raw.sound1, R.raw.sound2, R.raw.sound3};

MediaPlayer mp=new MediaPlayer( MyActivity.this, sounds[i] );///*Where
*i*is the index no. of the
*sounds array
mp.start();*

Hope this will helpful for you.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en