/*
for sforzando and sfz-player

---------------------------------------------------------------------------------------------------------------------

amp_veltrack
---------------
Amplifier velocity tracking, represents how much the amplitude changes with incoming note velocity.
Volume changes with incoming velocity in a concave shape according to the following expression:

Amplitude(dB) = 20 log (127^2 / Velocity^2)

(The amp_velcurve_N opcodes allow overriding the default velocity curve.)

Examples:
amp_veltrack=0
amp_veltrack=100

default = 100%
range = -100 to 100 %

---------------------------------------------------------------------------------------------------------------------

amp_velcurve_1
amp_velcurve_127
---------------------
User-defined amplifier velocity curve. This opcode range allows defining a specific curve for the amplifier velocity.
The value of the opcode indicates the normalized amplitude (0 to 1) for the specified velocity.

The player will interpolate lineraly between specified opcodes for unspecified ones:

amp_velcurve_1=0.2 amp_velcurve_3=0.3
// amp_velcurve_2 is calculated to 0.25

If amp_velcurve_127 is not specified, the player will assign it the value of 1.

Examples:
// linear, compressed dynamic range
// amplitude changes from 0.5 to 1
amp_velcurve_1=0.5

default = standard curve (see amp_veltrack)
range = 0 to 1
*/

slider1:127<1,127,1>velocity
slider2:0<-200,0>velocity to dB
slider4:100<0,100>(velocity) to %
slider5:100<0,100>(velocity to dB) to %

in_pin:none
out_pin:none

@block

slider2 = -20 * log(127^2/slider1^2); // vel to dB
sliderchange(slider2);

slider4 = (slider1*100)/127; // vel to %
sliderchange(slider4);

slider5 = 100 - (abs(slider2)*100)/200; // vel to dB to %
sliderchange(slider5);
