[pulseaudio-discuss] Emulate Alsa A52 plugin in pulseaudio ?
Jim Duda
jim at duda.tzo.com
Thu Feb 28 18:57:31 PST 2008
The first thing I need to do is to get the spdif port on my CMPCI to
work with pulseaudio. I'm finding that defining an alsa-sink manually
using device surround51 doesn't work, I don't get any audio.
Allowing pulseaudio to auto-detect does allow audio to work, but only
with 2 channels.
With auto-detection load-module module-detect, I get:
*** Sink #0 ***
Name: alsa_output.hw_0
Driver: modules/module-alsa-sink.c
Description: ALSA PCM on hw:0 (C-Media PCI DAC/ADC)
Sample Specification: s16le 2ch 44100Hz
Channel Map: front-left,front-right
Owner Module: 0
Volume: muted
Monitor Source: 0
Latency: 59501 usec
Flags: HW_VOLUME_CTRL LATENCY HARDWARE
This above gives me stereo only through the spdif port.
If I used anything besides nothing or channels=2, I don't get any audio.
Jim
Jim Duda wrote:
> Unfortunately, using a52encode as a device doesn't seem to work. I
> tried by a52encode and a52.
>
> lroom# /usr/bin/pulseaudio --system
> ALSA lib control.c:909:(snd_ctl_open_noupdate) Invalid CTL surround51:0
> W: alsa-util.c: Unable to attach to mixer surround51:0: No such file or
> directory
> ALSA lib pcm.c:2144:(snd_pcm_open_noupdate) Unknown PCM a52encode
> E: module-alsa-sink.c: Error opening PCM device a52encode: No such file
> or directory
> E: module.c: Failed to load module "module-alsa-sink" (argument:
> "sink_name=ac3_encode device=a52encode rate=48000 channels=6"):
> initialization failed.
> E: main.c: Module load failed.
> E: main.c: failed to initialize daemon.
>
> lroom# /usr/bin/pulseaudio --system
> ALSA lib control.c:909:(snd_ctl_open_noupdate) Invalid CTL surround51:0
> W: alsa-util.c: Unable to attach to mixer surround51:0: No such file or
> directory
> ALSA lib pcm.c:2144:(snd_pcm_open_noupdate) Unknown PCM a52
> E: module-alsa-sink.c: Error opening PCM device a52: No such file or
> directory
> E: module.c: Failed to load module "module-alsa-sink" (argument:
> "sink_name=ac3_encode device=a52 rate=48000 channels=6"): initialization
> failed.
> E: main.c: Module load failed.
> E: main.c: failed to initialize daemon.
>
> default.pa:
>
> load-module module-alsa-sink sink_name=ac3_raw device=surround51:0
> rate=48000 channels=6
> load-module module-alsa-sink sink_name=ac3_encode device=a52encode:0
> rate=48000 channels=6
>
> .asoundrc
>
> pcm.a52encode {
> type a52
> }
>
> pcm.front-spdif {
> type plug
> slave.pcm "iec958"
> }
>
> pcm.ac3_raw {
> type pulse
> device ac3_raw
> }
>
> pcm.ac3_encode {
> type pulse
> device ac3_encode
> }
>
>
>
>
> Jim Duda wrote:
>> Tanu,
>>
>> Okay, what you are describing makes sense. We route the 6 channels back through alsa and the a52 encoding, then out the
>> actual device driver.
>>
>> The front-spdif was leftover stuff in my asoundrc file.
>>
>> I also need to send the raw AC3, DTS stream from some applications to the external digital decoder (mplayer and xine).
>> Currently, I do this by using alsa:device=spdif in the applications which require this mode, instead of the stereo
>> upmix.
>>
>> So, to accomplish this, do I define two alsa-sinks?
>>
>> module-load module-alsa-sink sink_name=ac3_out device=a52encode channels=6 rate=48000
>> module-load module-alsa-size sink_name=ac3_raw device=surround51:0
>>
>> Then my .asoundrc has this:
>>
>> pcm.!default {
>> type pulse
>> device ac3_out
>> }
>>
>> pcm.passthrough {
>> type pulse
>> device ac3_raw
>> }
>>
>> pcm.a52encode {
>> type a52
>> }
>>
>> The default would do stereo upmix from 2 to 6 channels through a52 encoder.
>>
>> The passthrough would send the raw ac3/dts stream out the hardware.
>>
>> Does this make sense? (I would test now, but I have to go off and build 0.9.8 first, since FC7 uses 0.9.6 currently).
>>
>> Thanks,
>>
>> Jim
>>
>>
>> "Tanu Kaskinen" <tanuk at iki.fi> wrote in message news:20080228205506.GA11317 at a9a.mannikko1.tontut.fi...
>>> On Thu, Feb 28, 2008 at 03:09:45PM -0500, Jim Duda wrote:
>>>> I would like to use pulseaudio on a machine which I have the sound card attached to an digital decoder. I'm using
>>>> the
>>>> alsa A52 plugin to perform a stereoupmix from 2 channels to six channels such that I get the same stereo out of the
>>>> front and rear speakers.
>>>> Can I use the remap module to copy 2 channels to 4? The front speaker and sub woofer would be nice too.
>>> Yes you can, but there shouldn't be need for that. Since
>>> 0.9.8 PulseAudio has supported automatic up- and downmixing,
>>> which probably does what you want. If you have 0.9.8 and it
>>> still doesn't work, check that you haven't disabled the
>>> feature in daemon.conf by saying disable-remixing=yes.
>>>
>>> If I've understood your setup correctly, you would need to
>>> encode the output of PulseAudio to AC-3. I don't have any
>>> experience in that field, so the following is just my best
>>> guess how it would work:
>>>
>>> Your new ~/.asoundrc:
>>>
>>> pcm.!default {
>>> type pulse
>>> }
>>>
>>> pcm.a52encode {
>>> type a52
>>> }
>>>
>>> # What's this for?
>>> pcm.front-spdif {
>>> type plug
>>> slave.pcm "iec958"
>>> }
>>>
>>>
>>> Comment out module-hal-detect and module-detect in
>>> /etc/pulse/default.pa. Add this line instead:
>>> module-load module-alsa-sink sink_name=ac3_out device=a52encode channels=6 rate=48000
>>>
>>> --
>>> Tanu Kaskinen
More information about the pulseaudio-discuss
mailing list