]> Shamusworld >> Repos - ardour-manual/blob - include/transforming-midi---mathematical-operations.html
Fix a typo in manual
[ardour-manual] / include / transforming-midi---mathematical-operations.html
1
2 <p>
3         Considering the numerical nature of MIDI events, it can be tempting to apply
4   mathematical transformations to our MIDI regions by using mathematical
5   operations. Ardour makes it very easy and powerful with the Transform tool.
6 </p>
7
8 <figure>
9         <img src="/images/MIDI_transform.png" alt="MIDI transformation">
10         <figcaption>MIDI transformation</figcaption>
11 </figure>
12
13 <p>
14         Accessing the Transform tool is done by <kbd class="mouse">right</kbd> clicking
15         the MIDI region <kbd class="menu">&gt;<em>name_of_the_region</em> &gt; MIDI
16         &gt; Transform&hellip;</kbd>
17 </p>
18
19 <p>
20         To act on a property, it must be selected in the <kbd
21         class="menu">Set</kbd> field, then the target value must be changed using the two
22         following fields. To add more operands the "+" sign should be clicked to
23         create new lines. These can be removed using the "-" sign on the
24         right of the newly created lines.
25 </p>
26
27 <p>
28         In the picture above, the Transform tool has been used to add a bit of
29         humanization, by slightly changing the velocity of each note of the region, by
30         a random number between -19 and +19 from its original velocity. So
31         three operations are applied:
32 </p>
33
34 <ul>
35         <li>Set velocity to this note's velocity</li>
36         <li>+ a random number from 1 to 20</li>
37         <li>- a random number from 1 to 20</li>
38 </ul>
39
40 <p>
41         Each note will trigger a calculation of its own, so its velocity will be
42         increased by a random number between 1 and 20, then decreased by a random
43         number between 1 and 20.
44 </p>
45
46 <p>
47         The properties that can be computed are:
48 </p>
49
50 <ul>
51         <li>note number (eg C2 is note number 24, C#2 is 25 and <a href="@@midi-notes-ref">so on</a>)</li>
52         <li>velocity (the global intensity of the note, between 0 and 127)</li>
53         <li>start time (in beats)</li>
54         <li>length (in beats)</li>
55         <li>channel</li>
56 </ul>
57
58 <p>
59         and the calculation may be based on the following properties:
60 </p>
61
62 <ul>
63         <li>this note's</li>
64         <li>the previous note's</li>
65         <li>this note's index (number of the note, i.e. the first one is 0, the second
66                 is 1, etc.)</li>
67         <li>exactly (for a constant value, between 1 and 127)</li>
68         <li>a random number from <em>lower</em> to <em>higher</em> (<em>lower</em> and
69                 <em>higher</em> beeing constant values between 1 and 127)</li>
70         <li>equal steps from <em>lower</em> to <em>higher</em> (<em>lower</em> and
71                 <em>higher</em> beeing constant values between 1 and 127).</li>
72 </ul>
73
74 <p>
75         The mathematical operators can be:
76 </p>
77
78 <ul>
79         <li>+ (addition)</li>
80         <li>- (subtraction)</li>
81         <li>* (multiplication)</li>
82         <li>/ (euclidian division)</li>
83         <li>mod (remainder of the euclidian division).</li>
84 </ul>
85
86 <p class="note">
87         All these operations can be very handy, as long as there is a mathematical way
88         to achieve the targeted goal. Beware though of odd "border cases": division by
89         zero (which does nothing), using the note's index and forgetting it starts at
90         0 and not 1, etc.
91 <p>
92
93 <p>
94         Very interesting results can nevertheless be created, like humanizing
95         (randomizing the velocity, start time and duration of all the notes), creating
96         arpeggios, automating tedious tasks, transposing, etc.
97 </p>