I tried lame mp3 encoder in android to convert a wav file to mp3, libmp3lame.so was generated and the app convert test.wav to test.mp3 successfully but the problem is that the mp3 file is like THIS, my wav file is a voice of speaking and when it converts nothing can be understand, what is the problem? is it becuase of mp3 options or not?
Here is my main code:
public class Main extends Activity {
static {
System.loadLibrary("mp3lame");
}
private native void initEncoder(int numChannels, int sampleRate,
int bitRate, int mode, int quality);
private native void destroyEncoder();
private native int encodeFile(String sourcePath, String targetPath);
public static final int NUM_CHANNELS = 1;
public static final int SAMPLE_RATE = 16000;
public static final int BITRATE = 128;
public static final int MODE = 1;
public static final int QUALITY = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initEncoder(NUM_CHANNELS, SAMPLE_RATE, BITRATE, MODE, QUALITY);
encodeFile(Environment.getExternalStorageDirectory()
.getPath() + "/test.wav", Environment
.getExternalStorageDirectory().getPath() + "/test.mp3")
}
@Override
public void onDestroy() {
destroyEncoder();
super.onDestroy();
}
}