3.- I suggest, for clarity, you use standard names for coeffs: a0,a2,a2, b0,b1,b2
4.-
And for last, set sr as polyin and input the sample reate instead of defining as constant
Comment. this seems some kind of biquad ( Zoeltzer maybe ?), but i cannot identify it. Can you point me in some direction ?
Tom7777 ·
Hi thanks, it was a custom biquad filter i was trying to make from http://www.musicdsp.org by editing two things together slightly and just customizing it in my own way. Thanks for your tips i will see what i can do. 🙂
Shifrin ·
unkargherth wrote: These are the things i would change:
1.-
c = 1/ tan1(pi*f/sr)
i think should be:
c = 1/tan1(f/sr)
Cause tan1 func assumes an entry range 0..1
Yeah Unk's right about the entry range, it runs 0..1 instead of 0..2pi!
That said, shouldn't the line 1/tan(pi * f/sr) map to 1/tan(0.5 * f/sr)? Then again maybe I'm just being slow 😉
Shif.
unkargherth ·
Shifrin wrote: Yeah Unk's right about the entry range, it runs 0..1 instead of 0..2pi!
That said, shouldn't the line 1/tan(pi * f/sr) map to 1/tan(0.5 * f/sr)? Then again maybe I'm just being slow 😉
Shif.
Looking again seems amnother mistake i faled to see last time
In fact line shoudl look as
c = 1.0 / tan1(0.5* f);
Divideing by SR it's only a step to NORMALIZE freqency. But In SM, frequencies, gets normalized by default ( your input frequency range is 0..1, not 0..samplerate/2 ) . So we only need to dive by two ( or better, multiply by 0.5)
Shifrin ·
unkargherth wrote: Divideing by SR it's only a step to NORMALIZE freqency. But In SM, frequencies, gets normalized by default ( your input frequency range is 0..1, not 0..samplerate/2 ) . So we only need to dive by two ( or better, multiply by 0.5)
Yep, well spotted!
Shif.
Tom7777 ·
Hi, thanks everyone, did anyone get this working, i can't code so i am having a bit of trouble still, next time if i try to copy some filter to SM i think i will just stick with the 1 filter and not a mod of 2. 🙂
unkargherth ·
What are exactly you're trying to do ?
Tom7777 ·
just get the audio to pass through and be effected in some way. I don't get any sound still 🙁
unkargherth ·
simple do nothing effect
polyin i;
polyout o;
o=i;
Is this waht you're looking for?
Or is really a problem with filter you posted some messages ago?
If answer to 2.- is YES, please post the current code you're using
Tom7777 ·
Yeah i mean for the biquad filter code i posted, i know how to do simple stuff already. I mean i updated the code to do what everyone said but i still hear nothing, i can't post the code right now sorry but im guessing that im doing it the wrong way maybe.
Nu Audio Science ·
The code at the top Tom ?
Sorry i cant help i'm just trying to keep up with the thread as im trying to learn to port a few bits from music DSP myself 🙂
Tom7777 ·
Yeah the first post i made. I still can't get it to work at the moment.
Nu Audio Science ·
I hope you dont mind if i have a little poke around with it Tom ?
Like i said i cant help but it may help me 😉
Tom7777 ·
Yeah thats fine, but it won't make any audio at the moment, if you get it working please PM me the code or something 🙂
Nu Audio Science ·
I tell you what Tom, If i get it working i'll be that excited i'll drive the bloody thing upto you on a Cdrom 🙂
(Theres not much chance 🙂 )
Tom7777 ·
Well im still learning too, i guess i should have started with some simpler stuff first 🙂
Nu Audio Science ·
Took me nearly a week to build a DC blocker and then i had a line of code wrong DOH
Shifrin ·
Tom7777 wrote: Yeah thats fine, but it won't make any audio at the moment, if you get it working please PM me the code or something 🙂
There is a fundamental flaw in your code, you're outputing the final calculation to 'out', which is only a variable in the code. Your correct output should be to the polyout 'output'. So, that's why you've not had any output from it at all!
Also, I had a mess around and got an OK lowpass resonant filter sound from it, needed a few hacks though, and some scaling of the cutoff/reso input values. Give me a shout if you want the .osm!
Shif.
Nu Audio Science ·
Yeah i'll have a little look 😉
Tom7777 ·
Give me a shout if you want the .osm!
Yeah that would be great 🙂 Thanks Shifrin
Shifrin ·
Here it is :- Tom.osm
You'll notice a few chages, I change 'r = reso' to 'r = 1.0 - reso' as when I increased the reso value the resonance dropped! I made the input to 'tan1()' simply be 'c'. I removed unused variables and whatnot. Basically hack it to get it to work 😉
Also the reso and cutoff knobs do scaling of their output inside the knob, do have a look in the knobs to see that.
As it is now, you could connect a sound source to it and it sounds not too bad 🙂
Shif.
unkargherth ·
Well. at least now it works. Still can't fully understand the maths ( well, i know waht they do, but don't know why), But it sounds like a lowpass ( abit stange, but ok)
Anyway : two points
1.- The math conversion you've done in knpobs, better do it in filter module. This way anybody could use standard knobs
2.- the filter becomes a bit unstable at cutoff around 0.005 and resonance over 0.95. Dont know exactly why
Tom7777 ·
Thanks Shifrin 🙂
Shifrin ·
unkargherth wrote: Well. at least now it works. Still can't fully understand the maths ( well, i know waht they do, but don't know why), But it sounds like a lowpass ( abit stange, but ok)
Yeah, I know *what* the maths does, but not sure how it was derived! It does indeed sound like a lowpass!
unkargherth wrote: 1.- The math conversion you've done in knpobs, better do it in filter module. This way anybody could use standard knobs
Yeah, it would be far better to have those calculations done in code, and a standard 0..1 input for cutoff/res etc. I just hacked around basically, the inputs are sensitive!
unkargherth wrote: 2.- the filter becomes a bit unstable at cutoff around 0.005 and resonance over 0.95. Dont know exactly why
Me neither! Still, it's something to fiddle with eh 🙂
Shif.
Wrote something here? To have a post removed or your name hidden, write to [email protected].