Triode wrote:
> This has changed slightly - can you see if you like/dislike the new
> algorithm which is intended to also allow synchronous downsample of dsd
> converted to pcm:
>
> >
Code:
--------------------
> >
> if (r->exception) {
> // find direct match - avoid resampling
> for (i = 0; supported_rates[i]; i++) {
> if (raw_sample_rate == supported_rates[i]) {
> outrate = raw_sample_rate;
> break;
> }
> }
> }
>
> if (!outrate) {
> if (r->max_rate) {
> // resample to max rate for device
> outrate = supported_rates[0];
> } else {
> // resample to max sync sample rate
> for (i = 0; supported_rates[i]; i++) {
> if (supported_rates[i] % raw_sample_rate == 0
|| raw_sample_rate % supported_rates[i] == 0) {
> outrate = supported_rates[i];
> break;
> }
> }
> }
> if (!outrate) {
> outrate = supported_rates[0];
> }
> }
>
--------------------
> >
With the latest testing squeezelite, the following occurs when playing a
32kHz sample rate stream (BBC Radio 3 from outside the UK) with no max
sample rate specified via the parameters to Squeezelite.
Code:
--------------------
[root@wandquad squeezelite]# cat squeezelite.log
[20:35:09.250357] output_init_alsa:623 init output
[20:35:09.251016] output_init_alsa:645 requested alsa_buffer: 40 alsa_period:
4 format: any mmap: 1
[20:35:09.251112] output_init_common:318 outputbuf size: 28224000
[20:35:09.257295] output_init_common:378 supported rates: 384000 352800
192000 176400 96000 88200 48000 44100
[20:35:09.454139] output_init_alsa:657 memory locked
[20:35:09.455737] output_thread:465 open output device: hw:CARD=UD501
[20:35:09.456896] alsa_open:234 opened device hw:CARD=UD501 using format:
S32_LE sample rate: 44100 mmap: 1
[20:35:09.457065] alsa_open:313 buffer: 40 period: 4 -> buffer size: 1764
period size: 441
[20:35:09.455763] output_init_alsa:680 set output sched fifo rt: 45
[20:35:09.478342] alsa_open:234 opened device hw:CARD=UD501 using format:
S32_LE sample rate: 44100 mmap: 1
[20:35:09.478521] alsa_open:313 buffer: 40 period: 4 -> buffer size: 1764
period size: 441
[20:35:09.505241] output_flush:391 flush output buffer
[20:35:09.507647] output_flush:391 flush output buffer
[20:35:17.551751] output_flush:391 flush output buffer
[20:35:19.209332] _output_frames:59 start buffer frames: 13800
[20:35:19.209562] _output_frames:122 track start sample rate: 384000
replay_gain: 0
[20:35:19.209646] output_thread:465 open output device: hw:CARD=UD501
[20:35:19.227705] alsa_open:234 opened device hw:CARD=UD501 using format:
S32_LE sample rate: 384000 mmap: 1
[20:35:19.227894] alsa_open:313 buffer: 40 period: 4 -> buffer size: 15360
period size: 3840
[20:35:19.249601] alsa_open:234 opened device hw:CARD=UD501 using format:
S32_LE sample rate: 384000 mmap: 1
[20:35:19.249783] alsa_open:313 buffer: 40 period: 4 -> buffer size: 15360
period size: 3840
--------------------
I notice it's now resampling from 32kHz straight to 384kHz, i.e., by a
factor of 12.
Now, by contrast, if I specify the maximum sample rate with -r 384000
and then play the same stream again
Code:
--------------------
root@wandquad squeezelite]# cat squeezelite.log
[20:41:36.720331] output_init_alsa:623 init output
[20:41:36.720995] output_init_alsa:645 requested alsa_buffer: 40 alsa_period:
4 format: any mmap: 1
[20:41:36.721093] output_init_common:318 outputbuf size: 28224000
[20:41:36.721343] output_init_common:378 supported rates: 384000 352800
192000 176400 96000 88200 48000 44100 32000 24000 22500 16000 12000 11025 8000
[20:41:36.913559] output_init_alsa:657 memory locked
[20:41:36.915186] output_init_alsa:680 set output sched fifo rt: 45
[20:41:36.920670] output_thread:465 open output device: hw:CARD=UD501
[20:41:36.921362] alsa_open:234 opened device hw:CARD=UD501 using format:
S32_LE sample rate: 44100 mmap: 1
[20:41:36.921516] alsa_open:313 buffer: 40 period: 4 -> buffer size: 1764
period size: 441
[20:41:36.942080] alsa_open:234 opened device hw:CARD=UD501 using format:
S32_LE sample rate: 44100 mmap: 1
[20:41:36.942243] alsa_open:313 buffer: 40 period: 4 -> buffer size: 1764
period size: 441
[20:41:36.956962] output_flush:391 flush output buffer
[20:41:36.959510] output_flush:391 flush output buffer
[20:41:49.037759] output_flush:391 flush output buffer
[20:41:50.783228] _output_frames:59 start buffer frames: 17408
[20:41:50.783397] _output_frames:122 track start sample rate: 32000
replay_gain: 0
[20:41:50.783497] output_thread:465 open output device: hw:CARD=UD501
[20:41:50.793756] alsa_open:213 reopening device hw:CARD=UD501 in plug mode
as plughw:CARD=UD501 for resampling
[20:41:50.795503] alsa_open:234 opened device plughw:CARD=UD501 using format:
S32_LE sample rate: 32000 mmap: 1
[20:41:50.796091] alsa_open:313 buffer: 40 period: 4 -> buffer size: 1280
period size: 320
[20:41:50.817342] alsa_open:213 reopening device hw:CARD=UD501 in plug mode
as plughw:CARD=UD501 for resampling
[20:41:50.819021] alsa_open:234 opened device plughw:CARD=UD501 using format:
S32_LE sample rate: 32000 mmap: 1
[20:41:50.819606] alsa_open:313 buffer: 40 period: 4 -> buffer size: 1280
period size: 320
--------------------
For some reason, squeezelite now believes that a bunch more sampling
rates are supported than is the case, but when it tries to open at one
of these sample rates it discovers it can't and uses the plughw
resampling instead. But this only occurs when -r 384000 is explicitly
given. I've tried -r 192000 with similar results. However, it I leave
out the -r option altogether (as in the first example above) it does
resample by exception, but jumps to the highest supported sample rate
rather than choosing the next highest that is available.
Perhaps I am misunderstanding, but I don't believe this behavior is
quite right.
----------------------
"Dreamer, easy in the chair that really fits you..."
------------------------------------------------------------------------
dsdreamer's Profile: http://forums.slimdevices.com/member.php?userid=12588
View this thread: http://forums.slimdevices.com/showthread.php?t=99395
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix