Pure data cpole~ in gen~

nouserid's icon

Hey there, I'm trying to recreate cpole~ in gen~ but I don't have much of an understanding of how to translate formulas to max objects. Any help would be much appreciated.

👽!t W∆s ∆lienz!👽's icon

maybe like this:

Max Patch
Copy patch and select New From Clipboard in Max.

(since i feel you can't have it be a 'onepole' and have two separate coefficients(not that the number of coefficients matches the number of poles but, from what i've seen, a onepole only has one coefficient), so i was thinking it's just two 'onepole' filters applied separately to the real and imaginary? ..at least just going by the info in that cpole~ helpfile)

also, this thread has some related stuff too:
https://cycling74.com/forums/max-analogs-for-pds-bp-and-hip

nouserid's icon

Hey Raja, thanks for the reply! Yeah I'm not sure, I'm not so great with filter knowledge but it still doesn't seem right to me. I'm trying to recreate the resonator based around cpole~ in this PD patch but I just can't make sense of the formula at the moment. Thank you for the link too but unfortunately I couldn't find anything on cpole~ specifically.

efficient-concussion.pd.zip
zip 3.32 KB

ecuk's icon

Pd is of course open source, so you can look directly at the C source code for Pd’s cpole~. It is in the file d_filter.c: https://github.com/pure-data/pure-data/blob/c0cd34924a50bdd1cc37dfb6b01f9be02ad8a78b/src/d_filter.c#L780.

The gen~ code is likely to end up being similar to the sigcpole_perform() function at line 809.

nouserid's icon

Thanks Ecuk! I'm not too great with C or genexpr either but I'll see if I can get it working.

I'd also be happy to pay someone for their time if anyone wants to help me port it over.

Graham Wakefield's icon

All of those terms are complex numbers, so you need to apply the rules of complex addition & multiplication:

Max Patch
Copy patch and select New From Clipboard in Max.

👽!t W∆s ∆lienz!👽's icon

so you need to apply the rules of complex addition & multiplication

ohhhhhhhh! this makes much more sense now... i should've known(i've read the phase-vocoder tutorial parts 1 and 2 on this site like 20 times by now) 🤦🥸
Thank You, Graham🙏😁

nouserid's icon

You're the best Graham! Thank you so much!