When starting Audacity on a fresh install of Ubuntu 23.04, there is a short clicking sound, and then the audio is gone. Neither Audacity nor other applications (e.g., Audacious) are able to make my headphones output sound. However, sound output via speakers still works.
When opening the sound settings of the OS, I can select between headphones and speakers. Changing the sound device to speakers let's the device output sound. After changing back to headphones, the headphones still remain silent. The sound test for the headphones is silent as well, but the sound intensity bar graphically shows sound being played.
I installed Audacity from the Ubuntu repositories, it's version is 3.2.4.
After I started Audacity, running sudo alsactl restore
fixes the problem temporarily, but re-starting Audacity will break it again.
Thanks to stackoverflow's "Related" section, I was able to find this thread with a few answers. Since my version of Audacity is higher, it shouldn't be a version problem. This answer's suggestion helped to solve the issue temporarily as well. Changing the input source to sysdefault:Internal Mic:0
makes my headphones output sound and even after restarting Audacity, it still works as expected. However, after coming back from sleep, and starting Audacity, the audio is broken again. So, it's apparently not a permanent solution either.
This problem is also present in the flatpak version. The snap version apparently works fine, but it's UI is not suitable for 4K screens.