This is on Xubuntu 24.04 with Xfce desktop environment, it will likely work on Ubuntu and other similair distros as well, tough it has not been tested, you must be on PulseAudio, not PipeWire for this to work reliably.
This fix only fixes the speakers, not the microphone, I have not yet worked out how to fix the microphone, if you have a fix, please comment it below, beware that if you already have a fix for the mic, this will fix the speakers but may break your mic fix.
You may use this tutorial on PipeWire or another sound server at your own risk, it may work, it may not.