2

I'm using the expo-audio library in my React Native project to play audio files. When I increase the playback speed using setPlaybackRate(2), the audio plays faster but with a higher pitch on Android devices.

To fix this, I tried setting the pitchCorrectionQuality like this:

setPlaybackRate(2,'high');

However, this throws the following error:

Error: Received 3 arguments, but 2 was expected, js engine: hermes

I'm not sure how to apply pitch correction properly with the latest expo-audio APIs. The documentation is also a bit unclear on this.

My goal: I want to increase playback speed without distorting the pitch, especially on Android.

Questions:

  • How can I correctly apply pitch correction using expo-audio?

  • Is there a different method or setting I should use?

1 Answer 1

1

Try:

if (Platform.OS === "android") {
  audio.shouldCorrectPitch = true;
  audio.setPlaybackRate(rate);
} else {
  audio.setPlaybackRate(rate, "high");
}

Credit to neiker: https://github.com/expo/expo/issues/37025#issuecomment-3027988621

Sign up to request clarification or add additional context in comments.

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.