amplitude to velocity - scaling question

Ben Carey's icon

Hi,

I've been using fiddle~ in a recent monophonic audio tracking abstraction that can be used to send pitch and velocity information to a synthesiser (both MaxMSP and other software/external synths).

My question refers to the scaling of fiddle's amplitude outlet into velocity values. When packing a note-on with the corresponding amplitude, I was wondering if it would be necessary to scale the amplitude output in any other way other than just converting the 0-100 range into the 0-127 MIDI velocity range? Rather than posting the whole abstraction here, I have attached a simple patch to demonstrate an example of the scaling I am presently using.

Is it necessary at all to scale these amplitude values exponentially? If so, and understanding that each synthesiser will conceivably convert velocity values to amplitude in its own way, is it advisable to find one particular method for scaling these values, or in this instance is there 'more than one way of skinning a cat'?

Any thoughts are welcome...

Thanks,

Max Patch
Copy patch and select New From Clipboard in Max.

Ben

Roman Thilenius's icon

midi volume or the velocity-to-gain settings of hardware is usually linear,
so you could use the common methods of db/A to linear conversion, which
is log10(n)*20:

110.amp2db
     [expr max((log10($f1)*20),-90.]

110.db2amp
     [expr (pow(10.,$f1*0.05))*($f1!=-90.)]

0. - 1. -90. - 0.

*127. for midi ....