, , ... - API, "MediaPlayer", RMS .
, MP3, x Y :
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];
}
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
RMS * RMS * min max "y-axis" vals "myamt" , 10 (max-min) * , RMS AVG LESS * . * TS , , * . * - 5 10% RMS- "". * , , .
To set buffers instead of the "MediaPlayer" api, you may need to use "AudioTrack" to process your mp3s. For samples, I think you can go to this project on git
RMS and handler explain here
source
share