Ubuntu Studio 20.10 sound card not picked up

I got my PC hooked up to a kvm and I switch between my computers quite often. Connected to the kvm there are a bunch of peripherals: a keyboard, a mouse, a monitor and a Behringer U-Phoria sound card.

Every now and then, when I switch back to my Ubuntu PC, it fails to pick the sound card up and even restarting Pulseaudio does not solve the issue.

So, I created a small script in my home directory and called it restart-pulse-audio.sh with the following content:

!/bin/sh

systemctl --user restart pulseaudio
systemctl --user restart pipewire

Just run it whenever your card is not picked up as you switched it off/on and it should get it alive and kicking.