ffmpeg vs. SoX for resampling 
ffmpeg vs. SoX for resampling 
Feb 5 2013, 11:00
Post
#1


Group: Members (Donating) Posts: 164 Joined: 1October 01 From: Doylestown, PA Member No.: 145 
I just found out that TAudioConverter, although it has SoX support, uses ffmpeg for bitdepth changes, resampling, and dither. I don't use those functions very much, but I'm curious if anyone has done a quality comparison between the two.



Feb 12 2013, 20:25
Post
#2


Group: Members Posts: 1797 Joined: 24June 02 From: Catalunya(Spain) Member No.: 2383 
@ halb27: I haven't checked other software, but a sinc method is implemented in Psycle (And at least back to 2003 or so, there was a tracker name Aodix that had a 64point sinc interpolator, for nonrealtime rendering). Here you can see the code of Psycle:
http://sourceforge.net/p/psycle/code/10455...rs/dsp.hpp#l544 search for: static float band_limited The sinc table is calculated in this other file, and a blackman window is applied to make it finite. http://sourceforge.net/p/psycle/code/10455...helpers/dsp.cpp This implementation still lacks a filter (I am trying to find a good one that doesn't require too much lookahead, but I might end calling soxr variable rate if I can't find a good way to do it). I have a file as old as 2001 (I had to doublecheck to be sure of the year), that shows a sinc interpolator and applies a filter modifying the sinc speed. But this way of filtering decays slowly and in what i've tested, alters the frequencies too. @saratoga: I am not an expert in DSP or maths (I did study the fourier transform at the university, but was applied to signals in general, not specifically to sound). But with my knowledge of resampling (i.e. what I've tried to know), the sinc interpolation is considered the ideal (which also means not possible in finite time/signals) resampling method because it is the response or an ideal brickwall lowpass filter. Real implementations have to window the sinc in order to make it finite, and in this way, limit the amount of samples needed to calculate the output. (See Psycle's implementation). In contrast, decimating and interpolating is a two step method which firstly upsamples using the zerostuffing method, applies a lowpass filter at the lowest of the two samplerates, and then downsamples by getting directly the samples from the lowpassed signal. The difficult part is getting the values to what upsample, wich is the common minimum multiple. (erm.. spelling?) In some way, this is how a DAC works (except that then, the result is a continuous signal). I have included the polynomial interpolators in the "other resamplers", since they are, in some way, approximations, or concepts applied to sound when sometimes they originated in graphics ( splines, for example, is more about visuals than samples). This post has been edited by [JAZ]: Feb 12 2013, 20:29 


Feb 13 2013, 18:32
Post
#3


Group: Members Posts: 5119 Joined: 2September 02 Member No.: 3264 
@saratoga: I am not an expert in DSP or maths (I did study the fourier transform at the university, but was applied to signals in general, not specifically to sound). But with my knowledge of resampling (i.e. what I've tried to know), the sinc interpolation is considered the ideal (which also means not possible in finite time/signals) resampling method because it is the response or an ideal brickwall lowpass filter. Real implementations have to window the sinc in order to make it finite, and in this way, limit the amount of samples needed to calculate the output. (See Psycle's implementation). In contrast, decimating and interpolating is a two step method which firstly upsamples using the zerostuffing method, applies a lowpass filter at the lowest of the two samplerates, and then downsamples by getting directly the samples from the lowpassed signal. A lowpass filter is a windowed sinc. So you propose two methods, one of which fits a windowed sinc to calculate values, and another which ... fits a windowed sinc to calculate values. These are just two ways of implementing the same algorithm, which is preferred is just an implementation detail that depends on the exact needs of the resampler. Trying to draw some abstract distinction between them is silly. I have included the polynomial interpolators in the "other resamplers", since they are, in some way, approximations, or concepts applied to sound when sometimes they originated in graphics They didn't originate in graphics, they originated in 17th century boundary value problems. They're general numerical techniques, as such both polynomial and windowed sinc interpolation are widely used in audio and graphics. ( splines, for example, is more about visuals than samples). What is it you think digital images are made of if not samples? 


LoFi Version  Time is now: 28th November 2014  02:59 