]> Shamusworld >> Repos - ardour-manual/blob - include/transforming-midi---mathematical-operations.html
Ruler/Markers rewrite, part 5 of N
[ardour-manual] / include / transforming-midi---mathematical-operations.html
1
2 <figure class="right">
3   <img src="/images/MIDI_transform.png" alt="MIDI transformation">
4   <figcaption>The MIDI transformation dialog</figcaption>
5 </figure>
6
7 <p>
8   Considering the numerical nature of MIDI events, it can be useful to
9   transform a MIDI region by applying mathematical operations to it. Ardour
10   makes this kind of powerful transformation very easy with the Transform tool. 
11   The tool makes possible things such as humanizing (randomizing the velocity,
12   start time and duration of all the notes), creating arpeggios, automating
13   tedious tasks, transposing, etc.
14 </p>
15
16 <p>
17   The Transform tool is accessed by <kbd class="mouse">right</kbd>-clicking
18   the MIDI region &gt; <em>name_of_the_region</em> &gt; MIDI &gt; Transform&hellip;.
19 </p>
20
21 <p>
22   First, the property to be modified in the <kbd class="menu">Set</kbd> field
23   is selected, then the target value is changed using the two fields that
24   follow. If more operands are desired, the <kbd class="menu">+</kbd> button is
25   clicked to create new lines. Any superfluous line can be removed by clicking
26   on the <kbd class="menu">-</kbd> button on the right side of the line to be
27   removed. Finally, once everything is set as desired, the <kbd
28   class=menu>Transform</kbd> button is pressed to apply the transformation.
29 </p>
30
31 <p>
32   In the image above, the Transform tool has been used to add a bit of
33   humanization, by slightly changing the velocity of each note of the region by
34   a random number between -19 and +19 from its original velocity. So the
35   following three operations are applied:
36 </p>
37
38 <ul>
39   <li>Set velocity to this note's velocity</li>
40   <li>+ a random number from 1 to 20</li>
41   <li>- a random number from 1 to 20</li>
42 </ul>
43
44 <p>
45   Each note will trigger a unique calculation, where its velocity will be
46   increased by a random number between 1 and 20, then decreased by a random
47   number between 1 and 20. This will result in a new velocity being applied to
48   the note, which will be the original velocity plus or minus a value &lt;19.
49 </p>
50
51 <p>
52   The parameters that can be transformed are:
53 </p>
54
55 <ul>
56   <li>MIDI note number (e.g. <a href="@@midi-notes-ref">C2 is note number 24,
57   C#2 is 25, etc.</a>)</li>
58   <li>MIDI velocity (the volume of the note, between 0 and 127)</li>
59   <li>start time (in beats)</li>
60   <li>length (in beats)</li>
61   <li>MIDI channel</li>
62 </ul>
63
64 <p>
65   and the transformation can be based on any of the following:
66 </p>
67
68 <ul>
69   <li>this note's</li>
70   <li>the previous note's</li>
71   <li>this note's index (number of the note, i.e. the first one is 0, the second
72   is 1, etc.)</li>
73   <li>exactly (for a constant value, between 1 and 127)</li>
74   <li>a random number from <em>lower</em> to <em>higher</em> (<em>lower</em> and
75   <em>higher</em> being constant values between 1 and 127)</li>
76   <li>equal steps from <em>lower</em> to <em>higher</em> (<em>lower</em> and
77   <em>higher</em> being constant values between 1 and 127)</li>
78 </ul>
79
80 <p>
81   The mathematical operators are:
82 </p>
83
84 <ul>
85   <li>+ (addition)</li>
86   <li>- (subtraction)</li>
87   <li>* (multiplication)</li>
88   <li>/ (euclidian division)</li>
89   <li>mod (remainder of the euclidian division)</li>
90 </ul>
91
92 <p class="note">
93   While the Transform tool is powerful, it is not infallible.
94   Things like division by zero (which does nothing), using the note's index and
95   thinking that it starts at one (instead of zero), etc. can yield
96   unexpected results.
97 <p>
98