Linux 如何在ubuntu中手动选择音频的输出设备?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5972932/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 04:02:33  来源:igfitidea点击:

How to select the output device of audio in ubuntu manually?

linuxubuntu

提问by user749816

In Ubuntu, we can select the output device of audio in sound preferences. But now I want to write a shell script, so I need to select the output device from the commandline.

在Ubuntu中,我们可以在声音首选项中选择音频的输出设备。但是现在我想写一个shell脚本,所以我需要从命令行中选择输出设备。

采纳答案by Tobias

You can first view your current default audio device by typing:

您可以首先通过键入以下内容查看您当前的默认音频设备:

pactl stat 

And with

pactl list

you can view all your devices.

您可以查看所有设备。

And with this command

并使用此命令

echo "set-default-sink alsa_output.Headset" | pacmd

you can set the default device.

您可以设置默认设备。

But I found a much better source for this problem and a included little shell script for this problem here http://ubuntuforums.org/archive/index.php/t-1370383.html

但是我在这里找到了一个更好的解决这个问题的来源,并在这里找到了一个包含这个问题的小 shell 脚本http://ubuntuforums.org/archive/index.php/t-1370383.html