Pulseaudio: how to rescan audio devices?

Actually, yes, there is a way to do so without restarting Pulseaudio:

pacmd unload-module module-udev-detect && pacmd load-module module-udev-detect

I use it everytime I plug in my external-soundcard or after waking up my laptop. Pulseaudio cleans up his room and bring back my Spotify music on my external soundcard automatically (as it is my default soundcard).

You will need pacmd to do so; it is included in the pulseaudio-utils package on Ubuntu.


Running

pulseaudio -k && pactl load-module module-detect

worked for me. This will restart pulseaudio and therefore forget existing devices. Afterwards it will rescan for devices. The difference here is not to use udev, maybe there is an issue with the setup that prevents udev support.

This was necessary for me, as I'm using external devices at my laptop, but sometimes internal speakers.

For some reason you might need to add a sleep between both commands.