I’ve had the problem that elementary os 7 always switches between USB-Sound and Headphones. I prefer Headphones because my Speakers are connected there. The solution is very simple, if you know how 😉

Open a Terminal and type

sudo nano (or vi) /etc/pulse/default.pa

Search for load-module module-switch-on-connect and disable it by placing a # in front of the line („commenting it out“), so that it looks like #load-module module-switch-on-connect.

Note: This is the module that automatically switches to any USB/Bluetooth device that you „connect“ to your system. However, its slightly unintelligent code treats the system startup/wakeup „device driver loaded“ as a „device connected“ event, and that’s why it blindly switches your sound input/output to the wrong device.

Lastly, search for load-module module-switch-on-port-available and disable it by placing a # in front of this line too.

Note: This is the module that automatically changes audio input/output to specific ports such as „Headphones“ whenever it detects ports becoming available (such as when you plug in headphones and „headphone port become ready“).

Save the file and reboot. Now the system always keep your output-device. No changes in da future 🙂

Greetings and have a nice day