0

How do I get the framelength, and other stuff such as the framesize, channels, etc., of an audio file in android?

I tried using the MediaFormat but I thinks its for formatting an audio not getting the details from it. Also, is there a way to import a javax.sound library to android so that if there's no way in getting the framelength, I will just use the classes in javax.sound?

Naveen Kumar Alone
  • 7,536
  • 5
  • 36
  • 57
dimmed
  • 47
  • 5

1 Answers1

1

Try out this code

MediaPlayer mp = MediaPlayer.create(yourActivity, Uri.parse(pathofyourrecording));
int duration = mp.getDuration();
droid
  • 184
  • 13
  • and the duration will give me...? – dimmed Dec 29 '14 at 11:57
  • time duration in seconds. – droid Dec 29 '14 at 12:05
  • I'mm sorry that doesn't seem to answer my question. What will I do to the duration to get the framelength, framesize, etc.? – dimmed Dec 29 '14 at 12:19
  • Just give a look at below link http://stackoverflow.com/questions/6220660/calculating-the-length-of-mp3-frames-in-milliseconds – droid Dec 29 '14 at 12:25
  • There is nothing there that helped me. I just had the audio file and by that I need to get its details (framelength, framesize, chanels, samplerate, framerate, sample size in bits) the things that you see when you use AudioInputStream class in javax.sound. – dimmed Dec 29 '14 at 13:03