[pulseaudio-discuss] Play audio files of high sample rates without hassle

Tanu Kaskinen tanuk at iki.fi
Fri Dec 2 12:01:02 UTC 2016


On Sun, 2016-11-27 at 22:27 +0100, Erwan JACQ wrote:
> You can use the default-sample-rate/alternate-sample-rate config values
> as minimal sample rates.

Yes, using default-sample-rate as the minimum seems reasonable. I'm not
sure what to do with alternate-sample-rate. We can't just remove it,
unless you also change pa_config_parse() to not stop parsing when it
encounters unknown options, because we need to handle old configuration
files. (Doing that pa_config_parse() change would be very welcome, by
the way.) I suppose we can parse the option, but not use it anywhere
(and log a warning that the option was ignored).

> So if you input a 8kHz audio stream, you resample it to 48kHz or 44.1kHz
> rather than let it to go 8Khz.
> 
> I attached my patches.
> They just remove the limitation that the desired sample rate should be
> either default-sample-rate or alternate-sample-rate when the sink is
> opened. This was just a quick hack as I don't know pulseaudio source code at
> all. Feel free to discuss or modify them :)
> 
> The resulting behavior is the following:
> 
> New audio stream 88200Hz -> sink & source at 88200Hz
> Adding a stream at 441000Hz -> sink & source don't change their sample
> rate (still 88200Hz so). The additionnal stream is thus resampled to
> 88200Hz
> 
> Shutdown sink, New audio stream at 441000Hz -> sink & source at 44100Hz
> 
> Shutdown sink, New audio stream at 8000Hz -> sink & source at 44100Hz
> because there seems to be a lower limit (maybe 8Khz is not in the
> supported rates of the sound card :D ).

I wonder if we should keep some of the special handling of rates that
are divisible by 8000 or 11025 (so we'd prefer 48000 Hz over 44100 Hz
if the requested rate was 8000 Hz). Probably that's not very important.

> I can add to the patch a software limitation so the desired sample rate
> can't be below default-sample-rate value for example.

The documentation in man/pulse-daemon.conf.5.xml.in needs to be updated
too.

For future patch submissions, it would be good if you could send the
patches with git send-email, so that the patches have proper commit
messages. Instructions for git send-email can be found here:
https://www.freedesktop.org/wiki/Software/PulseAudio/HowToUseGitSendEmail/

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list