SynthMaker

help for DSP (total) newbie: what's wrong with my filter?

Archive · 2006 4 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

spoonboiler ·

streamin in; streamin cut; streamin reso; streamout out;

float f0; float f1; float feed;

feed=reso+(reso/(1.0-cut)); f0=f0+cut*(in-f0+feed*(f0-f1)); f1=f1+cut*(f0-f1);

out=f1;

please don't laugh too hard, after all, i am just a lowly actionScripter 😆 I am extremely (hopelessly) curious about this stuff, but know just about nothing - probably my math deficiency doesn't help either...

so if there is someone who can explain in total retard terms, i would be greatful 🙂

basically, this uses a feedback loop; well, obviously 😆 and i am actually surprised to find that it doesn't sound too bad, considering i translated it from a modular patch (DeltaSP) and also because i don't really know why the computer understands what to do with it.

the problem is, frequency; it cacks out if the cutoff goes above a certain amount, or if the audio goes above a certain frequency. and unfortunately that amount is well within human range - about middle G 😆 well, a bit higher.

so how about it? anyone feeling patient?

cheers, all.

rl ·

Hi Spoonboiler

your lowpass filter has a problem when cut=1.0 causing a divide by zero error. with cut < 1.0 the maximum cutoff frequency is ~7kHz at 44100Hz sampling rate. With a little 2x oversampling trick (see below) your filter remains stable upto 14kHz (cut < 2.0). With 3x oversampling (cut < 3.0, using one third of cut and three calculations for f0, f1) you could nearly reach nyquist.

streamin in; // RL: cut < 2.0 streamin cut; streamin reso; streamout out;

float f0; float f1; float feed; float cut2;

// RL: half cutoff for 2x oversampling cut2=0.5*cut;

// RL: calculate section twice for oversampling feed=reso+(reso/(1.0-cut2)); f0=f0+cut2*(in-f0+feed*(f0-f1)); f1=f1+cut2*(f0-f1);

// caluclating feed a 2nd time is not necessary // feed=reso+(reso/(1.0-cut2)); f0=f0+cut2*(in-f0+feed*(f0-f1)); f1=f1+cut2*(f0-f1);

out=f1;

cheers, Rudolf

edit: small mistake corrected

spoonboiler ·

🙂 🙂 🙂

thanx, rh!

that is very kind of you. i am still at that "holy shit, this is just so far over my head" stage, but hopefully i will start to understand eventually. Your reply has helped me on my way, and i am grateful.

-g

edit: it goes much higher now. what is the most one would want to oversample a simple filter like this?

would u say it would be better to just try to write a better filter than to go any higher than 3x?

just for fun i went up to 8 😆 but then i have a simple synth using 3% cpu (on athlon64/3500+, probably not good...)

😀

spoonboiler ·

now i have another question...

i was getting a pop followd by no sound if the mod amount plus the cutoff knob amount went above a certain level, so i went:

float max=2.5; cut=min(cut,max);

it works.

if i have the theory of how SM works, then max could have been as high as 3.0, with three times oversampling, and still managed to limit the data coming in the cut pin to 1?

so.... SM works with levels between 0 and 1 under normal circumstances, right, unlike SynthEdit which uses a CV paradigm with levels between 0 and 10 (virtual volts 🙂 ) ???

anyway, the sound is nice with four times oversampling right up to the top of the keyboard, which was making my dog uneasy 😆

can someone tell me if i am way off base here? it's really about time i started to understand this program, so i am trying to find the time (and patience).

cheers

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.