Skip to content

Instantly share code, notes, and snippets.

@tduyng
Forked from ChriRas/readme.md
Last active May 19, 2021 05:47
Show Gist options
  • Save tduyng/f53e927feb59a670aa9ec248f4ac2322 to your computer and use it in GitHub Desktop.
Save tduyng/f53e927feb59a670aa9ec248f4ac2322 to your computer and use it in GitHub Desktop.
Set up default audio device on Ubuntu 20.04 LTS

Problem

I have a notebook connected to a port replicator. I want to use the build-in speakers and microfone and not the external ones. If I boot my notebook in my port replicator Ubuntu changes the devices to external.

Solution

  1. Find your internal speaker
pactl list short sinks

0	alsa_output.usb-Generic_USB_Audio_201405280001-00.analog-stereo	module-alsa-card.c	s16le 2ch 44100Hz	SUSPENDED
1	alsa_output.pci-0000_00_1f.3.analog-stereo	module-alsa-card.c	s16le 2ch 44100Hz	SUSPENDED
  1. Set your internal speaker as default pactl set-default-sink <DEVICE> e.g. pactl set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo

  2. Add to "Startup Applications" ("Startprogramme" in German)

  • Open the application "Startup Applications" (Should be preinstalled on Ubuntu)
  • Click on "Add"
  • Give your startup item a name
  • Copy your command from above into the command field.
  • Click on "Save".
  1. Find your internal microfone
pactl list short sources

0	alsa_output.usb-Generic_USB_Audio_201405280001-00.analog-stereo.monitormodule-alsa-card.c	s16le 2ch 44100Hz	SUSPENDED
1	alsa_input.usb-Generic_USB_Audio_201405280001-00.iec958-stereo	module-alsa-card.c	s16le 2ch 44100Hz	RUNNING
2	alsa_output.pci-0000_00_1f.3.analog-stereo.monitor	module-alsa-card.c	s16le 2ch 48000Hz	SUSPENDED
3	alsa_input.pci-0000_00_1f.3.analog-stereo	module-alsa-card.c	s16le 2ch 44100Hz	SUSPENDED
  1. Set your internal speaker as default pactl set-default-source <DEVICE> e.g. ppactl set-default-source alsa_input.pci-0000_00_1f.3.analog-stereo

  2. Repeat step 3.

--

Anothor away

Making the Solution Permanent

Note that these settings are volatile and won't survive a reboot of your PC. To make those settings persistent (well, kind of), I simply added those pactl set-default... instructions to my ~/.bashrcfile - problem solved.

Open the .bashrc file using nano (or another editor of your choice).

$ cd ~
$ nano ./.bashrc

Add those instructions at the end of the file and save it.

...
pactl set-default-source alsa_output.pci-0000_00_1f.3.analog-stereo
pactl set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment