Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: frederik@ofb.net
To: alsa-devel@alsa-project.org
Cc: pulseaudio-discuss@lists.freedesktop.org, georg@chini.tk
Subject: ALSA -> pulseaudio channel mapping, what is it (and why?)
Date: Fri, 3 May 2019 11:05:21 -0700	[thread overview]
Message-ID: <20190503180521.gtfv64hel5427dx7@localhost> (raw)

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

             reply	other threads:[~2019-05-03 18:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 18:05 frederik [this message]
2019-05-06 11:04 ` [alsa-devel] ALSA -> pulseaudio channel mapping, what is it (and why?) Tanu Kaskinen
2019-05-07  0:48   ` frederik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190503180521.gtfv64hel5427dx7@localhost \
    --to=frederik@ofb.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=georg@chini.tk \
    --cc=pulseaudio-discuss@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox