[pulseaudio-discuss] Variable resample rate

Colin Guthrie gmane at colin.guthr.ie
Thu Apr 23 01:26:25 PDT 2009


'Twas brillig, and s.jansen at gmail.com at 23/04/09 01:14 did gyre and gimble:
> My audio hardware supports multiple sample rates (44.1khz, 48khz,96khz) 
> and I thought it would be nice if pulseaudio can automatically adjust 
> the global resample rate based on the incoming stream(s). This to avoid 
> any unneeded resampling if the hardware is capable of accepting the 
> requested sample rate.  A simple scheme would be to set the sample rate 
> to the maximum incoming samplerate of all streams. It would basically 
> automatically scale up and down based on the max rate.
> Perhaps audio streams could also be tagged whether or not they prefer to 
> be resampled or not, so you could use that to determine what the optimal 
> sample rate would be. System sounds would be tagged 'dont-care', while 
> audio players might be tagged 'we-care' for example.
> 
> For myself, I would prefer if none of my music and movies, which range 
> from 16-bit,44.1khz to 24 bit,96khz, would be resampled, but rather send 
> straight to the audio hardware. I know dmix cannot do this, so maybe 
> there is some hope with pulse...

Not easily.

Pulse only opens one connection to the hardware even if it can do 
hardware mixing (and hardware mixing at different rates).

In order to do this, you'd have to tell pulse to open the device several 
times at different rates, and then when a stream was played, pick the 
right connection to use based on the streams rate. In theory if you did 
this, there would be no need to say "we-care" or "don't" care.

This is a desirable thing to have, but it is very complicated. There is 
no way to tell that we are allowed to open the device several times. 
Even if we just try to do that, we don't know if in opening the device 
several times it would exclude some other mode of operation (e.g. 
recording). In addition, I'm not sure how many h/w systems allow 
independent rates per connection.

All of these problems mean that, while this is a nice idea, it's not 
something that would be able to work automatically. As this is a prime 
goal of pulse and as things do work (albeit with resampling), it's not a 
high priority on the development todo list.

If it's something you really care about tho', and are a coder, then join 
in on IRC and ask mezcalero about it and if he would accept patches that 
implement this functionality.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
   Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
   Mandriva Linux Contributor [http://www.mandriva.com/]
   PulseAudio Hacker [http://www.pulseaudio.org/]
   Trac Hacker [http://trac.edgewall.org/]




More information about the pulseaudio-discuss mailing list