I'm using Lame to encode wav to mp3 in android.
http://lame.sourceforge.net/ - LAME, with this tut. http://developer.samsung.com/android/technical-docs/Porting-and-using-LAME-MP3-on-Android-with-JNI, everything works good. creating the libmp3lame.so and the wrapper part. The problem here is, when i take a wav file to encode to a mp3 file, i receive an output file with a buzzie noise. Not sure if there is any configuration left out. The Code is below :
// encoding params initializing
public static final int NUM_CHANNELS = 2;
public static final int SAMPLE_RATE = 16000;
public static final int BITRATE = 48;
public static final int MODE = 1;
public static final int QUALITY = 2;
private File mRawFile;
private File mEncodedFile;
// the following is for encoding
initEncoder(NUM_CHANNELS, SAMPLE_RATE, BITRATE, MODE, QUALITY);
File path = Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
// encoding
mRawFile = new File(path, "Vox_021.wav");
mEncodedFile = new File(path, "newmp3.mp3");
int result = encodeFile(mRawFile.getAbsolutePath(),
mEncodedFile.getAbsolutePath());
if (result == 0) {
Log.i("test", "encoded");
}
// / encoding done
The wav file "vox_021.wav" sample rate is 16000, Bit depth is 16 and stereo. I really dont know why the encoded mp3 file outputs noise. been working on this more than 2 days, any help will be appreciated.