[pulseaudio-discuss] dynamically changing alsa sink/source sampling rate

Colin Guthrie gmane at colin.guthr.ie
Mon Nov 15 14:21:47 PST 2010

'Twas brillig, and Baek Chang at 15/11/10 21:16 did gyre and gimble:
> Is it possible to change the sampling rate that the alsa sink or source
> is configured for?  For example, in some scenarios, 44.1kHz is used,
> then in another scenario, to avoid sample rate conversion and some other
> hardware problems, configure the alsa device to 8kHz within the
> module-alsa-sink/source.

No, this is not something we support at present due to the practical
problems that this presents.

Whenever changing the sample rate "mid stream" you'll obviously get some
kind of click/pop as the device is closed, reconfigured and reopened, so
this has to be avoided.

The alternative is to take the first sample rate and stick with it. But
then consider playing an 8kHz effect sound and then playing a nice
196kHz audio track just a moment later... it would be converted to 8kHz
which is almost certainly not what the user would want.

So whichever way you cut it, there is no nice solution to do dynamic
sample rate switching of the hardware and the only logical and practical
solution is to use a fixed sample rate on your system and covert to this.

I wont say it will never be supported (if someone writes a well formed
patch that doesn't introduce any significant complications/overhead then
I can't see any problems with merging it), but I doubt any of the main
developers or companies supporting PA will want to do this any time soon
(although I could of course be wrong here).

I hope this answers your question.



Colin Guthrie

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

More information about the pulseaudio-discuss mailing list