ARDFTSRC - Real Discrete Fourier Transform Sample Rate Conversion
-
- KVRist
- 128 posts since 5 Jul, 2018 from Cambridge, UK
Just read through the Python and C ports. It looks like a 50%-overlap STFT, with the block size chosen so that you can add/remove bins in the frequency-domain to get the appropriate-sized output spectrum.
That approach depends heavily on being able to use arbitrary FFT sizes, which means that porting it to some FFT libraries can end up slow - much slower than one might expect when comparing the fast sizes of each implementation. The author seems pretty dismissive of this, and I'm not sure that's fair. While FFTW is not the only implementation which can do fast arbitrary-sizes, it really narrows your options.
The exact block size, latency (and probably performance) depend on the common factors between integer input/output rates. I don't think I've encountered non-integer sample-rates in real-life, but still - the whole thing adds up to being awkward enough that I'm personally not motivated enough to give it a whirl.
That approach depends heavily on being able to use arbitrary FFT sizes, which means that porting it to some FFT libraries can end up slow - much slower than one might expect when comparing the fast sizes of each implementation. The author seems pretty dismissive of this, and I'm not sure that's fair. While FFTW is not the only implementation which can do fast arbitrary-sizes, it really narrows your options.
The exact block size, latency (and probably performance) depend on the common factors between integer input/output rates. I don't think I've encountered non-integer sample-rates in real-life, but still - the whole thing adds up to being awkward enough that I'm personally not motivated enough to give it a whirl.
- KVRAF
- 8497 posts since 12 Feb, 2006 from Helsinki, Finland
Doesn't this result in awful time aliasing?signalsmith wrote: Sat Nov 08, 2025 10:25 pm Just read through the Python and C ports. It looks like a 50%-overlap STFT, with the block size chosen so that you can add/remove bins in the frequency-domain to get the appropriate-sized output spectrum.
-
- KVRist
- 128 posts since 5 Jul, 2018 from Cambridge, UK
Yeah. As well as a control labelled "quality" which enforces a minimum block size (-> closer-spaced bins -> aliasing stays in the ultrasonics), you can also set a cutoff which is below Nyquist. I haven't checked whether they use this extra room do any tapering/folding/etc. which would reduce aliasing, but I hope so.
- KVRian
- 1011 posts since 6 Aug, 2005 from England
You do need a sloped cut-off, or was that what you meant by tapering?signalsmith wrote: Tue Nov 11, 2025 7:15 amYeah. As well as a control labelled "quality" which enforces a minimum block size (-> closer-spaced bins -> aliasing stays in the ultrasonics), you can also set a cutoff which is below Nyquist. I haven't checked whether they use this extra room do any tapering/folding/etc. which would reduce aliasing, but I hope so.
Dave Hoskins. http://www.quikquak.com
-
- KVRist
- 128 posts since 5 Jul, 2018 from Cambridge, UK
Yeah, that's what I meant - you ideally want a nice curve which keeps the effective impulse response of your filter focused (kinda the time-frequency-swapped counterpart to designing window functions with focused frequency response).quikquak wrote: Tue Nov 11, 2025 3:29 pm You do need a sloped cut-off, or was that what you meant by tapering?
And by "folding", I meant that the curve of the cutoff could extend beyond Nyquist, if you read/add the reflected bins as complex conjugates. You'd accept a bit of aliasing, strongly limited to the (inaudible) high end, in exchange for the cutoff being higher, which might be a reasonable trade-off for some situations.
-
- KVRian
- Topic Starter
- 847 posts since 21 Feb, 2006 from FI
I don't have best tools for plotting the "src quality" nor I can't say what's probably wrong in plot but, with Audacity spectogram -tool, https://src.infinitewave.ca/ 's test file "Swept_float.wav" (original file is 96kHz mono file so I duplicated the audio data and converted it to a stereo file) converted to 44.1kHz audio using default settings given in python listing resulted this spectrum (range 0-22050Hz, window size 4096, Hann):
Result looks quite similar as what Audacity's internal resampler (SoX:libsoxr) outputs.
EDIT: ARDFTSRC developer added support for single channel files so here's plot (0-22050, window size 1024 (blackman-harris)):
Result looks quite similar as what Audacity's internal resampler (SoX:libsoxr) outputs.
EDIT: ARDFTSRC developer added support for single channel files so here's plot (0-22050, window size 1024 (blackman-harris)):
You do not have the required permissions to view the files attached to this post.
-
- KVRian
- Topic Starter
- 847 posts since 21 Feb, 2006 from FI
Hydrogenaudio launched recently Sample Rate Conversion Testing site. Here are some results linked for SRC method in question and for some others tested ATM.
