2

I have problem with changing pitch of audio keeping its speed (tempo). I want to change pitch of audio and simultaneously don't change its duration. For Android 6.0 and above there is simple way to do this. All we need is using this one line:

mediaPlayer.setPlaybackParams(mediaPlayer.getPlaybackParams().setPitch(1.7f));

But how to do it for lower version of Android?
Is there any easy way to do this?

Or maybe there are some external libraries that can help me?
I found e.g. SoundTouch, but I can't add it to Android Studio project..

So, if there is easy way to change pitch for lower version of Android than 6.0, I would really appreciate that someone give me a solution.
Or, if there isn't as simple way as for Android 6.0 and above I would appreciate if someone give me other helpful solution like libraries or other. And if there will be native library it will be good that someone explain how to add it to Android Studio project.

Sorry for my English! Thanks!

1 Answers1

0

i think the pitch can be changed by changingt its playback rate with setPlayBackRate.I dont know about SoundTouch but i found SoundPool it has setRate method which allows to change playBackrate.

here is qoute from SoundPool's Documentation

Once the sounds are loaded and play has started, the application can trigger sounds by calling SoundPool.play(). Playing streams can be paused or resumed, and the application can also alter the pitch by adjusting the playback rate in real-time for doppler or synthesis effects.

The playback rate allows the application to vary the playback rate (pitch) of the sound. A value of 1.0 means play back at the original frequency. A value of 2.0 means play back twice as fast, and a value of 0.5 means playback at half speed.

Community
  • 1
  • 1
anotherGatsby
  • 1,568
  • 10
  • 21