Play audio files of high sample rates without hassle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You can use the default-sample-rate/alternate-sample-rate config values
as minimal sample rates.

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 can add to the patch a software limitation so the desired sample rate
can't be below default-sample-rate value for example.

Best regards,



Le dimanche 27 novembre 2016 à 17:16 +0200, Tanu Kaskinen a écrit :
> The dynamic rate switching was added to deal specifically with the most
> common case: switching between 44100 Hz and 48000 Hz. It's not that
> supporting a more flexible policy is necessarily undesirable, it's just
> that nobody has been interested enough to provide patches.
> 
> One reason why we don't simply try to switch to whatever rate streams
> happen to have is that we don't want to end up in a situation where one
> stream causes the sink to run at 8000 Hz and then an overlapping higher
> quality stream appears and suffers from the very low sink rate.
> 
> So, if we relax the rate restrictions, we need to add at least a limit
> for how low rates we accept. I don't remember if there were any other
> considerations when this feature was discussed. If you provide patches
> for improving the rate switching policy, at this point I don't see any
> reason why such feature would be rejected.
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sink.patch
Type: text/x-patch
Size: 2141 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20161127/41939bb1/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: source.patch
Type: text/x-patch
Size: 2123 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20161127/41939bb1/attachment-0001.bin>


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux