[pulseaudio-discuss] How does automatic output resampling in Pulseaudio work?

Erich Boleyn erich at uruk.org
Mon Feb 18 13:19:43 PST 2008


Tanu Kaskinen <tanuk at iki.fi> wrote:

> On Mon, Feb 18, 2008 at 11:56:05AM -0800, Erich Boleyn wrote:
> > When Pulseaudio converts from one format to another at the sound output
> > (say for an ostensibly 16-bit/48-khz DAC) *and* performs the automatic
> > output resampling (due to the normal output hardware clock imperfection
> > issues), which one more accurately represents the real chain of events:
> > 
> >   A)    24-bit/96-khz PCM  --(resampled)-->  16-bit/48-khz
> >                            --(resampled)-->  16-bit/near-48-khz-real-freq
> > 
> >   B)    24-bit/96-khz PCM  --(resampled)-->  16-bit/near-48-khz-real-freq
> > 
> > I.e. is it resampled once to get to the "output format" and again at
> > the final hardware matching stage, or is it resampled once directly to
> > the hardware matching frequency?
> 
> If I understood you correctly, then the answer is that there
> is no "final hardware matching stage". In your example the
> sound card reports that it uses sampling rate of 48000 Hz,
> and pulseaudio trusts that it's correct information. If it's
> not, then the sound is played slightly too fast or too
> slowly. The small deviation is taken into account only when
> there are multiple clocks, for example two sound cards, and
> even then the correction is not based on actual time, but
> just the observed difference in the clocks.
> 
> So resampling is always done only once (afaik).

Ahh, interesting.

Is this also true for sources received from hard input sample rates?

In particular, my example is that I am sending audio via RTP to multiple
computers, each possibly more or less in hearing distance of the other.
(though this would apply possibly to input from a digital or other source
on the local machine as well, since it has a fixed input rate)

So, you have 2 problems:
  --  The source was sent out at a particular frequency over the network,
        and you'd get bufferring problems if you didn't resample at the
        output.
  --  The deviations between the different computers will be noticable
        after a while.

I thought pulseaudio accounted for that difference, perhaps I interpreted
the "ability to resample the outputs to be synchronized" comments in the
docs wrong.

--
    Erich Stefan Boleyn     <erich at uruk.org>     http://www.uruk.org/
"Reality is truly stranger than fiction; Probably why fiction is so popular"



More information about the pulseaudio-discuss mailing list