Я пробовал использовать хромой mp3-кодировщик в android для преобразования wav-файла в mp3, libmp3lame.so был сгенерирован, и приложение успешно конвертировало test.wav в test.mp3, но проблема в том, что mp3-файл похож на ЭТО, мой файл wav - это голос говорящего, и когда он ничего не конвертирует, можно понять, в чем проблема? это из-за опций мп3 или нет?
Вот мой основной код:
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();
}
}