mapping MIDI velocity to 0. to 1. range (non-linear)


    Dec 05 2008 | 7:16 pm
    I want to efficiently map MIDI velocity (0 to 127) into an amplitude range from 0 to 1. I want it to be a non-linear mapping.
    I'm doing this:
    input_value (0 to 127 MIDI velocities)
    |
    [pow 4.]
    |
    [/ 260144640.]
    |
    output_value (0. to 1. for use with a [*~] object)
    Is there a more efficient way to do this using standard math objects?
    Also, how would I write the above using the [expr ] object?
    Thanks in advance,
    Mitch

    • Dec 05 2008 | 7:22 pm
      do you know about linedrive and scale?? both can do exponential mapping.
    • Dec 05 2008 | 7:32 pm
      Yes, I know about them. I'd like to be able to port this over to Pd very easily. I'n not sure they are available for Pd.
      Mitch
    • Dec 05 2008 | 7:34 pm
      I usually use [expr pow(($i1/127.),$f2)]. If the right inlet is 1 the conversion is linear. I'd recommend starting with something like 0.7 and adjusting it from there.
      lh
    • Dec 05 2008 | 10:11 pm
      The lp.scampf object from Litter Power will do this with its default settings and a 'pow $1' or 'exp $1' message, where the parameter controls the steepness of the curve.
      Later on I read you want a Pd solution. In that case you'll probably have to roll your own. For better or worse, I do not see a Litter Power for Pd in the immediate future.
      Good luck anyway,
      Peter
    • Dec 06 2008 | 3:06 pm
      Thanks to all for the help.
      Mitch
    • Dec 08 2008 | 4:32 am
      you can create curves in a buffer
      On Sat, Dec 6, 2008 at 4:06 PM, Mitch Turner wrote:
      >
      > Thanks to all for the help.
      > Mitch
      > --
      > http://home.lagrange.edu/mturner
      >