You will want to expose the buffer underlying the read so you can get at derived Volume level... This may mean using some other API than 'MediaPlayer' which may NOT expose RMS level for volume.
Each time you do a buffered Read on the MP3, you can generate x-axis, y-axis data from the Volume with the following:
while (mIsPlaying) {
double sum = 0;
int readSize = mRecorder.read(mBuffer, 0, mBuffer.length);
for (int i = 0; i < readSize; i++) {
output.writeShort(mBuffer[i]);
sum += mBuffer[i] * mBuffer[i];
}
// PrBar needs RMS as int
//log base2 for the rms expression on the Volume from the mic
if (readSize > 0) {
mProgressBar.setProgress((int)Math.sqrt( sum / readSize ));
handleRMS((Math.log(Math.sqrt( sum / readSize ))/Math.log(2)));
}
}
...
private void handleRMS(double rms){
rmscnt++;
rmssum += rms;
if(rms > rmsmax)rmsmax=rms;
if(rms< rmsmin)rmsmin=rms;
double myamt=(rmsmax - rmsmin) / 10 +rmsmin;
if (rms < myamt) decile++;
if(rmscnt % 5 ==0){
if (rmssum / 5 < myamt) {
if( Long.valueOf(System.currentTimeMillis())
- tslist.get(tslist.size()-1) - segmenttime > 0 ){
tslist.add(Long.valueOf(System.currentTimeMillis()));
};
};
rmssum = 0;
}
}
* feature - select the TS corresponding to a 'pause' in the speech stream * arriving from microphone * ''pause' in algorythm and
the normal RMS volume level on a sine-wave pattern * observe the
last reading for RMS in light of the sine-wave * min & max are
'y-axis' vals on the wave * 'myamt' field is a threshold cap that
is currently 10 percent of delta ( max - min ) * in practice, a
pause has to have a series of adjacent RMS values with an AVG LESS
than * some config-value. * Once the TS for a pause has been
accepted, there is another min value of time that should * pass
before looking for another pause in the speech. * Helpful hint - 5
to 10% of the RMS vals should increment 'decile'. * Otherwise,
there are not enough lo-volume events on the radar to ID pauses in
speech.
In order to expose the buffers, instead of 'MediaPlayer' api , you may need to use something like 'AudioTrack' to process your mp3. For samples, i think you can go to this project on git
RMS and the handler explain here