| 1 | <refentry id="ampmidicurve"> |
| 2 | <indexterm id="Indexampmidicurve"><primary>ampmidicurve</primary></indexterm> |
| 3 | <refentryinfo><title>Real-time MIDI:Converters</title></refentryinfo> |
| 4 | <refmeta> |
| 5 | <refentrytitle>ampmidicurve</refentrytitle> |
| 6 | </refmeta> |
| 7 | |
| 8 | <refnamediv> |
| 9 | <refname>ampmidicurve</refname> |
| 10 | <refpurpose> |
| 11 | Maps an input MIDI velocity number to an output gain factor with a |
| 12 | maximum value of 1, modifying the output gain by a dynamic range and a |
| 13 | shaping exponent. |
| 14 | </refpurpose> |
| 15 | </refnamediv> |
| 16 | |
| 17 | <refsect1> |
| 18 | <title>Description</title> |
| 19 | <para>Plugin opcode in ampmidid.</para> |
| 20 | <para> |
| 21 | Maps an input MIDI velocity number to an output gain factor with a |
| 22 | maximum value of 1, modifying the output gain by a dynamic range and a |
| 23 | shaping exponent. The minimum output gain is 1 minus the dynamic range. |
| 24 | A shaping exponent of 1 gives a linear response; increasing the exponent |
| 25 | produces an increasingly depressed knee in the gain response curve. |
| 26 | </para> |
| 27 | </refsect1> |
| 28 | |
| 29 | <refsect1> |
| 30 | <title>Syntax</title> |
| 31 | <synopsis>igain <command>ampmidicurve</command> ivelocity, idynamicrange, iexponent</synopsis> |
| 32 | <synopsis>kgain <command>ampmidicurve</command> kvelocity, kdynamicrange, kexponent</synopsis> |
| 33 | </refsect1> |
| 34 | |
| 35 | <refsect1> |
| 36 | <title>Initialization</title> |
| 37 | <para> |
| 38 | <emphasis>imidivelocity </emphasis> -- MIDI velocity number, ranging from |
| 39 | 0 through 127. |
| 40 | </para> |
| 41 | |
| 42 | <para> |
| 43 | <emphasis>idynamicrange</emphasis> -- Intended dynamic range of gain, from |
| 44 | 0 through 1. |
| 45 | </para> |
| 46 | |
| 47 | <para> |
| 48 | <emphasis>iexponent</emphasis> -- Exponent applied to shape the gain |
| 49 | response curve, 1 or greater. |
| 50 | </para> |
| 51 | </refsect1> |
| 52 | |
| 53 | <refsect1> |
| 54 | <title>Performance</title> |
| 55 | <para> |
| 56 | <emphasis>kmidivelocity </emphasis> -- MIDI velocity number, ranging from |
| 57 | 0 through 127. |
| 58 | </para> |
| 59 | |
| 60 | <para> |
| 61 | <emphasis>kdynamicrange</emphasis> -- Intended dynamic range of gain, from |
| 62 | 0 through 1. |
| 63 | </para> |
| 64 | |
| 65 | <para> |
| 66 | <emphasis>kexponent</emphasis> -- Exponent applied to shape the gain |
| 67 | response curve, 1 or greater. |
| 68 | </para> |
| 69 | |
| 70 | <para> |
| 71 | Maps an input MIDI velocity number to an output gain factor with a |
| 72 | maximum value of 1, modifying the output gain by a dynamic range and a |
| 73 | shaping exponent. The minimum output gain is 1 minus the dynamic range. |
| 74 | A shaping exponent of 1 gives a linear response; increasing the exponent |
| 75 | produces an increasingly depressed knee in the gain response curve, |
| 76 | according to the equation: |
| 77 | y = d * (x/127)^h + 1 - d, |
| 78 | where y = the gain, |
| 79 | x = the input MIDI velocity (from 0 through 127), |
| 80 | d = the dynamic range (from p through 1), and |
| 81 | h = the shaping exponent (1 or greater). |
| 82 | This opcode was suggested by Mauro Giubileo. |
| 83 | </para> |
| 84 | </refsect1> |
| 85 | |
| 86 | <refsect1> |
| 87 | <title>Examples</title> |
| 88 | <para> |
| 89 | Here is an example of the ampmidicurve opcode. It uses the file <ulink url="examples/ampmidicurve.csd"><citetitle>ampmidicurve.csd</citetitle></ulink>. |
| 90 | <example> |
| 91 | <title>Example of the ampmidicurve opcode.</title> |
| 92 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 93 | <xi:include href="examples-xml/ampmidicurve.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 94 | </example> |
| 95 | </para> |
| 96 | </refsect1> |
| 97 | |
| 98 | <refsect1> |
| 99 | <title>See also</title> |
| 100 | <para><link linkend="MidiConvert"><citetitle>Midi Converters</citetitle></link></para> |
| 101 | </refsect1> |
| 102 | |
| 103 | <refsect1> |
| 104 | <title>Credits</title> |
| 105 | <para> |
| 106 | <simplelist> |
| 107 | <member>Author: &namemichael;</member> |
| 108 | <member>2019</member> |
| 109 | </simplelist> |
| 110 | </para> |
| 111 | |
| 112 | </refsect1> |
| 113 | </refentry> |