4

pactl list sources shows that there is a source which has multiple ports:

Ports:
    analog-input-front-mic: Front Microphone (priority: 8500, not available)
    analog-input-rear-mic: Rear Microphone (priority: 8200, available)
    analog-input-linein: Line In (priority: 8100, available)

I would like to split these ports into separate sources so that I can loopback and mix them together for output in a single sink using the command:

pactl load-module module-loopback source=whatever sink=whatever

The module-remap-source does not appear to be able to do what I seek, unless I'm missing something.

Without separate sources I'm stuck with manually switching the ports using the pavucontrol interface which only allows one port at a time to be active for a given source.

Running Debian Stretch with LXDE.

The same setup can be achieved easily in both Windows 7 and Debian Jessie with XFCE4, where the xfce4-mixer GUI shows separate audio sliders for each input and all I had to do was turning up the line-in and rear-mic sliders to hear both of them mixed on the default output (in that case, my headphones).

This is the result of cat /proc/asound/pcm:

00-00: ALC887-VD Analog : ALC887-VD Analog : playback 1 : capture 1
00-02: ALC887-VD Alt Analog : ALC887-VD Alt Analog : capture 1
01-03: HDMI 0 : HDMI 0 : playback 1
01-07: HDMI 1 : HDMI 1 : playback 1
01-08: HDMI 2 : HDMI 2 : playback 1
02-00: USB Audio : USB Audio : playback 1 : capture 1

This is the result of cat /proc/asound/card*/codec\#*:

https://pastebin.com/yusn4hJP

UPDATE:

I have since dodged this problem by purging pulseaudio and pavucontrol entirely and using qasmixer (with Loopback Mixing and Show device selection enabled) directly on top of Alsa. This allows the same if not a greater degree of versatility than the now obsoleted xfce4-mixer. Other Alsa mixers which i don't like as much but are still worthy of a try are volti and alsamixergui.

Even if this solved my problem, it's however not a full answer to this question in particular, which is also about the possibility to split Pulseaudio ports into indipendent sources and how.

5
  • The question is if your soundcard has enough A/D converters to access all 3 simultanously in the first place. arecord -L can give hints for this. In any case, edit your question with lspci -nn or lsusb identification of your soundcards. If it's a HDA soundcard, put output of cat /proc/asound/card*/codec\#* into a pastebin and edit question with link. Even if it's possible with your hardware, the ALSA configuration will be a challenge, if it can be done at all.
    – dirkt
    Jun 24, 2017 at 17:35
  • Also look at cat /proc/asound/pcm.
    – dirkt
    Jun 24, 2017 at 20:02
  • @dirkt i know for certain that the soundcard has the capability to do it because i found it trivial to set up such a configuration in both win7 and jessie/xfce, but inexplicably hard in stretch/lxde which is the system i'm having trouble with. It's an HDA soundcard, Realtek ALC887-VD. Jun 24, 2017 at 22:50
  • Please edit question with output of cat /proc/asound/pcm. If that doesn't show three "Analog" capture sources (the second labelled "Alt Analog", I've never seen a third), edit question with output of cat /proc/asound/card*/codec\#* (or put it in a pastebin and give link). Please explain in detail in your question how you set it up on Jessie.
    – dirkt
    Jun 25, 2017 at 7:40
  • @dirkt Ok i added the info to the question, let me know if anything else is needed. Jun 25, 2017 at 20:05

2 Answers 2

1

You only have two A/D converters (Audio Input nodes), called "ALC887-VD Analog" and "ALC887-VD Alt Analog" by ALSA. So the best you could achieve on the software side is two sources, where you'd have to switch ports manually for both (as you are doing now for a single source). That's not trivial to set up, though, you have to fiddle with profiles and path in /usr/share/pulseaudio/alsa-mixer/profile-sets/, and manually unload and load Pulseaudio modules. I played around with it on my system, and I still haven't got a satisfying configuration.

