I created the following python script that does the following:
This way I can switch between audio from the monitor or from the laptop (headphones) typing in the shell: audio-hdmi or audio-laptop
bashrc file: alias audio-hdmi='pacmd set-card-profile 0 output:hdmi-stereo+input:analog-stereo'Īlias audio-laptop='pacmd set-card-profile 0 output:analog-stereo+input:analog-stereo' Welcome to PulseAudio! Use 'help' for usage information.Īnd finally, in order to make the switch faster, I set up two alias in my. Where 0 is the index of the card: pacmd list-cards In my case I found all the card profiles with: pacmd list-cardsĪnd after I can switch between monitor and laptop speakers with: pacmd set-card-profile 0 output:hdmi-stereoĪnd: pacmd set-card-profile 0 output:analog-stereo+input:analog-stereo So the solution which actually worked is: pacmd set-card-profile What is changing between a switch and another is the 'card-profile'. In this case the card is always the same.