How to separe ports into different devices on pulseaudio?

I was trying to use one of my sound card’s entry port to record in one aplication and another port in other application. The problem is, I can’t.

On Windows in example we have separated devices, but on Pulseaudio we only have one device which we need to select either one port or the other. Imagine the blue and pink entries of a computer. One is Line in, other is Microphone in. I need to use them separately, but they are in the same option (the Internal Analog Stereo Audio).

I wonder if I can duplicate my sound card in two and use a different port in each one, but I don’t know how to do this… How could I use the 2 ports into 2 different pulseaudio devices?

Welcome to Manjaro

PulseAudio automatic detection of the audio card only allows one port at a time for audio capture, but PulseAudio can be reconfigured to load audio inputs and outputs independently

If you were able to use two capture inputs on another OS, you should have 2 capture sub-devices in ALSA for analog audio
Please post the response to this command to show ALSA inputs and outputs

arecord -l && aplay -l

And this to show the current PulseAudio configuration

pacmd dump

This is arecord -l && aplay -l output:

arecord -l && aplay -l

**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 2: ALC887-VD Alt Analog [ALC887-VD Alt Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: DigitalCamera [Digital_Camera], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC887-VD Analog [ALC887-VD Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 11: HDMI 5 [HDMI 5]
Subdevices: 1/1
Subdevice #0: subdevice #0

And this is pacmd dump

pacmd dump

Configuration dump generated at Mon Mar 1 13:02:45 2021

load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
load-module module-augment-properties
load-module module-switch-on-port-available
load-module module-udev-detect
load-module module-alsa-card device_id=“1” name=“pci-0000_01_00.1” card_name=“alsa_card.pci-0000_01_00.1” namereg_fail=false
tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties=“module-
udev-detect.discovered=1”
load-module module-alsa-card device_id=“2” name=“usb-PixArt_Imaging_Inc.Digital_Camera-02" card_name="alsa_card.usb-PixArt
Imaging_Inc._Digital_Camera-02” namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_uc
m=yes avoid_resampling=no card_properties=“module-udev-detect.discovered=1”
load-module module-alsa-card device_id=“0” name=“pci-0000_00_1f.3” card_name=“alsa_card.pci-0000_00_1f.3” namereg_fail=false
tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties=“module-
udev-detect.discovered=1”
load-module module-jackdbus-detect channels=2
load-module module-bluetooth-policy
load-module module-bluetooth-discover
load-module module-bluez5-discover
load-module module-dbus-protocol
load-module module-native-protocol-unix
load-module module-gsettings
load-module module-default-device-restore
load-module module-always-sink
load-module module-intended-roles
load-module module-suspend-on-idle
load-module module-console-kit
load-module module-systemd-login
load-module module-position-event-sounds
load-module module-role-cork
load-module module-filter-heuristics
load-module module-filter-apply
load-module module-cli-protocol-unix

set-sink-volume alsa_output.pci-0000_00_1f.3.analog-stereo 0x10000
set-sink-mute alsa_output.pci-0000_00_1f.3.analog-stereo no
suspend-sink alsa_output.pci-0000_00_1f.3.analog-stereo no

set-source-volume alsa_input.usb-PixArt_Imaging_Inc._Digital_Camera-02.mono-fallback 0x000
set-source-mute alsa_input.usb-PixArt_Imaging_Inc._Digital_Camera-02.mono-fallback yes
suspend-source alsa_input.usb-PixArt_Imaging_Inc._Digital_Camera-02.mono-fallback yes
set-source-volume alsa_output.pci-0000_00_1f.3.analog-stereo.monitor 0x10000
set-source-mute alsa_output.pci-0000_00_1f.3.analog-stereo.monitor no
suspend-source alsa_output.pci-0000_00_1f.3.analog-stereo.monitor no
set-source-volume alsa_input.pci-0000_00_1f.3.analog-stereo 0x599a
set-source-mute alsa_input.pci-0000_00_1f.3.analog-stereo no
suspend-source alsa_input.pci-0000_00_1f.3.analog-stereo no

set-card-profile alsa_card.pci-0000_01_00.1 off
set-card-profile alsa_card.usb-PixArt_Imaging_Inc._Digital_Camera-02 input:mono-fallback
set-card-profile alsa_card.pci-0000_00_1f.3 output:analog-stereo+input:analog-stereo

set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo
set-default-source alsa_input.pci-0000_00_1f.3.analog-stereo

EOF

To reconfigure PulseAudio modules, first copy the module configuration file to your home folder
(If there are any problems, you can delete the new configuration file and revert to the original system file and default settings)

cp /etc/pulse/default.pa ~/.config/pulse/default.pa

Then open the new file in a text editor (Iuse nano as an example but any text editor you have will do

nano ~/.config/pulse/default.pa

Find this section (line 35-40) and add the static sinks and sources

### 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 hw:PCH,0 name='Output'
load-module module-alsa-source hw:PCH,0 name='Microphone'
load-module module-alsa-source hw:PCH,1 name='Line'
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input

And then comment out the sections for module-udev-detect and module-detect with a #
(Lines 46-48 and 50-51)

### 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

Save the file and exit the text editor

Then restart PulseAudio to load the new configuration

systemctl --user restart pulseaudio

PulseAudio will not show any complete audio cards or profiles, but should show the 2 input sources and 1 output sink

1 Like

This didn’t worked… there is no audio or recording devices now in my computer… What to do?

1 Like

Just figured out. Your code was like this:

load-module module-alsa-sink hw:PCH,0 name=‘Output’

But It should be like this, with no parenthesis at all:

load-module module-alsa-sink hw:PCH,0 name=output

Thanks for the quick reply, you just gave me a light to guess what to do :slight_smile: !

UPDATE!

I had some problems with the settings I did, so I just searched a bit, and nothing special.

So I found ALSA commands, which 2 of them @nikgnomic sent me, and I just messed a bit with alsamixer, to figure out that the settings on the capture devices were wrong.

When doing the steps above, please, DON’T forget to use alsamixer command to set the outputs correctly!

If you use alsamixer -c0 --view=all to adjust ALSA settings, do not forget to save the changes to ALSA:

sudo alsactl store

I had to wait on my OH going to work so I could check ALC887-VD settings on her system

Microphone input can be set to hw:PCH,0 with commands like this:

amixer -c0 sset 'Input Source',0 'Rear Mic'
amixer -c0 sset 'Capture',0 32 cap

Level setting of 32 in the 2nd command should set the capture level to 70% 16.0dB

and to set the Line input set to hw:PCH,1

amixer -c0 sset 'Input Source',1 'Line'
amixer -c0 sset 'Capture',0 16 cap

level setting of 16 should set the capture level to 0.0dB

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.