Android: Crackling/Noise When Applying Pitch/Tempo Shifting

Hi everyone,

I’m working on an audio project using JUCE, where I need to apply DSP effects like pitch and tempo shifting.

:magnifying_glass_tilted_right: Problem

  • On iOS:

    • The same code works perfectly.

    • Playback and DSP effects (pitch/tempo) are clean with no noise.

  • On Android:

    • Audio plays with slight crackling noise even without DSP.

    • When applying pitch shift or tempo change, the audio quality gets much worse:

      • Crackling / noisy sound.

      • On Samsung devices it’s slightly better, but still noisy.

      • On some other devices, it becomes almost unusable.

    • If I change pitch multiple times, the audio becomes completely corrupted.

:gear: Current Setup

  • Using JUCE ResamplingAudioSource (default JUCE resampler).

  • Tried buffer sizes (512, 1024, 2048). Increasing buffer size reduces dropouts slightly but doesn’t fix noise.

  • Shared .so library to Flutter for integration.

:white_check_mark: What works

  • Normal playback without DSP (but still slightly noisy on Android).

  • Other effects like fade-in/out, panning work, though sometimes with minor noise.

:cross_mark: What doesn’t

  • Pitch shifting (+1 or more → heavy distortion/noise).

  • Tempo changes (adds delay + noise).

:red_question_mark: Questions

  1. Why does the same JUCE code work flawlessly on iOS but not on Android?

  2. Is JUCE’s default ResamplingAudioSource not reliable for real-time pitch/tempo on Android?

  3. Do I need to switch to another approach (RubberBand, SoundTouch, or a custom resampler)?

  4. Could this be related to Android’s audio hardware latency / buffer size handling?

  5. Any recommended practices or working examples for real-time pitch/tempo DSP on Android with JUCE?

Thanks a lot! :folded_hands: Any guidance or shared experience would be very helpful.

Android and iOS audio subsystems are not, in any way, equivalent. Audio on iOS is a first-class service - whereas its more of a tack-on, in Android. This has changed over the years, true, as the Android devs attempt to build better multimedia experiences for the device manufacturers - but it still remains a fact that Android audio is sub-par compared with iOS and you should not expect the same quality on Android as you experience on iOS.

That said, without looking at any code, its very difficult to pinpoint your issue - what Android device are you using for testing, which version of Android, and so on? Are you using a device which the manufacturer has set up to do re-sampling? These are variables that can have a big impact on perceived Android performance.

  • Motorola G62 – Android 13

  • Motorola G84 – Android 15

  • Samsung M35 – Android 15

  • Samsung F15 – Android 15

  • Pixel 6a – Android 16

Yes, these are standard consumer devices. It’s possible the manufacturer’s audio pipeline is performing resampling internally, which may contribute to the crackling.

You get crackling on each of these devices?

Yes, slight crackling occurs on all of these Android devices when playing audio, and it gets worse when applying pitch/tempo DSP effects.

Interesting. Well I’m afraid its not going to be too easy to help you debug this without code. Can you produce a version of your project that you can share, so folks can see whats going on?

For security reasons, I can’t share the project code, but when audio is played without DSP and resampling, it sounds clear on Android. This indicates the main issue is with DSP effects. I’ve already set the audio device buffer size up to 2048 and even hardcoded the sample rate to 48000 and 44100, but the result remains the same when testing with DSP and resampling. DSP is essential since it’s a core part of our project.

Well, alas, there is no indication that this is a bug in JUCE and may very well just be a bug in your DSP code. Until you can share that, there’s not much help that can be offered. I would suggest breakpoint-debugging your buffers and be sure they’re behaving as you expect them to in processBlock() ..

1 Like