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
)