PulseAudio

Wiki.TerraBase.info
Jump to navigation Jump to search

General Information

Command Line (for testing)

/usr/bin/pulseaudio --system --disallow-exit --disable-shm --exit-idle-time=-1 -vvvvvv --log-level=debug --verbose

Hardware

LEAGY Brand USB 7.1 Surround Sound Audio Device from Amazon (and AliExpress)
LEAGY Brand USB 7.1 Surround Sound Audio Device from Amazon (and AliExpress)

CM6206-LX based CMedia Chipset sold by LEAGY

This thing is funky. The output jacks are not grouped in 5.1 and 7.1 order where Side Left and Side Right are normally at the far right.

For 5.1 Surround Sound Output;

  • Front L/R (GN)
  • Side L/R (BK)
  • C/SUB (OR)
  • ...notice how the "7.1" Rear L/R "Rear Suround" is in-between the Side L/R and C/SUB, which is different from every other manufacturer.
  • In Windows, everything tests just fine, with outputs matching labels (oh, the latest CMedia driver for the CMedia CM6206 doesn't seem to work at all for Windows 11, so just use the circa 2023 Microsoft Driver)
  • For Linux, it's a bit off using speaker-test (Example: speaker-test -D hw:0,0 -c 8 -t wav)
    • There are two Side Rights and two Side Lefts (with no mention of Rear Left or Rear Right)

For 7.1 Surround Sound Output;

It gets "better". When testing with MPD / MPC, the following weird stuff happened;

A good question to ask (and good point to make): Why is the module-alsa-source and module-loopback being loaded when the module-alsa-sink all by itself should be able to play MPD output? Well, it turns out, with this device nothing plays at all. For whatever reason this device (unlike others), does not trigger pulseaudio to automatically create the protocol-native.c input-sink.

For the following configuration in system.pa, attempting to use Surround Sound 5.1, and using a 2 channel stereo audio file;

load-module module-alsa-sink device=surround51:CARD=ICUSBAUDIO7D,0 sink_name=alsa_output.0.surround.51
load-module module-alsa-source device=hw:0,0 source_name=alsa_input.0.analog-stereo
load-module module-loopback source=alsa_input.0.analog-stereo sink=alsa_output.0.surround.51 latency_msec=800

...the above outputs audio to the following jacks: Front L/R, Side L/R, and C/SUB. Cool

But for the following configuration in system.pa, attempting to use Surround Sound 7.1, still using a 2 channel stereo audio file;

load-module module-alsa-sink device=surround71:CARD=ICUSBAUDIO7D,0 sink_name=alsa_output.0.surround.71
load-module module-alsa-source device=hw:0,0 source_name=alsa_input.0.analog-stereo
load-module module-loopback source=alsa_input.0.analog-stereo sink=alsa_output.0.surround.71 latency_msec=800

...it outputs a continuous stream of: "I: [alsa-sink-USB Audio] module-loopback.c: Adding 2561 usec of silence to queue" and does NOT play any audio.

OK, maybe the issue relates to the input / source device (Spoiler Alert: It does), so let's try a slightly different configuration;

For the following configuration in system.pa, attempting to use Surround Sound 7.1, and still using the 2 channel stereo audio file;

load-module module-alsa-sink device=surround71:CARD=ICUSBAUDIO7D,0 sink_name=alsa_output.0.surround.71
load-module module-alsa-source device=hw:0,0 source_name=alsa_input.0.analog-stereo
load-module module-loopback source=alsa_input.0.analog-stereo sink=alsa_output.0.surround.71 latency_msec=800

...it outputs about fiftyish similar lines: "I: [alsa-sink-USB Audio] module-loopback.c: Adding 2561 usec of silence to queue", then this line: I: [alsa-sink-USB Audio] module-loopback.c: Dropping 37581 usec of audio from queue, and plays audio!

Oh, wait! With the above configuration, it outputs to the following Physical Jacks: Front L/R, Rear L/R, C/SUB, and... Nope, that's it. Nothing comes out of the Side L/R Channel. Woof!


But wait, it gets weirder

For the following configuration in system.pa, attempting to use Surround Sound 7.1, but now using a full 8 channel audio file (double quadraphonic???);

load-module module-alsa-sink device=surround51:CARD=ICUSBAUDIO7D,0 sink_name=alsa_output.0.surround.51
load-module module-alsa-source device=hw:0,0 source_name=alsa_input.0.analog-stereo
load-module module-loopback source=alsa_input.0.analog-stereo sink=alsa_output.0.surround.51 latency_msec=800

...the above outputs audio to the following jacks: Front L/R, Side L/R, Rear L/R, and C/SUB. Cool. Wait! What? Yup, it plays out of all 8 channels (4 physical jacks). And even better, it also plays a 6 channel version of the audio file out of all the same channels and jacks. And no, didn't attempt to make an 8 channel version of the file with muted / blank channels as things are already confusing enough.


...well, it never claimed to be Linux Compatible! Is there a workaround? Let's try a "Remap Module"!

Sinks (Outputs), Sources (Inputs), Input-Sinks ("Connectors")

Sinks: Equivalent to Speaker Out, Line Out, Head Phone Jacks, etc.

Sources: Equivalent to Microphone, Line In, etc.

Input-Sinks: Equivalent to wires connecting Sources to Sinks internally via Software

Fun Facts and Observations

Sink-Inputs

Example 1;

System.pa Configuration (AKA "Circumstances");

load-module module-native-protocol-unix

load-module module-alsa-sink device=surround51:CARD=ICUSBAUDIO7D,0 sink_name=alsa_output.0.surround.51

Commands: pactl list sinks short , pactl list sources short , and pactl list sink-inputs short

pactl list sinks short
1       alsa_output.0.surround.71       module-alsa-sink.c      s16le 8ch 48000Hz       IDLE

pactl list sources short
1       alsa_output.0.surround.71.monitor       module-alsa-sink.c      s16le 8ch 48000Hz       IDLE

pactl list sink-inputs short
...just for clarity, the output from the above command was blank / nothing.
Example 2;

System.pa Configuration (AKA "Circumstances");

load-module module-native-protocol-unix

load-module module-alsa-sink device=surround51:CARD=ICUSBAUDIO7D,0 sink_name=alsa_output.0.surround.51
load-module module-alsa-source device=hw:0,0 source_name=alsa_input.0.analog-stereo
load-module module-loopback source=alsa_input.0.analog-stereo sink=alsa_output.0.surround.51 latency_msec=800

Play a file using MPD / MPC or "PulseAudio Play": paplay --device=alsa_output.0.surround.51 BeeGees.wav Commands: pactl list sinks short , pactl list sources short , and pactl list sink-inputs short

pactl list sinks short
1       alsa_output.0.surround.71       module-alsa-sink.c      s16le 8ch 48000Hz       IDLE

pactl list sources short
1       alsa_output.0.surround.71.monitor       module-alsa-sink.c      s16le 8ch 48000Hz       IDLE

pactl list sink-inputs short
4       1       10      protocol-native.c       s24-32le 2ch 44100Hz
(previous output from other USB Audio Device: 2       1       5       protocol-native.c       s16le 2ch 44100Hz)

*Note(s): If using paplay, another SSH session must be used for the pactl command. If using MPC, once started play can be stopped and the MPD Daemon will maintain the existence of the 'protocol-native.c' sink-inputs.

0       1       -       module-loopback.c       s16le 2ch 48000Hz
2       1       5       protocol-native.c       s16le 2ch 44100Hz