However, if your goal is "I want to loopback hardware audio inputs into hardware audio outputs (headphone)" instead of "I want multiple Pulseaudio source, so I can loopback in Pulseaudio into whatever sinks", you can just use the hardware mixers (that's probably what you did in Windows 7 and xfce4-mixer).

So use alsamixer or amixer or a similar program to control hardware loopback settings, and it should work just as before.

2
  • Thank you for your patience. I would like to specify a few things however. I'm not using a hardware mixer in the sense of, for example, a DJ set with actual touchable knobs, wires and all that jazz. It's fine that my motherboard can't handle 3 inputs, two is enough as actually i keep unused one of them (the front one). I can accept that doing the port splitting is hard, but at least for now i would like to keep this question open just in case somebody else can come with a full answer to that specifically. I also added an update to the bottom of my question. Jul 14, 2017 at 12:26
  • 1
    What is inside the soundchip on your motherboard is called a "hardware mixer", even if it doesn't have actual touchable knobs, and the "knobs" are all controlled by software. All the software you are using where it "just works" (Windows 7, xfce4-mixer, qasmixer, and also alsamixer and amixer) controls those "hardware knobs" via software (the sliders you see). Pulseaudio, OTOH, is purely software (well, mostly, but I won't go into details), and that's why what you want doesn't work with Pulseaudio directly, or at least you can't control it from Pulseaudio.
    – dirkt
    Jul 14, 2017 at 12:56
1

I think, I have found a solution to your question here. The idea is as follows:

  1. Get a list of available ALSA sound cards and inputs:

    $ arecord -l
    **** List of CAPTURE Hardware Devices ****
    card 1: Generic [HD-Audio Generic], device 0: ALC887-VD Analog [ALC887-VD Analog]
      Subdevices: 0/1
      Subdevice #0: subdevice #0
    card 1: Generic [HD-Audio Generic], device 2: ALC887-VD Alt Analog [ALC887-VD Alt Analog]
      Subdevices: 0/1
      Subdevice #0: subdevice #0
    

    and notice the card and device numbers (in my example above there is card 1 and two input devices: device 0 and device 2).

  2. If you do not have a per-user PulseAudio config file, make a copy:

    cp /etc/pulse/default.pa ~/.config/pulse/default.pa and open your copy with simple text editor. Find the section related to static devices configuration and add the lines for your ALSA devices like this:

    ### Load audio drivers statically
    ### (it's probably better to not load these drivers manually, but instead
    ### use module-udev-detect -- see below -- for doing this automatically)
    #load-module module-alsa-sink
    #load-module module-alsa-source device=hw:1,0
    #load-module module-oss device="/dev/dsp" sink_name=output source_name=input
    #load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
    #load-module module-null-sink
    #load-module module-pipe-sink
    
    load-module module-alsa-sink device=hw:1,0 name="ALSAOutput"
    load-module module-alsa-source device=hw:1,0 name="ALSASource1" source_properties=device.description="ALSASource1"
    load-module module-alsa-source device=hw:1,2 name="ALSASource2" source_properties=device.description="ALSASource2"
    
    
    ### Automatically load driver modules depending on the hardware available
    #.ifexists module-udev-detect.so
    #load-module module-udev-detect
    #.else
    ### Use the static hardware detection module (for systems that lack udev support)
    #load-module module-detect
    #.endif
    

    In these lines you have to edit the parameter device=hw:1,0 according to your configuration. Here first number is the card number, and the second is the device number, which you must remember from the previous step.

    Please note that you also have to comment out the next section about the automatic driver loading with udev.

  3. Restart PulseAudio for your user:

    $ systemctl --user restart pulseaudio
    

Once you have done that, in pavucontrol you will see a single output device and two independent input devices:

enter image description here

enter image description here

Note that the input devices in pavucontrol have the names we assigned to them in our config file above (the parameter source_properties=device.description="ALSASource1"). This is a convenient way to assign the devices distinctive names.

  1. Next, to be able to use those inputs you have to actually assign the proper sources of sound to each of the ALSA inputs. For this I suggest you to start alsamixer in your console, choose the sound card by pressing F6, then press F4 to switch to the 'Capture' tab and assign the necessary inputs like this:

enter image description here

In my example I chose the Line in as the first input, and Front Mic as the second input.

You should also ensure these two capture devices are unmuted. To turn them on, just switch to the Capture and Capture 1 controls using the Left/Right arrow keys and press Spacebar. You will see the red word 'CAPTURE' appear when the device is ON.

So at this point you have two ports of a single device split into two separate devices in PulseAudio, and next you are free to do whatever you want with them using pavucontrol as usual. For example, to join the signal from these two sources, you may use this recipe.

To revert all these changes, you may edit back the ~/.config/pulse/default.pa file commenting out the new lines and uncommenting the old ones. Or you may simply delete this file. And then, restart PulseAudio again.

P.S. I believe there must be a smarter way to do this (for example, by creating a custom device profile for PulseAudio), but I am not familiar with that. Maybe someone else here could give a hint.

You must log in to answer this question.

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