OnePole Examples?

I’ve been a software developer for 20+ years, but I’m fairly new to DSP. Please be gentle.

I’m struggling to use the new daisysp::OnePole class and I am not finding any examples. I think it might be pretty straightforward if I understood this in the SetFrequency() doc: “Cutoff frequency. Valid range from 0 to .497f”. I’ve Googled this several ways, but can’t find any reference to .497f in a relevant context. What is this magic number? And, how do I calculate a specific cutoff freq with it?

    lowpass.Init();
    lowpass.SetFilterMode(OnePole::FILTER_MODE_LOW_PASS);
    lowpass.SetFrequency(???); // How to set this to 500Hz, for example?

Thanks in advance.

Got to agree with you that its a pretty confusing implementation!

Looking over the header file, it appears to me that the the input is the ratio of the filter cutoff frequency and your overall samplerate. This would make sense given in a dsp system, you can only accurately recreate frequencies up to half the samplerate

So lowpass.SetFrequency( desired_cutoff/sample_rate) should work, with both values in hz !

2 Likes

Ah. After looking at stmlib/dsp/filter.h at master · pichenettes/stmlib · GitHub (the source this was ported from) and thinking it through with your explanation, this makes sense. Cheers very much for the nudge in the right direction.

Now on to confusing Svf stuff :melting_face:

1 Like