One last thing you can try, if the headphone jack still doesn't work after a fresh install, is getting a cheap usb audio soundcard. It will have less noise and give you a reliable dac in the future on Linux. Here is one that I have personally used that has saved my life a number of times.

On 12/14/20 3:32 PM, David Sumbler wrote:
On Fri, 11 Dec 2020 17:43:42 +0100 Jeremy Jongepier <jeremy@autostatic.com> wrote:
Hello David,

After much experimentation with settings, I have now got the sound
from Qtractor back to the headphones.  The distortion is still
there.  I would be tempted to think it might be a fault with my
Raspberry Pi, but the sound is fine when using 'aplay', so clearly
the sound system on the Pi is fundamentally OK.

Comparing the settings in QJackCtl in the Parameters and Advanced
tabs, they are the essentially the same both on the Pi and on my HP
laptop running Ubuntu 18.04.

I'm stumped.
You might want to check out
https://wiki.linuxaudio.org/wiki/raspberrypi#on-board_audio

The onboard audio is still PWM and < 16-bit as far as I know so maybe
that's the cause of the distortion.
It seems possible - although since the sound is at least superficially
OK when played through HDMI but is completely unusable through the
headphone jack, I would have thought I needed to be looking somewhere
else.

I had a look at the wiki page you linked to.  Unfortunately there
doesn't seem to be a date on it, and I am wondering whether it is
perhaps partly out of date.  It mentions Raspberry Pi 1 and 2, but has
no mention of 3 or 4.  Also it has a section on building a real-time
kernel, but I understood that all up-to-date Linux kernels have real
time capability, and certainly my QJackCtl reports that jack is running
in real time.

I haven't so far listened to any actual music played from Qtractor
through the HDMI: perhaps I should try this, to see whether the sound
is sufficiently good to use for editing etc.  But even if it is, it
still doesn't solve the basic problem, which is that I can't use the
sound coming through the headphone socket.

I have a feeling I'm going to have to go back to plan A - which is
using my laptop computer, as I have in the past.  Qtractor and jack run
fine on this.  I was just hoping to use the Pi which would have been
more convenient in some ways.

Before I give up, I might just try a completely fresh install of the OS
on the Pi.  It's just possible something has got messed up along the
way.

Thanks for your suggestions.

David
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
https://lists.linuxaudio.org/listinfo/linux-audio-user