[pulseaudio-discuss] Variable resample rate
s.jansen at gmail.com
Mon Apr 27 09:04:44 PDT 2009
On Thu, Apr 23, 2009 at 6:55 PM, Lennart Poettering <lennart at poettering.net> wrote:
> On Wed, 22.04.09 19:14, s.jansen at gmail.com (s.jansen at gmail.com) wrote:
>> 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.
> This has been requested before. I don't think it is feasable however.
> Changing the sampling frequency requires reopening the audio
> device. That will always result in discontinuities in audio. So, let's
> say you take a phone call which is sampled at 8khz. Then an event
> sound is played at 22khz. The device freq hence needs to be changed
> from 8khz to 22khz for that short plop sound and then back again. Both
> times you'd hear a short drop out. People would hate that.
> Also, modern sound cards usually only do *one* sampling type and *one*
> sampling frequency. Spending time on the logic you suggest is hence
> probably better invested in speeding up the resampler or improving it
> I'lll probably extend the current profile logic however, to allow
> switching the output frequency with it. The most important reason for
> that is digital output (spdif) since some amps cannot take 48khz or
> cannot take 44khz and hence we need to allow the user to select which
> freq he wants.
> If that's in place it should be easy to add some code that switches
> profiles based on a policy like you suggest. But I don't think this
> would lead to much, but I am always happy to be proven wrong.
Your arguments do make sense and your above example would be a situation when you don't want to switch sampling rates.
From my point of view, and the way I use my computer, I usually have one "primary" sound source and a bunch of "secondary" sources. In my case the primary sources would be a audio player, a video player and perhaps a voice/video chat application. The secondary sources are event sounds.
In my view, secondary sources should never change sampling rates. My primary sound sources would never play at the same time.
(Even the voice/video/chat would be a secondary source, until I actually connect to the other party, in which case I already turned off my music/video). I also don't listen to music and watch video at the same.
Primary source may and should switch sampling rates though if for example a different track in a music player played.
Now ofcourse you can think of plenty exceptions that can go wrong in the above example, but in general I mainly listen to one sound source at a time that I would like to be able to adept it's sampling rate, while everything else (secondary sound sources) should just cope with it.
I do realize that other people may have totally different needs from a sound system. This is just the way I see it.
A runtime switch would already be a big help though.
"And any fool knows a dog needs a home
A shelter from pigs on the wing"
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 270 bytes
Desc: OpenPGP digital signature
More information about the pulseaudio-discuss