Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: foo_dsp_srcresample (Read 18246 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

foo_dsp_srcresample

Reply #25
I did some testing too converting 96 kHz Swept_float.wav to 44.1 kHz float WAV with foobar2000 DSP components.
lvqcl's SoX Resampler 0.7.0 produced this output:


mudlord's SRC Resampler 0.1:


SoX resampler was running at 246.983x realtime speed and SRC resampler at 11.871x realtime. I don't see why Secret Rabbit Code needs defending.

foo_dsp_srcresample

Reply #26
Well, I wont play Mega's PR agent and comment again your pictures. I reacted when I comprehended unfair treatment while reading this thread the other day. SoX is one of my favorite tools too

SRC performance issue was already known before this component was (re)published. I want to think I encouraged mudlord to use time on improving what needs improving, rather then burying, now that he wrapped SRC in foobar component
But I have no high hopes. RIP SRC, without your great results many programs and packages would be non-existent

foo_dsp_srcresample

Reply #27
Couldn't resist. 200dB - kaiser(1024, 24) version and wanted to share it with you:



Also here is right channel of Tone1KHz sample

Downsampled (96>44):



Upsampled (44>96):



In all images order is SoX then SRC. Downsampled spectrograms have original in background

I'm wondering that -v switch is named "very high" and it's highest SoX setting (if we exclude possible additional tweaks). If we look at http://src.infinitewave.ca/ graphs for 1KHz sample there is no trace of right channel artifact above 180dB. Also in my previous test at 180dB those artifacts are evident.

This is not SoX vs. SRC. Only wanted to show that 180dB is way too much when you provide one artificial sample

foo_dsp_srcresample

Reply #28
Try with the foobar DSP component. As you saw from my graphs it has no noise issue.

foo_dsp_srcresample

Reply #29
Tried it. foobar version does not have such issues, even at 200dB. Probably thanks to lvqcl work on his component

foo_dsp_srcresample

Reply #30
Stand-alone SoX & SRC at 200dB:

Code: [Select]
sox -r 96k -n input.wav synth 8 sin 0+48k gain -.1 
sox input.wav sox.wav rate -v 44100
sndfile-resample -to 44100 -c 0 input.wav src.wav
sox -M sox.wav src.wav -n spectrogram -w k -z 180 -Z-20 -X 60 -y 257 -t "96k -> 44100" -c "Upper: SoX  Lower: SRC"



 

foo_dsp_srcresample

Reply #31
Code: [Select]
$ sox Swept_float.wav sox.wav rate -v 44100
$ sndfile-resample -to 44100 -c 0 Swept_float.wav src.wav
$ sox -M sox.wav src.wav -n spectrogram -w k -z 180 -Z-20 -X 60 -y 257 -t "96k -> 44100" -c "Upper: SoX  Lower: SRC"




Can you confirm issue with right channel on Tone1KHz sample?

foo_dsp_srcresample

Reply #32
SoX converts its input (including 32-bit float) to 32-bit int, while sndfile-resample probably keeps 32-bit float as is.
IMHO this is the reason of the "issue with Tone1KHz right channel".

foo_dsp_srcresample

Reply #33
Yes, 32-bit float input = 24-bit precision so trying to look down to -200dB in the output is not meaningful. Use 32-bit ints or 64-bit floats as input to get the true picture.

foo_dsp_srcresample

Reply #34
Yeah, it must be. If files are signed integer, both upsampled and downsampled spectrograms are clear

[edit2] OK, I got buried alltogether with this component. Issue I wanted to ask was this - create sweep:

Code: [Select]
sox -r 96k -e f -b 32 -n Sweep_float_SoX.wav synth 8 sin 0+48k gain -.1


compare spectrograms with Sweep_float.wav and this crated by SoX.

foo_dsp_srcresample

Reply #35
But float -> int conversion will truncate very quiet signals regardless of input bitness. (and BTW 32-bit float = ~25-bit int)


foo_dsp_srcresample

Reply #37
Afaik, the SNR corresponds to that of a 24-bit int but the dynamic range of the float is much, much higher of course.

So as the level of the signal drops int becomes (almost) useless.
"I hear it when I see it."

foo_dsp_srcresample

Reply #38
i love this thread

foo_dsp_srcresample

Reply #39
Afaik, the SNR corresponds to that of a 24-bit int (including the sign bit) but the dynamic range of the float is much, much higher of course.

The sign bit adds to the precision, beyond that of the physical mantissa and the implied 1. So 23 + 1 + 1 = 25.  I.e. float32 can represent the range [-(1<<24), 1<<24] precisely, compared with int24 which can represent [-(1<<23), (1<<23)-1].

Code: [Select]
sox -r 96k -e f -b 32 -n Sweep_float_SoX.wav synth 8 sin 0+48k gain -.1

compare spectrograms with Sweep_float.wav and this crated by SoX.

When writing float32, in order to avoid the vagaries of rounding in FPUs, SoX first performs bit-depth reduction from its internal transport, int32, to (the top) 24 bits.  From above, this should in fact be to 25 bits.  Also, Sweep_float.wav has only 1/2 the max amplitude, so it can be seen as having 26-bits of precision relative to full-scale (since halving is lossless in floating point).

foo_dsp_srcresample

Reply #40
Nevermind, bandpass seems to be right. 
"I hear it when I see it."