Testing filters

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Hello, my friends

I'm studying filters and I would like to know how can they be "tested". What kind of audio files are used? I believe that it should be a file comprising all frequencies, from the very botton to the top (20 Hz ~ 25 KHz or something like this).

Anyone who knows about this can give some help.

Thanks

Post

rbarata wrote:I believe that it should be a file comprising all frequencies, from the very botton to the top (20 Hz ~ 25 KHz or something like this).
That's what white noise is.

Another alternative is a frequency sweep.

And testing an impulse (a single sample with a value of 1 surrounded by zeros) can tell you a lot too.

As for analysis, both waveform and spectrum analyzers will provide valuable feedback.

Post

White noise...Ok, I've downloaded a 15 mins white noise track for testing purposes.

Thank you.

Post

rbarata wrote:White noise...Ok, I've downloaded a 15 mins white noise track for testing purposes.

Thank you.
Hopefully a .wav and not an .mp3

Most virtual analog synthesizers have a noise source that will work as well.

Whatever source you use, check it in a spectrum analyzer to make sure it's flat across the entire audible spectrum. Then apply your filter and observe the differences.

Post

Whatever source you use, check it in a spectrum analyzer to make sure it's flat across the entire audible spectrum.
It's an mp3 file. I will check it...my filter is giving me strange results which can be from the audio sample or, most probable, from the cut-off frequency range of the filter.

I will post it later.

Thanks

Post

rbarata wrote:
Whatever source you use, check it in a spectrum analyzer to make sure it's flat across the entire audible spectrum.
It's an mp3 file. I will check it...my filter is giving me strange results which can be from the audio sample or, most probable, from the cut-off frequency range of the filter.

I will post it later.

Thanks
LOL! Noise is like a worse case scenario for the MP3 encoder. I'd find a softsynth source or test tone generator plug-in. (Does anybody know of any? I've been thinking of writing one for my own purposes but if there's a good one out there I'd happily use that instead.)

Post

Since your filter is in code, you can also just write a bit of code that generates white noise, or a frequency sweep and store the output in a wav file, or something like that. If you're using C, (double) random() / 0x7FFFFFFF - 0.5
will give you a decent white noise source (NB use random(), not rand()).

Post

I actually would recommend a predictable periodic signal instead; low-frequency saw-waves are probably my favorite (and some analyzers can weight the spectrum to undo the tilt). Frequency-sweeps are also easy to synthesis, but the resulting data ends up in a more annoying format (not much use for real-time display since the sweep has to be slow). The problem with noise is that the result will be noisy; you can reduce that by averaging over longer periods of time, but why bother when you can get good results in real-time instead? ;)

Noise can be good for sanity-checking though. That said, make sure to check the "whiteness" of the noise-source first.. because typically rand() is horrid and random() is merely awful, and I personally wouldn't touch either of them with a stick; you don't necessarily need a crypto-strong algorithm, just something a bit better (or if you're not planning to work real-time, just create crypto-quality numbers.. those have all the nice properties you need to do any analysis job).

Post

Ok, my initial goal was to understand, in the practice context, the difference between 1-Pole, 2-Pole and 4-Pole filters available in Reaktor. I'm new to Reaktor so I decided to use my head and create a way to test them.

Note: I used Reaper so that I could use some 3rd party VST Frequency Analysers.

So, this was my first project in Reaktor: a filter analyser.

To those who know how to work with Reaktor, there a pic of the ensemble and another of the panel I used.

Image

Image

Basically, I wanted to compare the 3 filters 1,2 and 4-Pole) in the same conditions. So, first of all, I've compared only the lowpass range. There is the possibility to choose Highpass in two of the filters (1 and 2-Pole) and there's a 4-Pole HP but I added them just to test my skills in Reaktor.

Next, all the cutoff frequencies are set for the same value (I don't know if the frequency is the same between LP and HP modes but I'm assuming they are).


Initially I confirmed the good quality of the audio sample used. The result is acceptable for this purpose, I think.

Image

Then, using the exact same condition as explained, this is the result:

1-Pole LP filter
Cutoff frequency (- 3 Db) = 128 Hz

Image

2-Pole LP filter
Cutoff frequency (- 3 Db) = 76 Hz

Image

4-Pole LP filter
Cutoff frequency (- 3 Db) = 57 Hz

Image

As expected, the higher the number of "poles", the steeper the curve. And the cutoff frequencies decrease so the value in the knobs can't be used as a reference (different frequencies for the same knob value). But this data is valid for these filters and not for any other (unless exactly equal).

One question: what's the name of the frequency range between 0 Hz and 5KHz, in the 2-Pole filter for example? Is it the "Q" as in the equalizers?

Post

rbarata wrote: One question: what's the name of the frequency range between 0 Hz and 5KHz, in the 2-Pole filter for example? Is it the "Q" as in the equalizers?
The "pass band". (EDIT: Actually no, the pass band is the flat area before the cutoff frequency.)

However there's nothing particular about 5 kHz, it's just where it happens to cross -60dB on this graph, which is an entirely arbitrary level (attenuation carries on to infinity at that same slope).

Post

rbarata wrote:[...] Note: I used Reaper so that I could use some 3rd party VST Frequency Analysers. [...]
In that case, you could use the included JS effects LOSER/WhiteNoise and Schwa/gaussian_noise_generator.

Post

...attenuation carries on to infinity at that same slope...
You're right so my question doesn't make much sense.

I'll have to take a look at the relationship between knob positions and cutoff frequency.

Post

rbarata wrote:
...attenuation carries on to infinity at that same slope...
You're right so my question doesn't make much sense.

I'll have to take a look at the relationship between knob positions and cutoff frequency.
Adding more poles doesn't change the actual cutoff, but as you're defining cutoff as the -3 dB point obviously that gets pushed lower as your slope increases (as you add more poles). But really they're all starting the cutoff at the same point.

Post

Ch00rD wrote:
rbarata wrote:[...] Note: I used Reaper so that I could use some 3rd party VST Frequency Analysers. [...]
In that case, you could use the included JS effects LOSER/WhiteNoise and Schwa/gaussian_noise_generator.
Reaper's JS spectrum analyzers are pretty great too.

Post

A few weeks ago, I got curious myself about how to accurately estimate the frequency response of some filter algo. Meditating on the fundamental properties of the DFT, I realized that a DFT of size N with rectangular window yields the exact filter magnitude response if you feed a pulse train with period N into the filter input.

So I launched REAPER to write a little pulse train generator JS plugin and test if this works out. Now to my big surprise, when browsing the JS plugin folder I discovered somebody else already had put thought into all this and everything I needed was already there! The pulse train generator is, slightly misleadingly, called "Analysis/fft_noise_generator" and lets you adjust FFT size and amplitude. For DFT spectrum analysis, I used "Analysis/gfxanalyzer" with window parameter set to "rectangular", FFT size set the same as in "fft_noise_generator". Result is, as expected, perfect!

As a final note, this method will not work correctly for phase response as the misalignment of the pulses to the DFT analysis block (ideally, a pulse should occur at the first sample of the block) results in an additional linear phase term in the displayed response.

Post Reply

Return to “DSP and Plugin Development”