Bor*_*kov 17 alsa audio pulseaudio
我想在 ALSA 中做一件最简单的事情:让 USB 耳机产生声音,而不是平板电脑的内置扬声器。我不想更改配置文件,例如asound.rcoralsa.conf或asound.conf并通过更改设备的顺序将耳机永久设置为默认输出设备,我想要一个临时效果,直到我拔掉耳机。奇怪的是,我无法用谷歌搜索答案。有alsamixer能力做到这一点(似乎没有)?
在 Gnome 中,您可以PulseAudio在 GUI 或 CLI 界面中使用 轻松选择当前输出设备,但PulseAudio它本身在 ALSA 之上工作!所以我也想知道,它是如何强制 ALSA 更改输出设备的?
如果 USB 设备在系统中被列为声卡,您可能需要检查man amixer并使用unmute参数。
amixer -c 1 set Master playback 100% unmute\nRun Code Online (Sandbox Code Playgroud)\n\n还要检查其他通道(PCM 等)。手册中的示例是:
\n\n amixer -c 1 sset Line,0 80%,40% unmute cap\n will set the second soundcard\'s left line input volume to 80% and right line\n input to 40%, unmute it, and select it as a source for capture (recording).\n\n amixer -c 1 -- sset Master playback -20dB\n will set the master volume of the second card to -20dB. If the master has\n multiple channels, all channels are set to the same value.\n\n amixer -c 1 set PCM 2dB+\n will increase the PCM volume of the second card with 2dB. When both play\xe2\x80\x90\n back and capture volumes exist, this is applied to both volumes.\n\n amixer -c 2 cset iface=MIXER,name=\'Line Playback Volume",index=1 40%\n will set the third soundcard\'s second line playback volume(s) to 40%\n\n amixer -c 2 cset numid=34 40%\n will set the 34th soundcard element to 40%\nRun Code Online (Sandbox Code Playgroud)\n