[sdiy] MIDI volume to volts formula

Ben Bradley ben.pi.bradley at gmail.com
Tue Jun 5 02:53:43 CEST 2018

"So ultimately you'll likely have a 127 entry lookup table."

I have the impression this is usually the way it's done, as there
doesn't appear to be any standard regarding velocity. I've read about
the "velocity curve" on various synths, so this is appareltny a known
problem that various generators and receivers use different
algorithms/"standards" to generate and respond to velocity, and for
some devices it's user-changeable in an attempt to match things up.

This is also dependent (in many ways) on the keyboard you're using.
Velocity can be "good" (as in you can make a certain volume pretty
consistently) on a weighted (has a piano-like mechanical action) or
semi-weighted (the keys have weights to give a better feel) keyboard,
unfortunately even most non-weighted keyboards have velocity
sensitivity, and it just feels too hard to control to me. YMMV - I'm
at best a fair pianist/keyboardist. Amazingly, the little two-octave
keyboard for Rock Band 3 (I have a few I got cheap at thrift stores)
not only has MIDI out, it has velocity sensitivity! IMHO, a needed
feature, especially on these cheap keyboards, is a way to turn off
velocity sensitivity.

If you really want to see some interesting conversation, there's this
new feature patched into the MIDI standard that uses a CC to increase
the velocity resolution. Just google this:
high resolution midi velocity

On Mon, Jun 4, 2018 at 8:09 PM, Pete Hartman <pete.hartman at gmail.com> wrote:
> I have always done a linear function, e.g. Vpp * (vel / 127).
> However, now that you mention it, it does seem like a log function of some
> sort (like the rising side of a traditional analog envelope) would be more
> appropriate.
> That rising envelope is capacitor time charging Vc = Vs ( 1 - e^(-t/RC)) and
> it's expected that full charge is at t = 5RC.  You could probably fudge and
> say 4RC, because the last of the 5 time constants is nearly level anyway.
> Mapping that function to what we're talking about and using 4RC as the
> standard, for Vpp max == 1V, you'd have Vpp = 1 - e ^ -(4 * vel / 127).
> Do beware: it is best to avoid floating point operations unless you have a
> really solid processor (e.g. I bet a teensy could handle it; a PIC
> definitely can't).  So ultimately you'll likely have a 127 entry lookup
> table.  That would let you create any function you care to, quite honestly.
> I would just precompute the entries for the Vpp function just mentioned, and
> scale them so they're integers (probably *1024 or whatever resolution your
> DAC has).
> On Mon, Jun 4, 2018 at 6:43 PM, John Speth <john.speth at andrews-cooper.com>
> wrote:
>> I have been having a difficult time finding a workable formula for
>> converting the MIDI velocity value (the third byte in a note on/off message)
>> to a Vpp value.  Does anybody know the mathematical formula for this
>> conversion?  Something like Vpp = func(velocity).  Let’s assume Vpp(max,
>> when velocity is 127) is 1.0V.
>> The reason I need to know is I have device that I can control frequency in
>> terms of Hz and velocity in terms of Vpp.  I’m not sure if I need a function
>> based on log10() or antilog10().
>> Thanks and sorry for the dopey question.
>> JJS
>> _______________________________________________
>> Synth-diy mailing list
>> Synth-diy at synth-diy.org
>> http://synth-diy.org/mailman/listinfo/synth-diy
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy

More information about the Synth-diy mailing list