[pulseaudio-discuss] "passthrough" audio (eg. AC3 / DTS / WM9)

Sean McNamara smcnam at gmail.com
Mon Oct 5 02:11:13 PDT 2009


Hi,

On Sun, Oct 4, 2009 at 11:30 PM, Dave Moore <davewantsmoore at gmail.com> wrote:
> Hi Everyone.  I'm really sorry if this has been covered before, I've read
> back through the past 6 months list history and found nothing.... and my OS
> (ubuntu) and application support forums/lists are not being very helpful.
>
>
> I would like to pass digital audio completely unaltered ("bit-stream") to my
> SPDIF output - Can this be done with pulseaudio?
>
>
>
> (Yes, I understand that I will lose sound mixing and the ability to have
> multiple application use the sound device)
>
>
> For example:
> If I have a stereo PCM file @ 16bit / 44.1khz  -  Then output at this type
> (do not resample in any way) ... or PCM @ 24bit / 96khz .... etc.   If I
> have AC3 / DTS @ 48khz - The output this original data exactly.
>
> (I am using an external decoder/processor and do not want the original audio
> data changed in any way).

I don't know of any way to pass arbitrary data unaltered through the
PA core with the current version. Everything is coded around PCM
sample formats. Of course, if the program sending audio to PA is using
the same PCM sample format as the sound card stream that PA has open
in its backend, then PA will have no reason to resample your data
(also assuming no other apps are playing sound at the same time). But
this doesn't address the general problem of supporting AC3, DTS, WM9,
or other native codecs.

I would surmise that PulseAudio is probably not for you if you want to
do this. There is no optional mixing in PulseAudio; everything is
mixed in software. I don't even know if PA has a way to tell client
applications "sorry, but the soundcard is being used excuslively by
another PA client right now". Unless we had some way to do software
mixing on other encodings like AC3 and WM9 (we'd have to code up
special cases of the mixing logic for _each_ supported format),
supporting arbitrary audio data formats would be eliminating the
usefulness of 99% of PA's existing modules and features, which expect
PCM samples.

As a matter of fact, it's relatively simple to write a daemon that
accepts UNIX socket or TCP connections, reads audio data supported by
a hardware decoder from the socket, and passes the data to ALSA. At
least, I think it would be easier to develop such a daemon from
scratch than it would be to modify PA to support what you're asking
for.

On the other hand, you might someday see the PA core extended to
support arbitrary audio data passthrough. I am not sure when this
might be done or who is working on it, or even whether anyone is
working on it.

This may not be what you want, but you _can_ use the ALSA plug layer
to do conversion between PCM and certain native codecs. See
http://ubuntuforums.org/showthread.php?t=776958 for discussion of how
to do it with S/PDIF. If you set this up, PulseAudio will be able to
talk to digital sound hardware (such as S/PDIF or other hardware
codecs you may have) using PCM samples. What will happen is that
PulseAudio talks to alsa-lib in PCM, and alsa-lib then converts the
PCM data to the underlying sample format the hardware codec wants. See
http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html for the
reference docs. Note that this is _not_ the same as being able to
write a PulseAudio client that passes AC3 data to PulseAudio. That is
a different use case that I think is not currently possible.

Best,

Sean

>
>
> Again - sorry if this is a stupid question, or already answered.  I could
> not find a definitive answer.... I would like to keep pulseaudio if possible
> - as it is what my Linux distro (ubuntu) has set default.
>
> Thanks in advance.
>
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at mail.0pointer.de
> https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
>
>



More information about the pulseaudio-discuss mailing list