[pulseaudio-discuss] ALSA -> pulseaudio channel mapping, what is it (and why?)
frederik at ofb.net
frederik at ofb.net
Fri May 3 18:05:21 UTC 2019
Dear ALSA developers,
I ran into a problem which seems to be caused by some lines in
"alsa-plugins-1.1.8/pulse/pcm_pulse.c".
The problem is that if I create a 6-channel PulseAudio device, and
then I configure an ALSA device in ~/.asoundrc to output to the
PulseAudio device, the channels of the ALSA device are mixed together
in various ways and don't correspond 1-1 with the channels of the
PulseAudio device.
I find this to be counter-intuitive. If I wanted channels to be mixed
and remapped in various ways, I would use the PulseAudio module
module-remap-sink on the PulseAudio side, since AFAICT ALSA does not
support named channels. I would not expect remixing to happen in the
ALSA->Pulse bridge, since the relevant PCM plugin contains no channel
map parameter.
I don't even know what channel map I should give the PulseAudio device
in order to prevent remixing from occurring. The file pcm_pulse.c
contains the lines:
for (c = pcm->ss.channels; c > 0; c--)
if (pa_channel_map_init_auto(&map, c, PA_CHANNEL_MAP_ALSA))
break;
This refers to a macro in /usr/include/pulse/channelmap.h:
/** \cond fulldocs */
PA_CHANNEL_MAP_ALSA,
/**< The default mapping used by ALSA. This mapping is probably
* not too useful since ALSA's default channel mapping depends on
* the device string used. */
/** \endcond */
The comment says that the ALSA mapping is "not too useful" - so why
are we using it? Also, how do I find out what it is, if it "depends on
the device string used"?
My preference would simply be to have a 1-1 channel map in pcm_pulse,
so that a PulseAudio device with 6 channels will turn into an ALSA
device with THE SAME 6 CHANNELS. No mixing. Mixing is confusing in
this context, and seems undocumented outside of the code.
I tried using aux0 thru aux5 as the PulseAudio channel map, to prevent
geometry-based remixing. However, this results in silence - apparently
none of the 6 ALSA channels end up going anywhere. That was also
unexpected. Since I am playing 6-channel audio to a 6-channel device,
which emulates another 6-channel device, I would have thought that the
channel mapping wouldn't be complicated. Instead, it appears that the
PulseAudio sink needs to have channels with specific names in order to
receive data from ALSA.
Can we fix this, or improve the user experience?
Thanks,
Frederick
More information about the pulseaudio-discuss
mailing list