I built a phase vocoder in JavaScript based on this paper. It works great, except for a crackling artifact that is present in the rebuilt signal.

I recorded this clip if you want to hear what it sounds like

Here’s somethings I’ve noticed regarding this artifact:

  • it doesn’t get better or worse with time expansion or compression
  • It changes a little based on sample rate and fft size, but it doesn't go away
  • It appears to get worse when low frequencies are present (see link above to listen)
  • the crackling is not present when the original signal is made up of a single sinusoid

I thought I might have had a 1 off error when rebuilding the signal from the processed frames like in this example, but I tested plain 400hz sin wave with no time scaling, and the processed waveform had no discontinuities in it, it was completely identical to the unprocessed waveform as expected.

I also tried applying a hanning window to the processed frames. This did fix the crackling, but because the output frames were already shaped as hanning windows from the when the hanning window was applied before processing, this introduced a different artifact that makes the audio sound like someone talking into a fan.

Does anyone know how to fix this? I was thinking about maybe applying a low pass filter, but I don't know if this would work. Im not experienced in signal processing so I'm hoping someone with a little more knowledge may be able to help.

  • $\begingroup$ getting the phase lined up in each subsequent frame? $\endgroup$ Jan 2, 2023 at 5:37
  • $\begingroup$ I believe so, when I tested a single 400hz sin wave and looked at the output wave form, there were no discontinuities anywhere. Also, the actual audio sounds fine except for the artifact. If it wasn’t phase aligned it would sound a lot worse right? $\endgroup$ Jan 2, 2023 at 16:08
  • $\begingroup$ If you're time-scaling, what should come out is a single 400 Hz sin wave with no artifacts. But to do that, you have to make sure that the phase of the 400 Hz sin wave in frame number $K$ is aligned with the phase of the 400 Hz sin wave in frame $K-1$. For time-scaling, these frames are moving at different hops. You need to make a phase adjustment to each sinusoidal component. $\endgroup$ Jan 2, 2023 at 17:38
  • $\begingroup$ Yes with a single wave there are no artifacts, with time scaling too, everything looks fine. Yet it the audio clip there is audible artifacts even without time scaling. It really doesn’t make any sense. The phases seem fine $\endgroup$ Jan 2, 2023 at 18:12
  • $\begingroup$ I just now tested with an 220hz sin wave and realized that my peak detection algorithm wasn’t able to pick it up because it starts at bin 2 and checks the two bins to the left and right to see it a peak exist. But if threre is a peak in bin 0 or bin 1, it can’t detect it. could this be an issue? I feel like this wouldn’t matter for a crackling artifact, but maybe it would? Again I’m not an expert so I’m not really sure $\endgroup$ Jan 2, 2023 at 18:24


Your Answer

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