I have identified a temporary fix within the OS.
Select 'Line In' under System Preferences - this clears up the distortion.
Sometimes the distortion comes back if you click this window away, so minimize the window while keeping 'Line In' highlighted.
I am using layout-id 29.
I played around with this again today.
You can clean up the distortion by selecting 'Line In' within Systems Preferences.
A temporary fix, as the input jack/headphones sometimes it goes back to distortion.