<div dir="ltr">I have always done a linear function, e.g. Vpp * (vel / 127).<div><br></div><div>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.</div><div><br></div><div>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).<br><br>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). <br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 4, 2018 at 6:43 PM, John Speth <span dir="ltr"><<a href="mailto:john.speth@andrews-cooper.com" target="_blank">john.speth@andrews-cooper.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_-3036829753704237958WordSection1">
<p class="MsoNormal">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.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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().<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks and sorry for the dopey question.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">JJS<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<br>______________________________<wbr>_________________<br>
Synth-diy mailing list<br>
<a href="mailto:Synth-diy@synth-diy.org">Synth-diy@synth-diy.org</a><br>
<a href="http://synth-diy.org/mailman/listinfo/synth-diy" rel="noreferrer" target="_blank">http://synth-diy.org/mailman/<wbr>listinfo/synth-diy</a><br>
<br></blockquote></div><br></div>