I'm developing an app in Android to change the all recorded audio files by men voice to the women voice.
I found a solution to change the Pitch value of an audio file by PlaybackParams in MediaPlayer. Here's my code for changing Pitch value:
mediaPlayer =new MediaPlayer();
mediaPlayer.setDataSource(ur);
mediaPlayer.prepare();
PlaybackParams params = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
params = new PlaybackParams();
try {
params.setPitch(Float.parseFloat(1.6f));
}catch (Exception e){
params.setPitch(1.6f)
}
mediaPlayer.setPlaybackParams(params);
}
It works well, but the problem is that it works only on Android above version 5. Does anyone know another solution for that?