Android application that extracts volume and / or frequency data from an mp3 stream

Still a newbie Java developer, I need to create an Android application that

1 stream of one mp3 from the supplied URL, and then

2 extracts surround and / or audio frequency data from mp3 stream

3 leads a light show from data in # 2

I have a possible solution for # 1 and I'm working on # 2,

Can anyone suggest specific classes in the SDK that I should look at?

Are there any existing Android projects on github or elsewhere that extract the frequency and volume of data from mp3 streaming files that I could study and learn from?

+4
source share
3 answers

- (http://developer.echonest.com/) - MP3, , , .

java-, Android.

0

, , ... - 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];
    }
// 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

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

0
source

All Articles