5

I'm using pavucontrol to make changes in the "Recording". I'm changing the source (??) of a Loopback to Null-Output from "Internes Audio Analog Stereo" to "Monitor of Internes Audio Analog Stereo" see the screenshot http://picpaste.de/Bildschirmfoto_vom_2013-10-26_11_32_03-z0KwnFDE.png I'm now looking for a possibility to do this via command line.

So far I've done the following:

pactl load-module module-null-sink

→ creates a new sink

pactl load-module module-loopback

→ creates a new sink input

pactl load-module module-loopback

→ creates another sink input

pacmd move-sink-input 0 1

→ changes the sink of the sink-input (to Null-Output); this is like changing manually in the pacucontrol tab "Playback".

It's just the last part (making the change like shown in the screenshot) via command line that I'm not able to do.

I'd be very happy for any advice or suggestions. Thanks already!

1
  • I found a solution. The command I was looking for is pacmd move-source-output in my case it was pacmd move-source-output 0 0 (because the source-output-index is 0 and the source-index is 0 as well) This command does exactly what was shown in the postet screenshot - changing the source in the pavucontrol tab "Recording"
    – Mojo
    Oct 27, 2013 at 9:39

2 Answers 2

2

The command to change the default input source of pulseaudio is pacmd set-default-source. By this we can also define a monitor of an output sink as a source by adding .monitor at the end of the sink name.

This will then give us the following command:

pacmd set-default-source <name_of_sink>.monitor

We may also have to move an active stream to the new source using move-sink-input.

1

In my case I wanted to record a voice message using heavy distortion, but as soon as I switched to the pavucontrol window the recording stopped. So I had to resort to the command line.

This command did the trick:

pacmd move-source-output $(pacmd list-source-outputs | tr '\n' '\r' | perl -pe 's/ *index: ([0-9]+).+?media\.name = "([^\r]+)"\r.+?(?=index:|$)/\2:\1\r/g' | tr '\r' '\n' | awk -F ":" '/AudioCallbackDriver/ {print $2}') null.monitor

(for reference, the syntax is pacmd move-source-output <source output index> <source name or index>.)

I scripted it after a call to sleep to give me time to start the recording.

Special thanks to this answer on Stack Overflow: Look up pulseaudio sink-input index by property, and to Takkat's answer above that, while not a proper solution, pointed me in the right direction.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .