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


Group: Members (Donating) Posts: 162 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: 1785 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, 16:04
Post
#3


Group: Members Posts: 570 Joined: 1November 06 Member No.: 37047 
@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). The "ideal" lowpass filter is a sin(x)/x function of infinite extent. Sampling theory tells us that using such a filter allows for perfect sampling and perfect reconstruction of a continous signal up to (but not including) fs/2. If you think about it, resampling can be considered to be a reconstruction/sampling process, the same theory applies. There are many ways to think about this, and many ways to optimize the processing (avoiding multiplications that does not affect the output is a significant one). I believe that you come a long way by only considering lowpass filter design. Linear interpolation, cubic interpolation, (windowed) sinc can all be considered lowpass filters. k 


LoFi Version  Time is now: 20th October 2014  05:41 