DASAR-zz / Minim-Android

Java Minim port for Android
GNU General Public License v2.0
34 stars 12 forks source link

Minim-Android

This is project contains part of Java Minim audio library which can be used on Android.

For now all classes with unsatisfied dependency removed.

You can use this project with audio decoders or Android native classes like AudioRecorder or any other source of PCM audio for analysis or audio effects.

This project contains packages:

Convert Android PCM 16 bit audio to 32 bit interleaved float.

/**
* Convert 16bit short[] audio to 32 bit float format.
* From [-32768,32768] to [-1,1] 
* @param audio
*/
private float[] shortToFloat(short[] audio) {

    float[] converted = new float[audio.length];

    for (int i = 0; i < converted.length; i++) {
        // [-3276,32768] -> [-1,1]
        converted[i] = audio[i] / 32768f;
    }

    return converted;
}

Usage

Add to your project as Eclipse library project.

License

Minim and this project is licensed under the GNU Lesser General Public License (LGPL)