HydrogenAudio

Hydrogenaudio Forum => Scientific Discussion => Topic started by: googlebot on 2012-04-03 08:04:02

Title: Which filter artifacts can be eliminated without trade-off?
Post by: googlebot on 2012-04-03 08:04:02
I'm learning, please correct any of the following sentences, if the aren't correct:



If 3 is true, why does the SoX offer a dedicated "allow aliasing" option besides bandwidth and steepness?
Title: Which filter artifacts can be eliminated without trade-off?
Post by: bandpass on 2012-04-03 09:17:42
why does the SoX offer a dedicated "allow aliasing" option besides bandwidth and steepness?

SoX offers a bandwidth option (of which "steep" filter is one particular case) and with this, the stop-band (the point at which the selected attenuation begins) is automatically set to the (old or new as appropriate) nyquist frequency, so there will be no aliasing or imaging (at levels above the selected attenuation). Selecting "allow aliasing" repositions the the filter's stop band to begin above the nyquist.

From an audio perspective, I've not found aliasing particularly useful: if filtering at ~20kHz, one (or at least I) can hear neither the ringing nor the traded aliasing, so it makes no odds. If filtering in the audible band (e.g. resampling 16kHz -> 44.1kHz) then you're trading one audible artefact for another—it might be useful to do so depending on the audio content.

Two minor things that "allow aliasing" give are quicker filtering/conversion due to the shorter filter (but the effect is very small when FFT filtering), and "full" spectrograms that don't fade out at the top of the graph (so that must mean fuller-sounding audio, right?  ).
Title: Which filter artifacts can be eliminated without trade-off?
Post by: Woodinville on 2012-04-03 09:41:41
If I may offer a suggestion:

load octave, the signal package, and the audio package (and whatever else that entails). It's free and it runs on most anything.

then, learn how to run "remez", which is an FIR filter designer.  (while IIR also fits into your question, it's only a question of ringing both before and after, or just after)

The root mechanism in octave isn't good enough to do a really good example of a minimum-phase FIR.

But let me offer a few lines of code. Each of these filters can be plotted (as to response) by using freqz(bb,1)

bb1=remez(32,[0 .4 .6 1],[1 1 0 0])  - short filter, 60dB rejection, small but visible ripple, transition band of .2 times the bandwidth of the digital system.

bb2=remez(64,[0 .45 .55 1],[1 1 0 0]) - same rejection, transition band of .1

Plot both of the filter impuse responses centered with regard to each other on the same horizontal scale.

Look at the steepness of the transition band, look at the shape of the filter.

You will notice something right away.

Then try this

for bb2 do

bbr=roots(bb2);
for (ii=1:64)
if ( abs(bbr(ii))>1)
bbr(ii)=1/bbr(ii);
end
end
bbb=real(poly(bbr));
t=sum(bbb);
bbb=bbb/t;

now to freqz(bbb) and compare it to freqz(bb2)

Holy cow, batman, identical

now plot bbb on top of bb2

Minimum phase FIR ...

Playing with the arguments (and doing "help remez") will let you design a variety of FIR filters, and learn how the tradeoffs actually work.

Title: Which filter artifacts can be eliminated without trade-off?
Post by: googlebot on 2012-04-03 10:41:57
Thank you guys, very insightful.
Title: Which filter artifacts can be eliminated without trade-off?
Post by: 2Bdecided on 2012-04-03 12:13:10
  • We cannot eliminate ringing, just choose where we want it (pre-, post-).
Well, you can reduce it by having a more gentle roll off. That's probably stating the obvious though.

It doesn't need to introduce more aliasing - it can sacrifice more of the frequencies below Nyquist.

You may find this thread interesting...
http://www.hydrogenaudio.org/forums/index....showtopic=68524 (http://www.hydrogenaudio.org/forums/index.php?showtopic=68524)

Cheers,
David.