Pitch changes lower the audio quality

What is your operating system?

macOS Catalina (10.15.7)

What is your Shotcut version (see Help > About Shotcut)? Is it 32-bit?

21.10.31 64bit

Can you repeat the problem? If so, what are the steps?
(Please be specific and use the names as seen in Shotcut, preferably English. Include a screenshot or screen recording if you can. Also, you can attach logs from either View > Application Log or right-click a job and choose View Log.)

Changing pitch (either via filter or pitch correction when changing speed) lowers the audio quality and makes it kinda reverbish. This bug was claimed to have been fixed a few versions ago but it still exists (although maybe it’s not as bad as it was before?). And worth noting the bug was not always present, maybe before a year or two (i don’t remember exactly) it didn’t exist at all, changing pitch would have no effect on quality. Consider reverting to that or doing it via the same method ffmpeg uses which doesn’t have the issue (example command: ffmpeg -i audio.flac -map 0:a -af asetrate=SAMPLE_RATE/SPEED_FACTOR,aresample=SAMPLE_RATE,atempo=SPEED_FACTOR -acodec flac output.flac)

It was fixed for only certain amounts of speed change [0.5, 2.0] or octave range [-1.0, 1.0]. The reason it is limited is because it otherwise leads to large amounts of delay and memory consumption. We are unable to replace what we are using with that series of ffmpeg audio filters because asetrate does not support keyframes.

I never go outside this range, usually 0.5-2 or very small numbers (0.000030 for example, or an approximate PAL/NTSC conversion factor), and I don’t recall any performance issues with the old versions that didn’t have the bug but maybe I missed it

This has always been true for all versions. But there was a regression that made it much worse and the “fix” was to restore the previous quality for 0.5x-2x pitch cases.

Have you tried a side-by-side comparison of an older version and 21.10.31 to be confident that it is worse than previous versions?

I have an audio file that was speed up by 1.000030 with an old Shotcut version (pre-regression) and pitch-corrected (ik it’s very small and negligible but my project needed frame precision, don’t ask), there’s no noticeable quality loss. Newest one has the quality loss, i just think it was worse with the regression version, but I can’t remember exactly

This bug report is to subjective to be actionable. The subjective quality of the final output depends on the pitch compensation being applied and the original audio source. When I test the audio quality of the pitch features, I always use clips with human speaking because I feel like it is the easiest to detect distortions.

Here is the clip I used for my testing:

In order to test this, I downloaded the first version to ever support the pitch filter:

Then I also compared it to the current release:

Here are my steps:

  1. Open Shotcut 20.02.17
  2. Open the file linked above
  3. Add the pitch filter
  4. Set the “Speed Correction” value to 1.10000 (pitch will be -0.137504)
  5. Export to file name: pitch_test_20.02.17.mp4
  6. Open Shotcut 21.10.31
  7. Open the file linked above
  8. Add the pitch filter
  9. Set the “Speed Correction” value to 1.10000 (pitch will be -0.137504)
  10. Export to file name: pitch_test_21.10.31.mp4
  11. Listen to pitch_test_20.02.17.mp4 and pitch_test_21.10.31.mp4 back-to-back over and over

The two files sound exactly the same to me. But maybe you can hear a difference? Or maybe you have a different audio file that exposes a difference that can not be heard from this file.

Looking at other old projects and trying it again by downloading the old shotcut version seems like indeed you’re right that the bug always existed, but it just is not noticeable for small pitch changes as much as bigger ones (and I’ve been using bigger pitch changes to test if the bug was fixed instead of the small ones I used in my old projects…)