[alsa-devel] 5.1 to stereo using libasound
Hi,
I am playing a mkv with 5.1 channels from a mkv. I configure libasound for 6 channels and I feed them interleave audio using snd_pcm_writei. I use the default pulse audio device.
So far, nothing is wrong. However, I do not ear things correctly. I listen this on my stereo speaker. There is no mixdown to stereo and I was wondering how to do that. I tried to use chmap api but anything I try on the default device returns an error.
I was wondering what was the correct way to do that? Using the mixing api? How do we detect that my device output stereo if chmap doesn't work?
I am on a ubuntu 18.04 linux box.
Thanks, Eric
On Sat, 2019-09-07 at 10:07 -0400, Eric Desjardins wrote:
Hi,
I am playing a mkv with 5.1 channels from a mkv. I configure libasound for 6 channels and I feed them interleave audio using snd_pcm_writei. I use the default pulse audio device.
So far, nothing is wrong. However, I do not ear things correctly. I listen this on my stereo speaker. There is no mixdown to stereo and I was wondering how to do that. I tried to use chmap api but anything I try on the default device returns an error.
I was wondering what was the correct way to do that? Using the mixing api? How do we detect that my device output stereo if chmap doesn't work?
I am on a ubuntu 18.04 linux box.
The pulse plugin takes your audio and sends it to PulseAudio without any modification. The ALSA API doesn't allow the application to tell the channel map of the stream, so if you send 6 channels, the pulse plugin assumes that you are using the default 5.1 channel map (front- left,front-right,rear-left,rear-right,front-center,lfe).
The PulseAudio daemon then downmixes the audio to stereo in some way (the details depend on PulseAudio configuration). You can't detect from your ALSA application whether the device that PulseAudio is using is a stereo device or something else.
Since it's apparently not working as you expect, does your application use the default 5.1 channel map that I mentioned above? Is PulseAudio configured to do remixing ("pulseaudio --dump-conf" should show "enable-remixing = yes")?
Thanks, my file didn't use the default channel map. Where are the defaults are defined?
Many thanks! Eric
Le dim. 8 sept. 2019 à 03:48, Tanu Kaskinen tanuk@iki.fi a écrit :
On Sat, 2019-09-07 at 10:07 -0400, Eric Desjardins wrote:
Hi,
I am playing a mkv with 5.1 channels from a mkv. I configure libasound
for
6 channels and I feed them interleave audio using snd_pcm_writei. I use
the
default pulse audio device.
So far, nothing is wrong. However, I do not ear things correctly. I
listen
this on my stereo speaker. There is no mixdown to stereo and I was wondering how to do that. I tried to use chmap api but anything I try on the default device returns an error.
I was wondering what was the correct way to do that? Using the mixing api? How do we detect that my device output stereo if chmap doesn't work?
I am on a ubuntu 18.04 linux box.
The pulse plugin takes your audio and sends it to PulseAudio without any modification. The ALSA API doesn't allow the application to tell the channel map of the stream, so if you send 6 channels, the pulse plugin assumes that you are using the default 5.1 channel map (front- left,front-right,rear-left,rear-right,front-center,lfe).
The PulseAudio daemon then downmixes the audio to stereo in some way (the details depend on PulseAudio configuration). You can't detect from your ALSA application whether the device that PulseAudio is using is a stereo device or something else.
Since it's apparently not working as you expect, does your application use the default 5.1 channel map that I mentioned above? Is PulseAudio configured to do remixing ("pulseaudio --dump-conf" should show "enable-remixing = yes")?
-- Tanu
On Sun, 2019-09-08 at 08:54 -0400, Eric Desjardins wrote:
Thanks, my file didn't use the default channel map. Where are the defaults are defined?
(Sorry, I forgot to reply to this earlier.)
I don't actually know where the ALSA default channel map is defined in the ALSA code or documentation (my impression is that it's not documented at all). In PulseAudio code it's defined here: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/blob/master/src/pulse/c...
participants (2)
-
Eric Desjardins
-
Tanu Kaskinen