[Intermediate/Advanced Max6 gen~ Challenge] gen~ version of MoogVCF pseudocode

    Oct 27 2011 | 4:15 am
    Been beta-testing like crazy. Max6 is beautiful. gen~ is brilliant and i'm ecstatic about it. I can't wait for all the kinks to be worked out(like poke channel referencing...) and for the environment to be more comprehensive( loop-ability added to codebox(if/then, while, for, etc.)... and arrays, etc. added to codebox...)... But i thought i found something i could try and implement using the resources available in gen~ so far... and for now... I've failed. I have to keep moving on to other things... must prioritize my time...
    HOWEVER! instead of becoming one of the hundreds of other patches I have that sit idly destined to be forgotten in a reservoir of 'almost-made-its', I thought I'd throw this one out there.
    It is an attempt to create a gen~ version of some pseudocode for a MoogVCF i found at musicdsp.org. The pseudocode is included in a comment within the gen~ patcher here along with a link to the exact page where i found the code originally.
    Here's my attempt at the patch for anyone who feels like carrying on the torch:
    Apologies if this is not appropriate for a 'beta' forum. (But it is a Max6 patch... before Max6 has been released.) There is no bug here. I'm confident of that. The failure is purely mine as far as I can tell. There is probably something about the order of operations in the pseudocode which i'm not completely understanding, or it may be the lines where an out variable is included in its own definition(for example: out1 = ...... * out1). (
    May it become part of your success... if you should feel so bold as to attempt it. Post whatever you come up with here. Even if it doesn't sound like a VCF, post if you can even get it to make some discernible sound. Best of luck.

    • Oct 27 2011 | 6:10 am
      yeah, fun idea! now it does something:
      things I fixed: use + instead of += and * instead of *= first scale frequency as mentioned in the pseudocode fc = in1 / ( samplerate / 2 );
      issues left: smooth parameter changes blow up for low frequencies (is it possible to reset history somehow?, similar to 'clear' with filterobjects?)
    • Oct 27 2011 | 6:20 am
      "first scale frequency as mentioned in the pseudocode fc = in1 / ( samplerate / 2 );"
      awww crap, i can't believe i completely overlooked that. :p
      "use + instead of += and * instead of *="
      hmmm.... interesting, didn't even think of that, just assumed it needed to accumulate, but i see now.
      "(is it possible to reset history somehow?, similar to 'clear' with filterobjects?)"
      in a later version i set the history objects with a third argument of '0' as they are supposed to be initialized that way. and likewise, with the history objects named "a1", etc. you can send a message to gen~'s left-most inlet that reads, "a1 0, a2 0, a3 0, a4 0, b4 0" to clear everything and reset the history.
      as for smooth parameter changes, i bet that would be a bit simpler, either implement the gen~ example for slide~ or some creative use of the mix or smoothstep operators within gen~... just ideas...
      Great stuff, Timo! Thanks!
    • Oct 27 2011 | 8:30 am
      Nice one for the pseudocode, raja. All over this one!
      BTW, did you spot my [gen~]-based sinc interpolator? You might be interested.
    • Dec 09 2011 | 4:49 am
      Here it is. I tweaked it to improve the tuning and adjust for volume discrepancies; feel free to get rid of the latter if it doesn't suit your purposes. I think it sounds pretty decent. I've also posted it in my toolbox, so it'll be showing up there soon.
      And the helpfile:
    • May 03 2012 | 6:59 pm
      finally revisited this :p
      christripledot, no, never saw that, feel free to drop a link if you find this.
      peter, nice work.