Gen~ plugin with midi input


#1

Hey,
I want to write a Gen~ patch that can enhance my drum samples (played through an SPD). I want the velocity of the hits to determine the amount of filtering/distortion that is applied to the audio signal coming in. This way, the samples should sound more lively.
I’ve managed to write a Gen patch and I’ve successfully uploaded the patch to my mod. However, I can only assign values through a knob.

How can I write a mod plugin using Gen that takes both audio and midi as input?
OR
How can I have midi velocity modulate a knob in my plugin?


#2

I figured I could also solve it by trying to program an envelope follower using Gen~ and then use the volume as an indicator for the distortion/filtering amount.
But that would not be the same because some samples are louder than others and will therefore be processed differently than others even though they could could be hit with the same velocity. So I might have found a work-around, but my first question still stands.