1

我想制作一个 shell 脚本来记录程序的声音并将其作为 linux 上的麦克风条目。

例如,我正在 youtube 上听音乐,我希望将音乐发送到我的 Skype 对话而不是我的声音。

最后但并非最不重要的一点是,我知道如何使用 pavucontrol,我必须转到“录制”并切换“录制流自”,但我想从命令行执行完全相同的操作,而不是使用桂。

我试过这个:

pactl load-module module-loopback source=1 sink=2

(其中 1 是我的桌面声音,2 是模拟立体声双工(但它还包括我输入之上的正常声音......)并且它没有按预期工作。我不知道该怎么做。

谢谢

4

1 回答 1

1

module-loopback can only be used to short-circuit sources to sinks. (i.e. mic to speaker.) The switch you found in pavucontrol can be accessed from the command line via

 pactl move-source-output <source output> <source>

You can get the source output ID via

pactl list source-outputs

while a program is recording, and a list of sources using

pactl list sources

You can also supply the source by name, e.g. combined.monitor.

I just tried it with mplayer and audacity and noticed two pitfalls:

  • If the monitor is stereo and your default source is mono, applications might not like being rerouted. You can use module-remap-source to work around that: Remap the monitor to one mono channel and move the source output to the newly created remapped source.
  • You might need to unmute the monitor device in pavucontrol before this works. From the command line this can be done using pactl set-source-mute. (See man pactl)
于 2014-03-24T19:33:34.453 回答