linux_audio.txt (7246B)
1 Quick overview (start here) 2 3 ```bash 4 # Best single overview — devices, default in/out, volumes 5 wpctl status 6 7 # Short lists of inputs (mics) and outputs (speakers/headphones) 8 pactl list sources short 9 pactl list sinks short 10 11 # What's currently the default? 12 pactl get-default-source # default mic 13 pactl get-default-sink # default speaker/headphones 14 ``` 15 16 On your machine right now, wpctl status shows mics including USB Audio 17 Front Microphone, C922 Webcam, and OpenFit Pro (Bluetooth); default output 18 is the Shokz headset. 19 20 ─────────────────────────────────────────────────────────────────────────── 21 22 PipeWire / PulseAudio layer 23 24 ```bash 25 # Full detail on one device (replace SOURCE_NAME from list above) 26 pactl list sources | less 27 pactl list sinks | less 28 29 # Set default mic/speaker by name or index 30 wpctl set-default <ID> # ID from `wpctl status` 31 pactl set-default-source <name> 32 pactl set-default-sink <name> 33 34 # Live volume meters (useful before a call) 35 pavucontrol # GUI, if installed 36 ``` 37 38 ─────────────────────────────────────────────────────────────────────────── 39 40 ALSA hardware (kernel level) 41 42 ```bash 43 # List capture (microphone) hardware 44 arecord -l 45 46 # List playback hardware 47 aplay -l 48 49 # See which ALSA cards the kernel sees 50 cat /proc/asound/cards 51 52 # Per-card details 53 aplay -L # playback PCM devices 54 arecord -L # capture PCM devices 55 ``` 56 57 Your ALSA capture devices: USB Audio (front/rear mics) and C922 Webcam mic. 58 59 ─────────────────────────────────────────────────────────────────────────── 60 61 USB / Bluetooth devices 62 63 ```bash 64 # USB audio devices plugged in 65 lsusb | grep -i audio 66 67 # Bluetooth audio devices 68 bluetoothctl devices 69 bluetoothctl info <MAC> # connection/profile details 70 ``` 71 72 ─────────────────────────────────────────────────────────────────────────── 73 74 Quick mic test (record 5 seconds) 75 76 ```bash 77 # Record from default mic 78 arecord -d 5 -f cd /tmp/mic-test.wav && aplay /tmp/mic-test.wav 79 80 # Record from a specific device (from `arecord -l`) 81 arecord -D hw:0,0 -d 5 -f cd /tmp/mic-test.wav 82 83 # Record via PipeWire default source 84 pw-record --target=@DEFAULT_SOURCE@ /tmp/mic-test.wav 85 # Ctrl+C after a few seconds, then: 86 pw-play /tmp/mic-test.wav 87 ``` 88 89 ─────────────────────────────────────────────────────────────────────────── 90 91 Check audio services are running 92 93 ```bash 94 systemctl --user status pipewire pipewire-pulse wireplumber 95 ``` 96 97 ─────────────────────────────────────────────────────────────────────────── 98 99 One-liner cheat sheet 100 101 ┌───────────────────┬─────────────────────────────────────────────────────┐ 102 │ Goal │ Command │ 103 ├───────────────────┼─────────────────────────────────────────────────────┤ 104 │ Full audio tree │ wpctl status │ 105 ├───────────────────┼─────────────────────────────────────────────────────┤ 106 │ List mics │ pactl list sources short │ 107 ├───────────────────┼─────────────────────────────────────────────────────┤ 108 │ List speakers │ pactl list sinks short │ 109 ├───────────────────┼─────────────────────────────────────────────────────┤ 110 │ Default mic │ pactl get-default-source │ 111 ├───────────────────┼─────────────────────────────────────────────────────┤ 112 │ Default output │ pactl get-default-sink │ 113 ├───────────────────┼─────────────────────────────────────────────────────┤ 114 │ Hardware mics │ arecord -l │ 115 ├───────────────────┼─────────────────────────────────────────────────────┤ 116 │ Hardware speakers │ aplay -l │ 117 ├───────────────────┼─────────────────────────────────────────────────────┤ 118 │ Test recording │ arecord -d 5 -f cd /tmp/test.wav && aplay │ 119 │ │ /tmp/test.wav │ 120 └───────────────────┴─────────────────────────────────────────────────────┘ 121 122 ============================================================================ 123 124 Turn off power-save / auto-turn-off for bluetooth earphone in linux: 125 126 echo 'ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="8087", ATTR{idProduct}=="0032", TEST=="power/control", ATTR{power/control}="on"' | sudo tee 127 /etc/udev/rules.d/50-bluetooth-no-autosuspend.rules 128 sudo udevadm control --reload-rules 129 echo on | sudo tee /sys/bus/usb/devices/5-7/power/control 130 131 132 The last line applies it immediately (no reboot); the udev rule makes it persist across reboots. Verify with: 133 134 cat /sys/bus/usb/devices/5-7/power/control # should say: on