Velocity affecting amplitude


    Sep 27 2009 | 6:31 pm
    I can't for the life of me figure out the algorithm so i thought I would post. Can anyone give me a lead on the math if I want to affect a signal's level based on a percentage of velocity? For example, on a lot of synths, like Ableton Operator, you can set a percentage that the oscillator's level will be affected by the midi velocity. If set at 100%, a 127 would cause maximum volume, and a 1 would be barely audible. But if it is set to 50%, a 1 velocity would not necessarily cause an in-audible signal. Likewise, a -100% would cause a velocity of 127 to create an in-audible signal, but a velocity of 1 to cause maximum amplitude. I am aware one of the tutorial 19 sort of talk about this using an exponential expression, but it assumes you are always using the velocity to determine 100% of the amplitude. I want to be able to create a component that I could say the velocity affects the signal by say 80% (or -80%).

    • Sep 27 2009 | 6:32 pm
      by the way, here is my miserable attempt, which works (but feels wrong) for positive percentage modifier amounts, but doesn't have the inverse affect on negative percentage modifier amounts.
    • Sep 28 2009 | 9:41 pm
      something like this?
    • Sep 28 2009 | 10:47 pm
      ...or like this?
      going above 100% (or below -100%) will invert the velocity curve, so that higher velocity values will be more dynamic.
      I'm not sure if you can literaly say percent thou...
    • Sep 29 2009 | 2:35 am
      always break down things to a range of 0. 1. before you
      calculate offsets and modulations, then you can work on
      the linear layer.
      velocity (input)
      /127. (scaling)
      * percentage/100 (mod amount)
      + current velocity (offset)
    • Sep 29 2009 | 3:03 am
      thanks guys for the help, i tried both examples and they worked the exactly the way i was wanted, i am embarrassed to think how much time i sunk trying to figure this out, it appears i still don't quite think in the max fashion of development, still trying to force programing paradigms from my day job where they don't apply. it looks like from your examples i was sort of close in my latest attempts, but i was always trying to duplicate the signal, modify one by velocity then recombine the percentage of each vs. doing the math, then modifying the signal. I was always getting either the positive values to work, or the negative ... not both. it seems sort of obvious now looking at your examples, that to get the inverse velocity affect, you just add 1!!!!!! doh
      roman, thanks for the tip, i usually do do that outside of a given module in the ui or algorithm layer, always expecting something between 0 to 1 (or -1 to 1) in my re-usable component.
      thanks again, i learned a lot in the process.