Trying to change PulseAudio application sink/source from command line

5,567

Other than canging the default sink we can move a sink input or a source output to another sink or source using pactl (or pacmd).

move-sink-input ID SINK
Move the specified playback stream (identified by its numerical index) to the specified sink (identified by its symbolic name or numerical index).

move-source-output ID SOURCE
Move the specified recording stream (identified by its numericalindex) to the specified source (identified by its symbolic name or numerical index).

To list existing streams we can issue

pactl list sink-inputs
pactl list source-outputs

These can then be moved by index to another location given by index (or name), e.g.

pactl move-sink-input 5 1

Also see How to change pulseaudio sink with "pacmd set-default-sink" during playback? for using pacmd.

Share:
5,567

Related videos on Youtube

Aurelius
Author by

Aurelius

Updated on September 18, 2022

Comments

  • Aurelius
    Aurelius over 1 year

    I have two applications on startup, which I link together with loopbacks and null sinks. Everything works great, except everytime I start them I have to open pavucontrol and manually change the sink/source for each application. I know there is a command to change the default sink, but that doesn't help. I want to be able to assign a sink or source to each application's input and output without opening pavucontrol. There is obviously a way to do this (as pavucontrol is doing behind the scenes) I just can't find any documentation or anyone else who has done this before.

    Images to demonstrate:

    PulseAudio This is the setting I want to change.

  • Aurelius
    Aurelius over 7 years
    I did discover these commands when reading man pactl. The problem is, will these applications have the same index value every time they are started? I highly doubt it. I don't understand why other arguments to pactl can take the name of the stream as an argument, but these two cannot. I was thinking perhaps use grep or awk to deterime the index based on pactl list... but I am not well versed in either of those tools.
  • Takkat
    Takkat over 7 years
    No, the index will change with each stream on a given sink/source.