[linux-audio-user] Converting sample rate: failed...

Erik de Castro Lopo erikd-lad at mega-nerd.com
Wed Sep 15 18:10:11 EDT 2004


On Wed, 15 Sep 2004 13:07:06 -0700
davidrclark at earthlink.net wrote:

> Erik,
> 
> > Notice that step where you throw away the middle N/2 samples?
> > That is a low pass filter applied in the frequency domain.
> 
> Not if the amplitudes are all already zero above N/2. 

Sorry, the filter exists whether the frequencies are there or
not.

In addition, your frequency domain method has the same the pre 
and post ringing effects that I get with an FIR filter. This 
can be proved in about 15 seconds using Octave or Matlab. In 
fact, lets do that (using Octave in my case):

	x = [1 1 zeros(1,2046)];   # create a signal
        f = fft (x);
	f_mod = [f(1:512) f(3*512+1:2048)];
	x_mod = real (ifft (f_mod));
        plot (x_mod)

As you can see from the plot, the ringing is plainly visible.

Now I will admit that if the signal is already bandlimited
filter many not be necessary, but that is a different matter 
all together.

> In that case, the 
> input and output frequency spectra are absolutely identical.  If nothing
> was removed or even altered, then no filtering has actually occurred.

Thats not correct. The presense or absense of filtering does not
depend on whether there is a signal there or not. In effect, what
you are saying is:

   "If I take a signal consisting of a single sine wave of frequency
    fs/1000 and pass it through a lowpass filter with a monotonicaly
    decreasing frequency response and a -3dB point of fs/4, then no 
    filtering has taken place because because there are no signal
    components anywhere near where the filter has an effect."

Unfortunately, its not correct.

> > Less accurate how? Is this measurable or is this just hand waving?
> 
> I have already addressed this in previous postings where I described the
> fact that I had merely listened to the recordings repeatedly until I 
> could distinguish the original from the sndfile-resample one and could
> not distinguish the FFT-overlap one from the original --- ergo less accurate.

In other words, handwaving.

> My intention was not to "measure" accuracy, but to listen for the alleged
> distortions.  You had posted a sort of celebration of the fact that I
> thought the sinc-based resampler produced a better-sounding version of
> the recording than my FFT-overlap resampler, but apparently had also 
> neglected the fact that I was also saying that it sounded better than
> the original --- ergo was inaccurate (albeit very, very slightly so).

Was this a double blind test?

> Now I could take time to measure my resampler's performance,

Have you measured the signal-to-noise ratio?

> but I think
> we both know the expected results, don't we?  In terms of absolute
> accuracy, any FFT-overlap resampler which utilizes large windows (hundreds
> of thousands or millions of samples) and which is properly implemented 
> should, in fixed-rate conversions, outperform a sinc-based resampler that

If you work out the mathematical expression for your frequency 
domain converter, you will find that there is a time domain 
expression that is mathematically identical and that the time 
domain expression is in part a FIR lowpass filter very much
like my converter.

The difference between the two would be that my version uses
linear interpolation into a very large table to obtain the
filter coefficients while yours are more exact. However mine
provides a *measured* SNR of at least 97dB.

> P.S. I'll be "sans computer" for the next few days, heading towards Ivan
> so won't be able to correspond on this for a while....

Good luck.

Cheers,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam at mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
Spammer:     Any of you guys looking for a permanent position in Scotland?
Kaz Kylheku: No, I'm looking for a thug in Scotland who might be interested
             in beating up off-topic Usenet spammers, on a pro bono basis.


More information about the linux-audio-user mailing list