How to get the data transfer rate, sampling rate and not. audio file channels in android

I need your help to request below:

Query: Is there a way to get the following information about an audio file. Sampling frequency, channel, bit rate of the audio file.

To extract the bitrate, the MediaMetadataRetriever API (METADATA_KEY_BITRATE) is available.

Please suggest whether this can be done using any Android API.

Found this below API, but its use is actually in a different one. http://developer.android.com/reference/android/medi/AudioTrack.html

I want to extract them using the Android API programmatically: Sample rate, quantization, channel of the input audio file.

Please help us with this.

Thanks in advance.

+5
2

, MeiaExtractor :

MediaExtractor mex = new MediaExtractor();
    try {
        mex.setDataSource(path);// the adresss location of the sound on sdcard.
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    MediaFormat mf = mex.getTrackFormat(0);

    int bitRate = mf.getInteger(MediaFormat.KEY_BIT_RATE);
    int sampleRate = mf.getInteger(MediaFormat.KEY_SAMPLE_RATE);
    int channelCount = mf.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
+1

MediaPlayer.getTrackInfo() ( , METADATE_UPDATE onInfo), MediaFormat , getFormat . MediaFormat :

BIT_RATE

CHANNEL_COUNT

SAMPLE_RATE

0

All Articles