tags:

views:

36

answers:

2

Is there a way to determine the audio format of an audio file in Android? On normal java I do it like this:

File file= new File(...);
AudioInputStream stream = AudioSystem.getAudioInputStream(file);
AudioFormat format= stream.getFormat();
+1  A: 

android.media.AudioTrack[1] has the following methods to access information about audio data:

  • getChannelCount to determine the number of channels
  • getChannelConfiguration to determine if you deal with mono or stereo content
  • getSampleRate to find out the sampling frequency

and

  • getAudioFormat to determine if you deal with 8bit or 16bit sample width.
Henning
A: 

The AudioTrack.getXXX methods you list merely return the values supplied to the constructor. This doesn't solve the original poster's issue.

Mark