Click here to watch this tutorial on YouTube™
Now that you are familiar with the basics of tracker notation (Tutorial 1), we will start to add more dynamic behaviour to our music, using code and formulas. Formulas work like they do in spreadsheets - each cell contains simple expressions that define what the data should be. They have a variety of uses: from simple ad-hoc events and edit automation, to more complex applications in generative music (such as minimalism, process-based music, or algorithmic composition).
Each pattern cell can have formulas for each of its properties; pitch, volume, etc. To edit the formula, move the cursor to the cell and press = (Open Formula Editor). After editing, pressing Enter will close the editor and return you to the pattern (the formula will also be executed, unless Alt is held). Alternatively, press Escape to cancel the edit.
The execution of a cell's formulas is triggered when the cell is played. Thus, as playback loops over the pattern, formulas can be used to evolve the music.
Some basic formula examples:
- Move to the first cell of Channel 01 ("Control") and press = to show the formula editor.
- In the .volume box, enter the simple math expression below, and press Enter. The editor will close and the formula result will be visible in the pattern. The value is shaded blue to show it is the result of a formula, rather than a manual edit.
.volume1 + 2
- The cell volume should be 03. Manually change it to a different volume, then play the pattern. As the cell is played, the formula replaces the edited value.
- Such simple arithmetic can be useful if you don't want to work values out in your head (e.g. 64/3) or to enter an hex values in decimal, but formulas are more useful when used to modifier existing data.
- Return to the cell's formula editor. Notice how each property is preceded by a dot (e.g. ".volume"). The dot provides us a way of accessing a cell's existing values. Change the formula so it takes the existing volume and adds one:
.volume.volume + 1
- Move before the cell, and press Space to start playback. The value is incremented each time the cell is played, such that any music would gradually become louder on each repeat.
- When ready, press 2 (top) to continue.
| Useful Keys | |
| = | Edit cell formula. |
| Shift = | Edit selection using formula. |
| Alt-Shift = | Show all pattern formulas / code. |
Formulas can be used to create or change any aspect of the music. They can be especially powerful when combined with musical effects - the last column of each channel. Such effects include dynamics changes, pitch slides, vibrato, repeats, tempo, etc. If you move the cursor to the effects column (.00) and press ⌘H (Help), you will get a complete list of the effects available in the program (press Escape to go back).
Use formulas to create an accelerando effect:
- Like the previous volume example, we will use a formula to set a tempo that becomes faster with every repeat.
- In the first cell of the pattern, set the tempo to 32 bpm ("20" in hex) using the Tempo (@xx) effect:
··· ·· ·· @20
- Unmute Channels 2 to 5 (in blue), and listen to the extract from "Zorba's Dance" by Mikis Theodorakis, which famously starts slow and builds in tempo.
- Similar to before, add a formula for the effect parameter (.param) of our tempo mark, which takes the existing value and adds 10 bpm each time:
.param.param + 10
- Enter the formula and then press Alt-Space to audition the piece. If you want to reset the tempo back to a slower rate, simply overwrite the value in the cell - the formula will continue to increment it.
- When ready, click 3 (top) to move to the final step.
| Useful Keys | |
| = | Edit cell formula. |
| Shift = | Edit selection using formula. |
| Alt-Shift = | Show all pattern formulas / code. |
| Ctrl-H | Show context-sensitive help (for code reference, effect descriptions). |
| Ctrl-K | Show formula keyboard shortcuts. |
In addition to the basic maths operators ( +, -, *, / ), formulas support a number of functions, which can be used to modify or generate values. These include traditional maths functions like absolute value (abs), modulo (mod), and trigonometry (sin, cos, tan), and also special functions like random number generators (rnd). Randomisation is a powerful tool in generating dynamic behaviour and giving your music a life of its own - whether in subtle and controlled ways, or more experimental fashion (e.g. Aleatoric music).
Use the random function to humanise the drums:
- Unmute the Tambourine part in Channel 6 (in teal). Listen to it accompanying the guitar - despite the dynamic and timing varation, it sounds very mechanical - especially when playing fast.
- The function, rnd(x, y), generates a random number between x and y (inclusive). We will use it to add random variation to the dynamics (volume) and syncopation (note delays).
F#4 64 .00
F#4 32 +01
F#4 48 .00
F#4 32 +01 - In the first four rows of the channel, add formulas for the volume that generate random values between the original volume and 16 below. Here is the code for the first cell, where volume is 64:
.volumernd(64-16,64)
- In the second and fourth row, note delay (+xx) effects are used to create a syncopated rhythm. Add formulas for the effect parameter (.param) to randomly vary the delay amount (xx) between 0 and 2 ticks (by default, each row is divided into 6 ticks):
.paramrnd(0,2)
- When ready, press Space to audition the piece. You can also press Alt-0 to solo the channel and listen to it on its own. The percussion should sound a little less mechanical now.
| Useful Keys | |
| = | Edit cell formula. |
| Shift = | Edit selection using formula. |
| Alt-Shift = | Show all pattern formulas / code. |
| Ctrl-H | Show context-sensitive help (for code reference, effect descriptions). |
| Ctrl-K | Show formula keyboard shortcuts. |