13. Rendering, scripts, and takes

III. The machine

Rendering, scripts, and takes

Every clip in this manual is a script: a text file of timed events, such as press A4 at 0 seconds, let it go at 2, played through the synth without a window and written to a sound file. This chapter is about scripts: how to render one, every command they hold, why a render is the same every time, how the window plays one, and how the window writes one from what you play, which is a take.

This one plays three notes:

# Three notes up a C major chord, then the last one's release.
0      on C4
0.5    off C4
0.5    on E4
1      off E4
1      on G4
2      off G4
2.5    end

Rendering

synth render plays a script and writes what the synth does to a WAV file:

zig build run -- render manual/synth/13-scripts/first.txt first.wav

It prints one line when it's done:

first.wav: 2.500 s, 6 events, peak -18.9 dBFS

That is the file's length, the number of events the script held, and the loudest sample in it, in decibels below full scale. A file that's silent reads −120 dBFS.

peak −18.9 dBFS 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 s 0.2 0.1 0.0 −0.1 −0.2

0.0 / 2.5 s

peak -18.9 dBFS

Fig. 13.1 The three notes from first.txt, on the panel's default sound.

renderzig build run -- render manual/synth/13-scripts/first.txt first.wav

first.txt
# Three notes up a C major chord, then the last one's release.
0      on C4
0.5    off C4
0.5    on E4
1      off E4
1      on G4
2      off G4
2.5    end

The file is stereo, 48,000 samples a second, each sample a 32-bit floating-point number: the numbers the synth computed, with nothing rounded away. Most audio programs open it, and ffmpeg turns it into anything else. A render runs as fast as the computer can go: on the machine this manual was built on, the 30 seconds of examples/steps.json render in about two seconds.

Before the first event, a render can set the machine up:

  • --project FILE loads a project, the whole machine (chapter 11), as the window would.
  • --patch FILE or --patch A22 loads a patch file or a slot of the bank onto part 1, after the project if there is one.

Without either, the render starts from the window's defaults: four parts in manual, at 120 BPM, with nothing sent to the delay or the reverb, and the volume at −12 dB.

Scripts

Each line of a script is a time in seconds, a command, and the command's arguments, separated by spaces. A # starts a comment, to the end of the line, so a script writes keys with flats, Eb4, never sharps; C#4 would be C and a comment. Blank lines don't count.

  • Times run from 0 to 3600, an hour, and can't go back: each line's time is the same as the line before or later. Events at the same time happen in the order of the lines.
  • Keys are names, from C-1 to G9, with C4 as middle C, or MIDI numbers, from 0 to 127, with C4 as 60.
  • Mistakes stop the render before it starts, and say where: synth: bad.txt:3: times can't decrease.

Here is every command at once, on a project that puts a bass on part 1, strings on part 2, and a unison lead on part 3:

Every command a script has. Part 1 loads a bass line and plays it, part 2 plays chords in chord mode with the pedal, and part 3 a lead; then the tempo rises, the bass changes sound, and a panic lets go of everything. The capture is at 2.3 seconds, three tenths of a second into the lead.: the top Every command a script has. Part 1 loads a bass line and plays it, part 2 plays chords in chord mode with the pedal, and part 3 a lead; then the tempo rises, the bass changes sound, and a panic lets go of everything. The capture is at 2.3 seconds, three tenths of a second into the lead.: the parts

0.0 / 6.5 s

peak -12.5 dBFS

Fig. 13.2 Every command a script has. Part 1 loads a bass line and plays it, part 2 plays chords in chord mode with the pedal, and part 3 a lead; then the tempo rises, the bass changes sound, and a panic lets go of everything. The capture is at 2.3 seconds, three tenths of a second into the lead.

openzig build run -- manual/synth/13-scripts/every.txt

renderzig build run -- render manual/synth/13-scripts/every.txt every.wav

every.txt
# Every command a script has, on the project every.json: part 1 loads a bass
# line and plays it, part 2 plays chords in chord mode with the pedal, and
# part 3 plays a lead. Keys are names, with flats, or MIDI numbers.
0      project every.json
0      part 1
0      seq load              # from here, each key stores a step
0      on C3
0      off C3
0      on C4
0      off C4
0      rest
0      on Eb3
0      off Eb3
0      tie                   # the next step slurs from this one
0      on F3
0      off F3
0      on G3
0      off G3
0      on Bb3
0      off Bb3
0      on G3
0      off G3
0      seq play
0      part 2
0      set voice_mode chord
0      chord 0 3 7 10        # a minor seventh on each key
0      on C4 0.6
0.9    pedal down
1      off C4                # the pedal holds it
1.9    pedal up
2      chord Ab3 C4 Eb4 G4   # the same command from keys: a major seventh
2      on Ab3 0.6
2      part 3
2      on G4 0.8
2.5    on 72 0.8             # C5, gliding up from G4
2.6    off G4
2.6    set cutoff 1500
3      off 72
3      set tempo 132         # the whole machine's, whatever the part
3      part 1
3      patch A54             # a new sound for the bass; its sequence stays
3.5    part 2
3.5    off Ab3
3.5    part 3
3.5    on Eb5 0.9
4.25   on D5
4.4    off Eb5
4.75   part 1
4.75   seq off
5      panic                 # lets go of D5, and of anything else still down
6.5    end
every.json
{
  "delay_time": "1/8.",
  "reverb_decay": 60,
  "parts": [
    { "patch": "A52", "level": -3 },
    { "patch": "A22", "level": -8, "reverb_send": 30 },
    { "patch": "A61", "level": -6, "delay_send": 35, "reverb_send": 15 }
  ]
}

Open the script and its project in the figure, and read the script with this list:

  • project every.json names the project the script plays on, in the same directory as the script. It may only be the first line, at time 0, and --project on the command line takes its place.
  • part 1 sends the lines after it to part 1, until the next part. Scripts start on part 1.
  • on C3 presses a key, and off C3 lets it go. on takes a velocity after the key, from 0 to 1, the MIDI velocity divided by 127: on 72 0.8 presses C5 at about velocity 102. Without one, it's 1.
  • seq load, seq play, and seq off are the sequencer's buttons. While it loads, each on stores a step, rest stores a silent step, and tie makes the next step slur from the one before (chapter 7).
  • set cutoff 1500 sets a control to a value, in the units its readout uses: hertz, seconds, percent, semitones, octaves, or decibels. A switch takes a position's name: set voice_mode chord, set range 4', set delay_time 1/8.. Every control has a set: the panel's, the performance buttons' (voice_mode, arp, hold, transpose), a part's row (level, pan, muted, divide, delay_send, reverb_send), the wheels (bend, modulation), and the master controls (tempo, swing, volume, mute, and the delay's and reverb's). The master controls belong to the whole machine, so set tempo 132 changes the tempo whichever part the lines are on.
  • chord 0 3 7 10 gives chord mode its chord, as 2 to 6 intervals in semitones from −36 to 36, one of them 0. chord Ab3 C4 Eb4 G4 is the same command with keys, as you'd teach it on the keyboard; the intervals are counted from the lowest.
  • pedal down and pedal up press and release the hold pedal.
  • patch A54 selects a slot of the bank, as Program Change does.
  • panic lets go of every note on every part and stops every sequence, as Esc does. Like the master controls, it ignores part.
  • end ends the render at its time. Nothing may follow it.

A script without end stops one second after its last event, so 0 on A4 and 1 off A4 render 2.000 seconds. A release longer than that, or a reverb's tail, is cut off; end a script where its sound has ended.

Each event happens on its own sample, even in the middle of one of the 128-sample blocks the synth computes at a time. A time becomes the nearest sample: 0.0104 s is sample 499.2, so sample 499, and 0.0105 s is sample 504. Measured, a note moved from 0.0104 to 0.0105 seconds starts exactly five samples later.

The same every time

Render a script twice and the two files are the same, byte for byte. Every clip in this chapter and every script in examples/ was rendered twice to check, and each pair matched. On this machine, a build optimized for speed (zig build -Doptimize=ReleaseFast), and one for the baseline x86-64 processor without its newer instructions (-Dcpu=baseline), render the same bytes as the default build.

A render is the same because nothing in it comes from outside the script: the synth starts from the same state every time, the oscillators at the same point of their cycle, the noise at the start of its pattern, and the delay and the reverb empty. Even what looks random repeats: a step's chance rolls from the same seed each time a sequence starts (chapter 8), and the drift of each voice follows the same path. So a render is a fact about a script, and a figure in this manual can say "measured, −6.0 dB" and mean it.

The window isn't like that. It's been running since it opened, so when a script plays there, its events land on the same samples relative to the script's start, but the oscillators, the LFOs, the drift, and the noise are wherever they had got to, and the delay and the reverb may still be ringing. It sounds the same, and it isn't the same samples.

Playing a script in the window

The window plays a script given to it instead of a patch:

zig build run -- manual/synth/13-scripts/every.txt

Dropping a .txt file on the window plays it too. The project on the script's first line loads first, and the script plays on it; a --project on the command line takes its place. The status line counts the bars and the time, as play bar 2 · 0:02 / 0:06, the panel follows the controls the script moves and the slots it selects, the part rows show the sequences, and the keys light as it plays them. You can play along on the keys or over MIDI; Esc stops the script, and panics. Ctrl+P plays it again (building a song, below).

Takes

A take is a script the window writes from what you play. Ctrl+R, or a click on rec in the top bar, starts one. It begins on the clock's next tick, at most a 32nd note later, so that its first sample lies on the clock's grid, and while it records, rec and its length show in amber. Ctrl+R stops it, and so does quitting. --record starts one with the window, so a project's parts, or --play, start in the take.

A take records:

  • the keys, from the computer, the on-screen keys, and MIDI, with their velocity;
  • every control you move, on the panel, the part rows, the bender, or over MIDI, and the tempo and swing;
  • the slots you select, the sequences you load, start, and stop, the chords you teach chord mode, the pedal, and Esc.

Each event lands on the sample where the synth applied it: for the keys, the mouse, and MIDI, the start of the audio buffer they arrived in. A launch that waits for the bar, a sequence started while another part plays or a pattern selected while its part plays (chapter 9), is recorded on the bar, where it happened, not where you asked for it.

A take doesn't record the volume or the mute, which are the listener's. Nor does it record what a script can't say: write, the edits you make to a step, a project dropped on the window, or the sequence of a dropped patch. When one happens during a take, the status line says not recorded.

A take is two files, written in the directory the synth started in and numbered from take-1: take-1.json, the project as it was when the take began, and take-1.txt, the script, whose first line names the project. This take was written by hand, in the recorder's format:

A take: a bass line already playing, and three chords played over it with a knob turned and the pedal held. The capture is at 2.5 seconds, after the switch to `A33`.: the top A take: a bass line already playing, and three chords played over it with a knob turned and the pedal held. The capture is at 2.5 seconds, after the switch to `A33`.: the parts

0.0 / 5.0 s

peak -9.7 dBFS

Fig. 13.3 A take: a bass line already playing, and three chords played over it with a knob turned and the pedal held. The capture is at 2.5 seconds, after the switch to A33.

openzig build run -- manual/synth/13-scripts/take-1.txt

renderzig build run -- render manual/synth/13-scripts/take-1.txt take.wav

take-1.txt
0          project take-1.json
0          part 2
0          on C4 0.62992126
0          on Eb4 0.62992126
0          on G4 0.62992126
0.618667   set cutoff 1353.2365
0.653333   set cutoff 1619.3875
0.688000   set cutoff 1937.8844
0.722667   set cutoff 2184.3015
0.757333   set cutoff 2613.9043
0.789333   set cutoff 3128.0002
0.824000   set cutoff 3525.7498
0.858667   set cutoff 3974.0764
1.069333   off C4
1.069333   off Eb4
1.069333   off G4
1.072000   on Ab3 0.70866144
1.072000   on C4 0.70866144
1.072000   on Eb4 0.70866144
2.120000   off Ab3
2.120000   off C4
2.120000   off Eb4
2.138667   patch A33
2.144000   on Bb3 0.78740156
2.144000   on D4 0.78740156
2.144000   on F4 0.78740156
2.901333   pedal down
3.000000   off Bb3
3.000000   off D4
3.000000   off F4
3.210667   part 1
3.210667   seq off
3.749333   part 2
3.749333   pedal up
5.000000   end
take-1.json
{
  "tempo": 112,
  "beat": 108,
  "parts": [
    {
      "patch": {
        "lfo_rate": 7.5,
        "sub": 60,
        "hpf": "0",
        "cutoff": 240,
        "resonance": 50,
        "filter_env": 4.2,
        "decay": 0.16,
        "sustain": 10,
        "release": 0.05,
        "trigger": "gate",
        "portamento": 0.04,
        "portamento_mode": "on",
        "sequence": [
          "C2",
          "C3",
          "-",
          "C2",
          "D#2",
          "~F2",
          "G2",
          "-",
          "C2",
          "~C2",
          "A#1",
          "C2",
          "D#3",
          "-",
          "G2",
          "A#2"
        ]
      },
      "playing": true,
      "step": 5,
      "loop": 3
    },
    {
      "patch": {
        "voice_mode": "poly1",
        "pulse": "on",
        "pwm": 50,
        "pwm_source": "lfo",
        "attack": 0.3,
        "release": 0.8,
        "chorus": "II"
      },
      "level": -4
    }
  ]
}

Its script, take-1.txt in the figure, reads like a log of a few seconds at the keys. It begins:

0          project take-1.json
0          part 2
0          on C4 0.62992126
0          on Eb4 0.62992126
0          on G4 0.62992126
0.618667   set cutoff 1353.2365
0.653333   set cutoff 1619.3875
0.688000   set cutoff 1937.8844

Times carry six decimals, a microsecond, which is a twentieth of a sample, so each reads back as the sample it was written from. A part line comes whenever the part changes. The keys held when the take began go down at time 0, and any still down when it stops come up at the time of end, on the lines before it. Velocities from MIDI are their value divided by 127, 0.62992126 for 80, and a knob turned over MIDI, or a fader dragged, is a run of set lines, one for each value it passed through: here, eight of them over a quarter of a second, as a knob on the filter's cutoff turns up.

The project, take-1.json, also in the figure, is the machine as the take found it. The recorder writes every part's patch whole, never as a slot's name, with every control on a line of its own, a couple of hundred lines in all; this one leaves out the controls at their defaults, which loads the same. Part 1 is B81's bass line, written out, and three fields say where the take found it: "beat": 108 is the clock's tick, counted in 32nd notes since it started, and part 1 has "playing": true, "step": 5, "loop": 3, so it was playing its sixth step, counting from 0, on its fourth time round. The render picks up with the seventh step, G2, on its first sample; measured, the first note of the clip is at 97 Hz, G2. A part loading a sequence, or running an arpeggio, says where it was too. A take started on a fresh clock, as --record with a project does, writes no beat, and its parts start from the top.

If you've written slots, the take's project holds them under "bank", so its patch lines select the slots as they were when you recorded, whatever the bank holds when the take is played.

A project may also say "clock": "steady". Then the clock starts afresh with the project, and a key or a start never restarts it once it has run, as it would when no other part uses the clock (chapter 9): an arpeggio's first key and a key on a synced LFO in lfo trigger mode play on the clock as it runs. The studio's clock never restarts, so a song it exports as a take says so, and plays as the song did. A take recorded over such a take keeps it.

To hear a take, play it in the window, zig build run -- take-1.txt, or drop it there, and watch the panel, the rows, and the keys do what you did; or render it, zig build run -- render take-1.txt take-1.wav. If a note is wrong, edit the line and render again. Record while a take plays, and the new take holds both: an overdub. A take may run an hour.

A replay lands everything you did, and every step the sequencers took, on the same sample as when you played it. It isn't the same waveform, for the reasons in the same every time. And a step or an arpeggio's note that was already sounding when the take began isn't in it; the take begins with the next one.

Building a song from takes

The last script the window played, or take it recorded, stays loaded as the take, and the window has a range of its bars to play and to record over. Bar 1 starts on the take's first sample, and each bar line of the clock after that starts the next. A bar line is every 32nd tick from the clock's start, and the clock restarting is one too, since every launch after it follows the new bars. The status line shows the bar while the take plays.

KeysCommandWhat it does
Ctrl+Ssave the patchSave the focused part's patch to its file
Ctrl+Shift+Ssave the projectSave the project: the tempo, the effects, the parts, and slots
Ctrl+RrecordRecord a take, or stop recording
Ctrl+Pplay the takePlay the take from the range's first bar, or stop it
Ctrl+Left, Ctrl+Rightmove the rangeMove the range a bar earlier or later; with Shift, eight
Ctrl+Up, Ctrl+Downsize the rangeMake the range a bar longer or shorter; with Shift, eight
Ctrl+Lloop the rangeLoop the range, or stop looping
Ctrl+Trecord a partRecord the focused part over the take's range, or stop

While the take plays, Ctrl+Left or Ctrl+Right jumps it to the range's new first bar. A range without bars runs to the take's end. The status line shows a range that isn't the whole take, such as bars 49–56 loop. On the command line, --from BAR, --to BAR, and --loop set it, and render takes --from and --to, where --to is the bar it stops at the start of:

zig build run -- --from 49 --to 57 --loop manual/synth/14-recipes/song.txt
zig build run -- render --from 49 --to 57 manual/synth/14-recipes/song.txt build.wav

Playing from a bar takes the machine as it stands there. The synth plays the take up to the bar without making a sound, running only the clock, the sequencers, and the take's events, which takes a fraction of a second for minutes of take: about 0.2 s to reach bar 76 of the song in chapter 14, two and a half minutes in, on the machine this manual was built on. There it notes what a take's project would: the controls, each part's sequence, where it was in it, the slot it was on and any slot waiting for the bar, and the keys held. The playback starts from that, with the keys held going down again on its first sample, and the rest of the take's events after it. Chance steps go on rolling the dice where they were, so they play as they would have. As for any take, a note that started before the bar and is still sounding isn't played, and the delay and reverb start empty.

Bars 49 to 56 of *Shoreline*, the build, played on their own. The capture, 4.3 seconds in, is in bar 51: the status line counts the song's bar and time, not the clip's.: the top Bars 49 to 56 of *Shoreline*, the build, played on their own. The capture, 4.3 seconds in, is in bar 51: the status line counts the song's bar and time, not the clip's.: the parts

0.0 / 16.0 s

peak -6.2 dBFS

Fig. 13.4 Bars 49 to 56 of Shoreline, the build, played on their own. The capture, 4.3 seconds in, is in bar 51: the status line counts the song's bar and time, not the clip's.

openzig build run -- --from 49 --to 57 manual/synth/14-recipes/song.txt

renderzig build run -- render --from 49 --to 57 manual/synth/14-recipes/song.txt from-bar.wav

manual/synth/14-recipes/song.txt
0      project song.json
# Shoreline: a song for the four parts. The project's bank holds its
# sounds and patterns, A11 to A44, and the script plays them: it selects
# slots, starts and stops sequences, transposes the bass under the chords,
# plays the pad, the arpeggio's chords, and the melodies, and moves the
# controls, the mix, the delay, and the tempo. 120 BPM: a bar is 2 seconds
# until the tempo slows in bar 77.

# Bars 1-8: surf on part 4, a pad on part 2, and a whistle on part 3 far off
0        patch A11
0        part 2
0        patch A21
0        part 3
0        patch A31
0        part 4
0        patch A41
0        set delay_send 0
0        set reverb_send 30
0        on D4
0        part 2
0        on F3 0.85
0        on A3 0.85
0        on C4 0.85
0        on E4 0.85
0        set level -34
0.5      set level -31
1        set level -28
1.5      set level -25
2        set level -22
2.5      set level -19
3        set level -16
3.5      set level -13
3.99     on D4 0.85
3.99     off C4
4        set level -10
4        part 3
4        on D5 0.8
7        on E5 0.8
7.03     off D5
7.5      on F5 0.8
7.53     off E5
7.99     part 2
7.99     on G3 0.85
7.99     on C4 0.85
7.99     off F3
7.99     off D4
8        part 3
8        on E5 0.8
8.03     off F5
10       on D5 0.8
10.03    off E5
11       on C5 0.8
11.03    off D5
11.5     on A4 0.8
11.53    off C5
11.99    part 2
11.99    on D4 0.85
11.99    off C4
12       part 3
12       on G4 0.8
12.03    off A4
14       on A4 0.8
14.03    off G4
15.5     on C5 0.8
15.53    off A4
15.99    part 2
15.99    on F3 0.85
15.99    on C4 0.85
15.99    off G3
15.99    off D4

# Bars 9-16: the bass comes in on part 1 and its filter opens; the surf goes
16       part 3
16       on A4 0.8
16       part 1
16       seq play
16       set cutoff 90
16       set filter_env 1.5
16       set level -9
16.03    part 3
16.03    off C5
16.5     part 1
16.5     set level -7.875
17       set cutoff 96.53
17       set filter_env 1.75
17       set level -6.75
17.5     set level -5.625
17.99    set transpose -4
17.99    part 2
17.99    on D4 0.85
17.99    off C4
18       part 1
18       set cutoff 103.5
18       set filter_env 2
18       set level -4.5
18.5     set level -3.375
19       part 3
19       off A4
19       part 1
19       set cutoff 111.1
19       set filter_env 2.25
19       set level -2.25
19.5     set level -1.125
19.99    set transpose 3
19.99    part 2
19.99    on G3 0.85
19.99    on C4 0.85
19.99    off F3
19.99    off D4
20       part 1
20       set cutoff 119.1
20       set filter_env 2.5
20       set level 0
21       set cutoff 127.8
21       set filter_env 2.75
21.99    set transpose -2
21.99    part 2
21.99    on D4 0.85
21.99    off C4
22       part 1
22       set cutoff 137
22       set filter_env 3
22       part 4
22       off D4
23       part 1
23       set cutoff 147
23       set filter_env 3.25
23.99    set transpose 0
23.99    part 2
23.99    on F3 0.85
23.99    on C4 0.85
23.99    off G3
23.99    off D4
24       part 1
24       set cutoff 157.6
24       set filter_env 3.5
25       set cutoff 169.1
25       set filter_env 3.75
25.99    set transpose -4
25.99    part 2
25.99    on D4 0.85
25.99    off C4
26       part 1
26       set cutoff 181.3
26       set filter_env 4
27       set cutoff 194.5
27       set filter_env 4.25
27.99    set transpose 3
27.99    part 2
27.99    on G3 0.85
27.99    on C4 0.85
27.99    off F3
27.99    off D4
28       part 1
28       set cutoff 208.6
28       set filter_env 4.5
29       set cutoff 223.8
29       set filter_env 4.75
29.99    set transpose -2
29.99    part 2
29.99    on D4 0.85
29.99    off C4
30       part 1
30       set cutoff 240
30       set filter_env 5

# Bars 17-24: the arpeggio on part 3, through the delay, and the bass drives
31       part 3
31       patch A32
31       set arp up
31       set reverb_send 25
31       part 4
31       patch A42
31       set delay_send 20
31       set reverb_send 35
31.99    part 2
31.99    on F3 0.85
31.99    on C4 0.85
31.99    off G3
31.99    off D4
32       part 1
32       patch A12
32       seq play
32       part 3
32       on D4 0.9
32       on F4 0.9
32       on A4 0.9
32       on C5 0.9
32       on E5 0.9
32       set level -16
32.5     set level -14.38
33       set level -12.75
33.5     set level -11.12
33.99    part 1
33.99    set transpose -4
33.99    part 2
33.99    on D4 0.85
33.99    off C4
33.99    part 3
33.99    on Bb4 0.9
33.99    off C5
34       set level -9.5
34.5     set level -7.875
35       set level -6.25
35.5     set level -4.625
35.99    part 1
35.99    set transpose 3
35.99    part 2
35.99    on G3 0.85
35.99    on C4 0.85
35.99    off F3
35.99    off D4
35.99    part 3
35.99    on C4 0.9
35.99    on C5 0.9
35.99    off D4
35.99    off Bb4
36       set level -3
37.99    part 1
37.99    set transpose -2
37.99    part 2
37.99    on D4 0.85
37.99    off C4
37.99    part 3
37.99    on E4 0.9
37.99    on G4 0.9
37.99    on D5 0.9
37.99    off F4
37.99    off C5
37.99    off E5
39.99    part 1
39.99    set transpose 0
39.99    part 2
39.99    on F3 0.85
39.99    on C4 0.85
39.99    off G3
39.99    off D4
39.99    part 3
39.99    on D4 0.9
39.99    on F4 0.9
39.99    on C5 0.9
39.99    on E5 0.9
39.99    off C4
39.99    off E4
39.99    off G4
39.99    off D5
41.99    part 1
41.99    set transpose -4
41.99    part 2
41.99    on D4 0.85
41.99    off C4
41.99    part 3
41.99    on Bb4 0.9
41.99    off C5
43.99    part 1
43.99    set transpose 3
43.99    part 2
43.99    on G3 0.85
43.99    on C4 0.85
43.99    off F3
43.99    off D4
43.99    part 3
43.99    on C4 0.9
43.99    on C5 0.9
43.99    off D4
43.99    off Bb4
45.99    part 1
45.99    set transpose -2
45.99    part 2
45.99    on D4 0.85
45.99    off C4
45.99    part 3
45.99    on E4 0.9
45.99    on G4 0.9
45.99    on D5 0.9
45.99    off F4
45.99    off C5
45.99    off E5
46.99    part 1
46.99    set muted on
47.99    set transpose 0
47.99    part 2
47.99    on F3 0.85
47.99    on C4 0.85
47.99    off G3
47.99    off D4
47.99    part 3
47.99    on D4 0.9
47.99    on F4 0.9
47.99    on C5 0.9
47.99    on E5 0.9
47.99    off C4
47.99    off E4
47.99    off G4
47.99    off D5
47.99    part 1
47.99    set muted off

# Bars 25-40: the lead plays the theme on part 4, then again higher
48       part 4
48       on D5 0.9
49.25    on E5 0.9
49.27    off D5
49.5     on F5 0.9
49.52    off E5
49.99    part 1
49.99    set transpose -4
49.99    part 2
49.99    on D4 0.85
49.99    off C4
49.99    part 3
49.99    on Bb4 0.9
49.99    off C5
50       part 4
50       on E5 0.9
50.02    off F5
51       on D5 0.9
51.02    off E5
51.5     on A4 0.9
51.52    off D5
51.99    part 1
51.99    set transpose 3
51.99    part 2
51.99    on G3 0.85
51.99    on C4 0.85
51.99    off F3
51.99    off D4
51.99    part 3
51.99    on C4 0.9
51.99    on C5 0.9
51.99    off D4
51.99    off Bb4
52       part 4
52       on C5 0.9
52.02    off A4
53.5     on A4 0.9
53.52    off C5
53.75    on C5 0.9
53.77    off A4
53.99    part 1
53.99    set transpose -2
53.99    part 2
53.99    on D4 0.85
53.99    off C4
53.99    part 3
53.99    on E4 0.9
53.99    on G4 0.9
53.99    on D5 0.9
53.99    off F4
53.99    off C5
53.99    off E5
54       part 4
54       on D5 0.9
54.02    off C5
55       on G4 0.9
55.02    off D5
55.99    part 1
55.99    set transpose 0
55.99    part 2
55.99    on F3 0.85
55.99    on C4 0.85
55.99    off G3
55.99    off D4
55.99    part 3
55.99    on D4 0.9
55.99    on F4 0.9
55.99    on C5 0.9
55.99    on E5 0.9
55.99    off C4
55.99    off E4
55.99    off G4
55.99    off D5
56       part 4
56       on D5 0.9
56.02    off G4
57.25    on E5 0.9
57.27    off D5
57.5     on F5 0.9
57.52    off E5
57.99    part 1
57.99    set transpose -4
57.99    part 2
57.99    on D4 0.85
57.99    off C4
57.99    part 3
57.99    on Bb4 0.9
57.99    off C5
58       part 4
58       on A5 0.9
58.02    off F5
59       on G5 0.9
59.02    off A5
59.5     on F5 0.9
59.52    off G5
59.99    part 1
59.99    set transpose 3
59.99    part 2
59.99    on G3 0.85
59.99    on C4 0.85
59.99    off F3
59.99    off D4
59.99    part 3
59.99    on C4 0.9
59.99    on C5 0.9
59.99    off D4
59.99    off Bb4
60       part 4
60       on E5 0.9
60.02    off F5
60.75    on F5 0.9
60.77    off E5
61       on E5 0.9
61.02    off F5
61.5     on C5 0.9
61.52    off E5
61.99    part 1
61.99    set transpose -2
61.99    part 2
61.99    on D4 0.85
61.99    off C4
61.99    part 3
61.99    on E4 0.9
61.99    on G4 0.9
61.99    on D5 0.9
61.99    off F4
61.99    off C5
61.99    off E5
62       part 4
62       on D5 0.9
62       set delay_send 70
62.02    off C5
63.99    part 1
63.99    set transpose 0
63.99    part 2
63.99    on F3 0.85
63.99    on C4 0.85
63.99    off G3
63.99    off D4
63.99    part 3
63.99    on D4 0.9
63.99    on F4 0.9
63.99    on C5 0.9
63.99    on E5 0.9
63.99    off C4
63.99    off E4
63.99    off G4
63.99    off D5
63.99    set arp updown
63.99    part 4
63.99    set delay_send 20
64       on A5 0.9
64       part 2
64       set cutoff 3200
64.02    part 4
64.02    off D5
65.25    on G5 0.9
65.27    off A5
65.5     on F5 0.9
65.52    off G5
65.99    part 1
65.99    set transpose -4
65.99    part 2
65.99    on D4 0.85
65.99    off C4
65.99    part 3
65.99    on Bb4 0.9
65.99    off C5
66       part 4
66       on E5 0.9
66.02    off F5
66.5     on F5 0.9
66.52    off E5
67       on D5 0.9
67.02    off F5
67.99    part 1
67.99    set transpose 3
67.99    part 2
67.99    on G3 0.85
67.99    on C4 0.85
67.99    off F3
67.99    off D4
67.99    part 3
67.99    on C4 0.9
67.99    on C5 0.9
67.99    off D4
67.99    off Bb4
68       part 4
68       on C5 0.9
68.02    off D5
68.75    on D5 0.9
68.77    off C5
69       on E5 0.9
69.02    off D5
69.5     on G5 0.9
69.52    off E5
69.99    part 1
69.99    set transpose -2
69.99    part 2
69.99    on D4 0.85
69.99    off C4
69.99    part 3
69.99    on E4 0.9
69.99    on G4 0.9
69.99    on D5 0.9
69.99    off F4
69.99    off C5
69.99    off E5
70       part 4
70       on E5 0.9
70.02    off G5
71.5     on D5 0.9
71.52    off E5
71.97    off D5
71.99    part 1
71.99    set transpose 0
71.99    part 2
71.99    on F3 0.85
71.99    on C4 0.85
71.99    off G3
71.99    off D4
71.99    part 3
71.99    on D4 0.9
71.99    on F4 0.9
71.99    on C5 0.9
71.99    on E5 0.9
71.99    off C4
71.99    off E4
71.99    off G4
71.99    off D5
72       part 4
72       on D5 0.9
72.5     on E5 0.9
72.52    off D5
73       on F5 0.9
73.02    off E5
73.5     on A5 0.9
73.52    off F5
73.97    off A5
73.99    part 1
73.99    set transpose -4
73.99    part 2
73.99    on D4 0.85
73.99    off C4
73.99    part 3
73.99    on Bb4 0.9
73.99    off C5
74       part 4
74       on A5 0.9
74.75    on Bb5 0.9
74.77    off A5
75       on A5 0.9
75.02    off Bb5
75.5     on F5 0.9
75.52    off A5
75.99    part 1
75.99    set transpose 3
75.99    part 2
75.99    on G3 0.85
75.99    on C4 0.85
75.99    off F3
75.99    off D4
75.99    part 3
75.99    on C4 0.9
75.99    on C5 0.9
75.99    off D4
75.99    off Bb4
76       part 4
76       on G5 0.9
76.02    off F5
76.75    on A5 0.9
76.77    off G5
77       on G5 0.9
77.02    off A5
77.5     on E5 0.9
77.52    off G5
77.99    part 1
77.99    set transpose -2
77.99    part 2
77.99    on D4 0.85
77.99    off C4
77.99    part 3
77.99    on E4 0.9
77.99    on G4 0.9
77.99    on D5 0.9
77.99    off F4
77.99    off C5
77.99    off E5
78       part 4
78       on D5 0.9
78       set delay_send 70
78.02    off E5
79.5     off D5
79.85    patch A31
79.85    set delay_send 35
79.85    set reverb_send 60
79.99    part 3
79.99    set arp up
79.99    part 4
79.99    set delay_send 20
79.99    part 1
79.99    seq off
79.99    part 2
79.99    on F3 0.85
79.99    on Bb3 0.85
79.99    off G3
79.99    off E4
79.99    part 3
79.99    on Bb4 0.9
79.99    on F5 0.9
79.99    on A5 0.9
79.99    off C4
79.99    off E4
79.99    off A4

# Bars 41-48: the bass stops, the delay grows, and a flute plays on part 4
80       set delay_feedback 58
80       set delay_time 1/4
80       set reverb_decay 85
80       set delay_send 55
80       part 4
80       on D5 0.85
81.99    part 2
81.99    on C4 0.85
81.99    off Bb3
81.99    part 3
81.99    on F4 0.9
81.99    off G4
82       part 4
82       on C5 0.85
82.03    off D5
83       on D5 0.85
83.03    off C5
83.99    part 2
83.99    on G3 0.85
83.99    on E4 0.85
83.99    off F3
83.99    off A3
83.99    part 3
83.99    on G4 0.9
83.99    on C5 0.9
83.99    on E5 0.9
83.99    on G5 0.9
83.99    off F4
83.99    off Bb4
83.99    off F5
83.99    off A5
84       part 4
84       on E5 0.85
84.03    off D5
85.99    part 2
85.99    on E3 0.85
85.99    on A3 0.85
85.99    on Db4 0.85
85.99    off G3
85.99    off C4
85.99    off D4
85.99    part 3
85.99    on E4 0.9
85.99    on A4 0.9
85.99    on Db5 0.9
85.99    off G4
85.99    off C5
85.99    off D5
86       part 4
86       on Db5 0.85
86.03    off E5
87       on E5 0.85
87.03    off Db5
87.99    part 2
87.99    on F3 0.85
87.99    on Bb3 0.85
87.99    on D4 0.85
87.99    off E3
87.99    off Db4
87.99    off E4
87.99    part 3
87.99    on G4 0.9
87.99    on Bb4 0.9
87.99    on D5 0.9
87.99    on F5 0.9
87.99    on A5 0.9
87.99    off E4
87.99    off A4
87.99    off Db5
87.99    off E5
87.99    off G5
88       part 4
88       on F5 0.85
88.03    off E5
89.5     on E5 0.85
89.53    off F5
89.99    part 2
89.99    on C4 0.85
89.99    off Bb3
89.99    part 3
89.99    on F4 0.9
89.99    off G4
90       part 4
90       on D5 0.85
90.03    off E5
91.99    part 2
91.99    on G3 0.85
91.99    on E4 0.85
91.99    off F3
91.99    off A3
91.99    part 3
91.99    on G4 0.9
91.99    on C5 0.9
91.99    on E5 0.9
91.99    on G5 0.9
91.99    off F4
91.99    off Bb4
91.99    off F5
91.99    off A5
92       part 4
92       on C5 0.85
92.03    off D5
93       on D5 0.85
93.03    off C5
93.5     on E5 0.85
93.53    off D5
93.99    part 2
93.99    on E3 0.85
93.99    on A3 0.85
93.99    off G3
93.99    off C4
93.99    part 3
93.99    on E4 0.9
93.99    on A4 0.9
93.99    off G4
93.99    off C5
94       part 4
94       on D5 0.85
94.03    off E5
94.99    part 2
94.99    on Db4 0.85
94.99    off D4
94.99    part 3
94.99    on Db5 0.9
94.99    off D5
95       part 4
95       on Db5 0.85
95.03    off D5
95.75    part 2
95.75    set release 0.1
95.75    off E3
95.75    off A3
95.75    off Db4
95.75    off E4
95.99    part 1
95.99    patch A13
95.99    seq play
95.99    set transpose 0
95.99    part 2
95.99    patch A22
95.99    seq play
95.99    set delay_send 50
95.99    set reverb_send 20
95.99    part 3
95.99    on D4 0.9
95.99    on F4 0.9
95.99    on C5 0.9
95.99    off E4
95.99    off Db5
95.99    off G5

# Bars 49-56: the build: an acid line on part 1, stabs on part 2, a rising wind on part 4
96       set delay_feedback 55
96       set delay_tone 2500
96       set delay_time 1/8.
96       set reverb_decay 75
96       set swing 57
96       part 4
96       on D5 0.85
96       part 3
96       set delay_send 35
96       part 1
96       set resonance 72
96       set cutoff 250
96.03    part 4
96.03    off Db5
97       part 1
97       set resonance 73
97       set cutoff 265.7
98       part 4
98       off D5
98       part 1
98       set resonance 74
98       set cutoff 282.5
99       set resonance 75
99       set cutoff 300.2
99       part 4
99       patch A43
99       set delay_send 0
99       set reverb_send 40
100      part 1
100      set resonance 76
100      set cutoff 319.1
101      set resonance 77
101      set cutoff 339.2
102      set resonance 78
102      set cutoff 360.6
103      set resonance 79
103      set cutoff 383.2
104      set resonance 80
104      set cutoff 407.4
104      part 4
104      on D4
104      set cutoff 300
104.25   set cutoff 336
104.5    set cutoff 376.4
104.75   set cutoff 421.5
105      part 1
105      set resonance 81
105      set cutoff 433
105      part 4
105      set cutoff 472.1
105.25   set cutoff 528.8
105.5    set cutoff 592.3
105.75   set cutoff 663.4
106      part 1
106      set resonance 82
106      set cutoff 460.2
106      part 4
106      set cutoff 743.1
106.25   set cutoff 832.3
106.5    set cutoff 932.2
106.75   set cutoff 1044
107      part 1
107      set resonance 83
107      set cutoff 489.2
107      part 4
107      set cutoff 1169
107.25   set cutoff 1310
107.5    set cutoff 1467
107.75   set cutoff 1643
107.99   part 3
107.99   on Bb4 0.9
107.99   off E5
107.99   part 2
107.99   set transpose -4
107.99   chord 0 4 7 11 14
107.99   part 3
107.99   set divide 1/32
108      part 1
108      set resonance 84
108      set cutoff 520
108      part 4
108      set cutoff 1840
108.25   set cutoff 2061
108.5    set cutoff 2309
108.75   set cutoff 2586
109      set cutoff 2896
109.25   set cutoff 3244
109.5    set cutoff 3634
109.75   set cutoff 4070
109.99   part 3
109.99   on Db4 0.9
109.99   on E4 0.9
109.99   on G4 0.9
109.99   on Db5 0.9
109.99   off D4
109.99   off F4
109.99   off Bb4
109.99   off C5
109.99   part 2
109.99   set transpose -5
109.99   chord 0 4 7 10
109.99   part 1
109.99   patch A14
109.99   seq play
110      part 4
110      set cutoff 4558
110      set lfo_division 1/32
110.25   set cutoff 5106
110.5    set cutoff 5719
110.75   set cutoff 6405
111      set cutoff 7174
111.25   set cutoff 8035
111.49   part 1
111.49   seq off
111.49   part 2
111.49   seq off
111.49   part 3
111.49   off Db4
111.49   off E4
111.49   off G4
111.49   off A4
111.49   off Db5

# The last beat of bar 56 is a break
111.5    part 4
111.5    set cutoff 9000
111.75   off D4
111.99   part 1
111.99   patch A12
111.99   set transpose -4
111.99   part 2
111.99   patch A23
111.99   set transpose 0
111.99   set delay_send 10
111.99   set reverb_send 35
111.99   part 3
111.99   set divide 1/16
111.99   set arp updown
111.99   part 4
111.99   patch A44
111.99   set delay_send 25
111.99   set reverb_send 35

# Bars 57-72: brass on part 2, the bass and the arpeggio, and the lead's second theme
112      set delay_feedback 40
112      set swing 50
112      set delay_tone 4000
112      part 1
112      seq play
112      part 2
112      on F3 0.9
112      on Bb3 0.9
112      on D4 0.9
112      on F4 0.9
112      part 3
112      on D4 0.9
112      on F4 0.9
112      on Bb4 0.9
112      on D5 0.9
112      on F5 0.9
112      part 4
112      on F5 0.95
113      on D5 0.95
113.02   off F5
113.5    on F5 0.95
113.52   off D5
113.99   part 1
113.99   set transpose -2
113.99   part 2
113.99   on G3 0.9
113.99   on C4 0.9
113.99   on E4 0.9
113.99   on G4 0.9
113.99   off F3
113.99   off Bb3
113.99   off D4
113.99   off F4
113.99   part 3
113.99   on E4 0.9
113.99   on G4 0.9
113.99   on C5 0.9
113.99   on E5 0.9
113.99   on G5 0.9
113.99   off D4
113.99   off F4
113.99   off Bb4
113.99   off D5
113.99   off F5
114      part 4
114      on G5 0.95
114.02   off F5
115.5    on E5 0.95
115.52   off G5
115.99   part 1
115.99   set transpose 0
115.99   part 2
115.99   on F3 0.9
115.99   on A3 0.9
115.99   on D4 0.9
115.99   on F4 0.9
115.99   off G3
115.99   off C4
115.99   off E4
115.99   off G4
115.99   part 3
115.99   on D4 0.9
115.99   on F4 0.9
115.99   on A4 0.9
115.99   on D5 0.9
115.99   on F5 0.9
115.99   off E4
115.99   off G4
115.99   off C5
115.99   off E5
115.99   off G5
116      part 4
116      on A5 0.95
116.02   off E5
117      on G5 0.95
117.02   off A5
117.25   on F5 0.95
117.27   off G5
117.5    on E5 0.95
117.52   off F5
117.97   off E5
117.99   part 1
117.99   set transpose -5
117.99   part 2
117.99   on E3 0.9
117.99   on Db4 0.9
117.99   on E4 0.9
117.99   off F3
117.99   off D4
117.99   off F4
117.99   part 3
117.99   on Db4 0.9
117.99   on E4 0.9
117.99   on Db5 0.9
117.99   on E5 0.9
117.99   off D4
117.99   off F4
117.99   off D5
117.99   off F5
118      part 4
118      on E5 0.95
119      on Db5 0.95
119.02   off E5
119.5    on E5 0.95
119.52   off Db5
119.99   part 1
119.99   set transpose -4
119.99   part 2
119.99   on F3 0.9
119.99   on Bb3 0.9
119.99   on D4 0.9
119.99   on F4 0.9
119.99   off E3
119.99   off A3
119.99   off Db4
119.99   off E4
119.99   part 3
119.99   on D4 0.9
119.99   on F4 0.9
119.99   on Bb4 0.9
119.99   on D5 0.9
119.99   on F5 0.9
119.99   off Db4
119.99   off E4
119.99   off A4
119.99   off Db5
119.99   off E5
120      part 4
120      on D5 0.95
120.02   off E5
120.75   on F5 0.95
120.77   off D5
121      on Bb5 0.95
121.02   off F5
121.99   part 1
121.99   set transpose -2
121.99   part 2
121.99   on G3 0.9
121.99   on C4 0.9
121.99   on E4 0.9
121.99   on G4 0.9
121.99   off F3
121.99   off Bb3
121.99   off D4
121.99   off F4
121.99   part 3
121.99   on E4 0.9
121.99   on G4 0.9
121.99   on C5 0.9
121.99   on E5 0.9
121.99   on G5 0.9
121.99   off D4
121.99   off F4
121.99   off Bb4
121.99   off D5
121.99   off F5
122      part 4
122      on A5 0.95
122.02   off Bb5
122.5    on G5 0.95
122.52   off A5
123.5    on E5 0.95
123.52   off G5
123.99   part 1
123.99   set transpose 0
123.99   part 2
123.99   on F3 0.9
123.99   on A3 0.9
123.99   on D4 0.9
123.99   on F4 0.9
123.99   off G3
123.99   off C4
123.99   off E4
123.99   off G4
123.99   part 3
123.99   on D4 0.9
123.99   on F4 0.9
123.99   on A4 0.9
123.99   on D5 0.9
123.99   on F5 0.9
123.99   off E4
123.99   off G4
123.99   off C5
123.99   off E5
123.99   off G5
124      part 4
124      on F5 0.95
124.02   off E5
125.5    on E5 0.95
125.52   off F5
125.75   on D5 0.95
125.77   off E5
125.99   part 1
125.99   set transpose -5
125.99   part 2
125.99   on E3 0.9
125.99   on Db4 0.9
125.99   on E4 0.9
125.99   off F3
125.99   off D4
125.99   off F4
125.99   part 3
125.99   on Db4 0.9
125.99   on E4 0.9
125.99   on Db5 0.9
125.99   on E5 0.9
125.99   off D4
125.99   off F4
125.99   off D5
125.99   off F5
126      part 4
126      on Db5 0.95
126.02   off D5
127      on E5 0.95
127.02   off Db5
127.5    on A5 0.95
127.52   off E5
127.99   part 1
127.99   set transpose -4
127.99   part 2
127.99   on F3 0.9
127.99   on Bb3 0.9
127.99   on D4 0.9
127.99   on F4 0.9
127.99   off E3
127.99   off A3
127.99   off Db4
127.99   off E4
127.99   part 3
127.99   on D4 0.9
127.99   on F4 0.9
127.99   on Bb4 0.9
127.99   on D5 0.9
127.99   on F5 0.9
127.99   off Db4
127.99   off E4
127.99   off A4
127.99   off Db5
127.99   off E5
128      part 4
128      on Bb5 0.95
128      part 2
128      set cutoff 260
128      part 4
128      set bend -0.5
128.02   off A5
128.02   set bend -0.35
128.04   set bend -0.22
128.06   set bend -0.12
128.08   set bend -0.06
128.1    set bend -0.01
128.12   set bend 0
129      on A5 0.95
129      part 2
129      set cutoff 274.6
129.02   part 4
129.02   off Bb5
129.5    on F5 0.95
129.52   off A5
129.99   part 1
129.99   set transpose -2
129.99   part 2
129.99   on G3 0.9
129.99   on C4 0.9
129.99   on E4 0.9
129.99   on G4 0.9
129.99   off F3
129.99   off Bb3
129.99   off D4
129.99   off F4
129.99   part 3
129.99   on E4 0.9
129.99   on G4 0.9
129.99   on C5 0.9
129.99   on E5 0.9
129.99   on G5 0.9
129.99   off D4
129.99   off F4
129.99   off Bb4
129.99   off D5
129.99   off F5
130      part 4
130      on G5 0.95
130      part 2
130      set cutoff 290.1
130.02   part 4
130.02   off F5
131      part 2
131      set cutoff 306.5
131.5    part 4
131.5    on E5 0.95
131.52   off G5
131.99   part 1
131.99   set transpose 0
131.99   part 2
131.99   on F3 0.9
131.99   on A3 0.9
131.99   on D4 0.9
131.99   on F4 0.9
131.99   off G3
131.99   off C4
131.99   off E4
131.99   off G4
131.99   part 3
131.99   on D4 0.9
131.99   on F4 0.9
131.99   on A4 0.9
131.99   on D5 0.9
131.99   on F5 0.9
131.99   off E4
131.99   off G4
131.99   off C5
131.99   off E5
131.99   off G5
132      part 4
132      on A5 0.95
132      part 2
132      set cutoff 323.7
132.02   part 4
132.02   off E5
132.25   set modulation 0
132.375  set modulation 0.1
132.5    set modulation 0.2
132.625  set modulation 0.3
132.75   set modulation 0.4
132.875  set modulation 0.5
133      on C6 0.95
133      part 2
133      set cutoff 342
133      part 4
133      set modulation 0.6
133.01   set modulation 0
133.02   off A5
133.5    on A5 0.95
133.52   off C6
133.97   off A5
133.99   part 1
133.99   set transpose -5
133.99   part 2
133.99   on E3 0.9
133.99   on Db4 0.9
133.99   on E4 0.9
133.99   off F3
133.99   off D4
133.99   off F4
133.99   part 3
133.99   on Db4 0.9
133.99   on E4 0.9
133.99   on Db5 0.9
133.99   on E5 0.9
133.99   off D4
133.99   off F4
133.99   off D5
133.99   off F5
134      part 4
134      on A5 0.95
134      part 2
134      set cutoff 361.2
134.5    part 4
134.5    on G5 0.95
134.52   off A5
135      on E5 0.95
135      part 2
135      set cutoff 381.6
135.02   part 4
135.02   off G5
135.5    on Db5 0.95
135.52   off E5
135.99   part 1
135.99   set transpose -4
135.99   part 2
135.99   on F3 0.9
135.99   on Bb3 0.9
135.99   on D4 0.9
135.99   on F4 0.9
135.99   off E3
135.99   off A3
135.99   off Db4
135.99   off E4
135.99   part 3
135.99   on D4 0.9
135.99   on F4 0.9
135.99   on Bb4 0.9
135.99   on D5 0.9
135.99   on F5 0.9
135.99   off Db4
135.99   off E4
135.99   off A4
135.99   off Db5
135.99   off E5
136      part 4
136      on D5 0.95
136      part 2
136      set cutoff 403.1
136.02   part 4
136.02   off Db5
137      on F5 0.95
137      part 2
137      set cutoff 425.8
137.02   part 4
137.02   off D5
137.99   part 1
137.99   set transpose -2
137.99   part 2
137.99   on G3 0.9
137.99   on C4 0.9
137.99   on E4 0.9
137.99   on G4 0.9
137.99   off F3
137.99   off Bb3
137.99   off D4
137.99   off F4
137.99   part 3
137.99   on E4 0.9
137.99   on G4 0.9
137.99   on C5 0.9
137.99   on E5 0.9
137.99   on G5 0.9
137.99   off D4
137.99   off F4
137.99   off Bb4
137.99   off D5
137.99   off F5
138      part 4
138      on E5 0.95
138      part 2
138      set cutoff 449.8
138.02   part 4
138.02   off F5
139      on G5 0.95
139      part 2
139      set cutoff 475.1
139.02   part 4
139.02   off E5
139.99   part 1
139.99   set transpose 0
139.99   part 2
139.99   on F3 0.9
139.99   on A3 0.9
139.99   on D4 0.9
139.99   on F4 0.9
139.99   off G3
139.99   off C4
139.99   off E4
139.99   off G4
139.99   part 3
139.99   on D4 0.9
139.99   on F4 0.9
139.99   on A4 0.9
139.99   on D5 0.9
139.99   on F5 0.9
139.99   off E4
139.99   off G4
139.99   off C5
139.99   off E5
139.99   off G5
140      part 4
140      on F5 0.95
140      part 2
140      set cutoff 501.9
140.02   part 4
140.02   off G5
141      on E5 0.95
141      part 2
141      set cutoff 530.1
141.02   part 4
141.02   off F5
141.5    on D5 0.95
141.52   off E5
141.99   part 1
141.99   set transpose -5
141.99   part 2
141.99   on E3 0.9
141.99   on Db4 0.9
141.99   on E4 0.9
141.99   off F3
141.99   off D4
141.99   off F4
141.99   part 3
141.99   on Db4 0.9
141.99   on E4 0.9
141.99   on Db5 0.9
141.99   on E5 0.9
141.99   off D4
141.99   off F4
141.99   off D5
141.99   off F5
142      part 4
142      on Db5 0.95
142      part 2
142      set cutoff 560
142.02   part 4
142.02   off D5
143      on E5 0.95
143.02   off Db5
143.99   part 1
143.99   patch A11
143.99   seq play
143.99   set transpose 0
143.99   part 3
143.99   on D4 0.9
143.99   on F4 0.9
143.99   on C5 0.9
143.99   off Db4
143.99   off E4
143.99   off Db5

# Bars 73-80: the pulse again, the surf back, and the tempo slowing from bar 77
144      set delay_feedback 55
144      part 4
144      on D5 0.95
144      part 2
144      on F3 0.85
144      on C4 0.85
144      off E3
144      off Db4
144      patch A21
144      set reverb_send 55
144      part 1
144      set cutoff 240
144.02   part 4
144.02   off E5
145      part 1
145      set cutoff 217.7
145.99   set transpose -4
145.99   part 2
145.99   on D4 0.85
145.99   off C4
145.99   part 3
145.99   on Bb4 0.9
145.99   off C5
146      part 1
146      set cutoff 197.5
147      set cutoff 179.1
147.99   set transpose 3
147.99   part 2
147.99   on G3 0.85
147.99   on C4 0.85
147.99   off F3
147.99   off D4
147.99   part 3
147.99   on C4 0.9
147.99   on C5 0.9
147.99   off D4
147.99   off Bb4
148      part 4
148      off D5
148      part 1
148      set cutoff 162.5
148      set level 0
148.5    set level -0.875
149      set cutoff 147.4
149      set level -1.75
149      part 4
149      patch A41
149      set delay_send 0
149      set reverb_send 30
149.5    part 1
149.5    set level -2.625
149.99   set transpose -2
149.99   part 2
149.99   on D4 0.85
149.99   off C4
149.99   part 3
149.99   on E4 0.9
149.99   on G4 0.9
149.99   on D5 0.9
149.99   off F4
149.99   off C5
149.99   off E5
150      part 1
150      set cutoff 133.7
150      set level -3.5
150      part 4
150      on D4
150.5    part 1
150.5    set level -4.375
151      set cutoff 121.3
151      set level -5.25
151.5    set level -6.125
151.99   set transpose 0
151.99   part 2
151.99   on D3 0.85
151.99   on F3 0.85
151.99   on C4 0.85
151.99   off G3
151.99   off D4
151.99   part 3
151.99   on D4 0.9
151.99   on F4 0.9
151.99   on C5 0.9
151.99   on E5 0.9
151.99   off C4
151.99   off E4
151.99   off G4
151.99   off D5
152      set tempo 118.8
152      part 1
152      set cutoff 110
152      set level -7
152.495  seq off
152.505  set tempo 117.1
153.0176 set tempo 115.0
153.5393 set tempo 112.7
154.0715 set tempo 110.3
154.6155 set tempo 107.7
155.1726 set tempo 105.0
155.7441 set tempo 102.1
156.3316 set tempo 99.2
156.3316 part 3
156.3316 set level -3
156.9366 set tempo 96.1
157.0196 set level -4.125
157.5608 set tempo 93.0
157.7077 set level -5.25
158.2062 set tempo 89.7
158.3957 set level -6.375
158.8749 set tempo 86.4
159.0837 set level -7.5
159.5693 set tempo 83.0
159.7718 set level -8.625
160.2921 set tempo 79.5
160.4598 set level -9.75
161.0464 set tempo 76.0
161.1478 set level -10.88
161.8259 off D4
161.8259 off F4
161.8259 off A4
161.8259 off C5
161.8259 off E5
161.8359 part 2
161.8359 off D3
161.8359 off F3
161.8359 off A3
161.8359 off C4
161.8359 off E4
161.8359 part 3
161.8359 set level -12
163.4148 part 4
163.4148 off D4
170.8359 end
manual/synth/14-recipes/song.json
{
  "tempo": 120,
  "delay_time": "1/8.",
  "delay_feedback": 45,
  "delay_tone": 3500,
  "delay_mode": "pingpong",
  "reverb_decay": 75,
  "reverb_damp": 5000,
  "reverb_predelay": 0.03,
  "parts": [
    { "patch": "A11", "level": 0 },
    {
      "patch": "A21",
      "level": -10,
      "pan": -25,
      "delay_send": 10,
      "reverb_send": 45
    },
    {
      "patch": "A31",
      "level": -3,
      "pan": 25,
      "delay_send": 35,
      "reverb_send": 55
    },
    { "patch": "A41", "level": -2, "delay_send": 15, "reverb_send": 35 }
  ],
  "bank": {
    "A11": {
      "sub": 60,
      "cutoff": 240,
      "resonance": 30,
      "filter_env": 5,
      "key_follow": 40,
      "vca_level": 9,
      "attack": 0.0015,
      "decay": 0.1,
      "sustain": 20,
      "release": 0.05,
      "sequence": [
        "D2",
        { "key": "D2", "vel": 72, "gate": 8 },
        { "key": "D2", "vel": 96 },
        { "key": "D2", "vel": 72, "gate": 8 },
        { "key": "D2", "vel": 112 },
        { "key": "D2", "vel": 72, "gate": 8 },
        { "key": "D3", "vel": 96 },
        { "key": "D2", "vel": 72, "gate": 8 },
        { "key": "D2", "vel": 120 },
        { "key": "D2", "vel": 72, "gate": 8 },
        { "key": "D2", "vel": 96 },
        { "key": "D2", "vel": 72, "gate": 8 },
        { "key": "A2", "vel": 112 },
        { "key": "D2", "vel": 72, "gate": 8 },
        { "key": "D3", "vel": 96 },
        { "key": "D2", "vel": 72, "gate": 8 }
      ]
    },
    "A12": {
      "sub": 60,
      "cutoff": 300,
      "resonance": 40,
      "filter_env": 5,
      "key_follow": 40,
      "vca_level": 9,
      "attack": 0.0015,
      "decay": 0.1,
      "sustain": 20,
      "release": 0.05,
      "sequence": [
        { "key": "D2", "lock": { "filter_env": 6.5, "resonance": 45 } },
        { "key": "D2", "vel": 64, "gate": 6 },
        { "key": "D3", "vel": 100 },
        { "key": "D2", "vel": 64, "gate": 6 },
        { "key": "A2", "vel": 100 },
        { "key": "D2", "vel": 64, "gate": 6 },
        { "key": "D3", "vel": 100 },
        { "key": "D2", "vel": 56, "chance": 50 },
        { "key": "D2", "vel": 120 },
        { "key": "D2", "vel": 64, "gate": 6 },
        { "key": "D3", "vel": 100 },
        { "key": "D2", "vel": 64, "gate": 6 },
        { "key": "A2", "vel": 104 },
        { "key": "D3", "vel": 88, "ratchet": 2, "every": 2 },
        { "key": "D2", "vel": 96 },
        { "key": "A2", "vel": 80, "chance": 75 }
      ]
    },
    "A13": {
      "cutoff": 250,
      "resonance": 72,
      "filter_env": 4.5,
      "key_follow": 30,
      "vca": "gate",
      "attack": 0.015,
      "decay": 0.25,
      "sustain": 0,
      "trigger": "gate",
      "sequence": [
        { "key": "D2", "lock": { "filter_env": 6.5, "resonance": 90 } },
        { "key": "D2", "vel": 90 },
        { "key": "D3", "vel": 90 },
        { "key": "~C3", "vel": 90 },
        { "key": "D2", "vel": 90 },
        "-",
        { "key": "F2", "lock": { "filter_env": 6.5, "resonance": 90 } },
        { "key": "D2", "vel": 90 },
        { "key": "A2", "vel": 90 },
        "~A2",
        { "key": "D2", "vel": 90 },
        { "key": "D3", "lock": { "filter_env": 6.5, "resonance": 90 } },
        { "key": "~D2", "vel": 90 },
        { "key": "F2", "vel": 90 },
        "-",
        { "key": "G2", "lock": { "filter_env": 6.5, "resonance": 90 } }
      ]
    },
    "A14": {
      "cutoff": 520,
      "resonance": 84,
      "filter_env": 4.5,
      "key_follow": 30,
      "vca": "gate",
      "attack": 0.015,
      "decay": 0.25,
      "sustain": 0,
      "trigger": "gate",
      "sequence": [
        { "key": "A1", "vel": 80 },
        { "key": "A1", "vel": 60, "gate": 8 },
        { "key": "A2", "vel": 90 },
        { "key": "A1", "vel": 60, "gate": 8 },
        { "key": "A1", "vel": 90, "ratchet": 2 },
        { "key": "A1", "vel": 70, "gate": 8 },
        { "key": "A2", "vel": 100, "ratchet": 2 },
        { "key": "A1", "vel": 80, "ratchet": 2 },
        { "key": "A1", "vel": 100, "ratchet": 3 },
        { "key": "A2", "vel": 90, "ratchet": 2 },
        { "key": "A1", "vel": 110, "ratchet": 3 },
        { "key": "A2", "vel": 100, "ratchet": 3 },
        {
          "key": "A1",
          "ratchet": 4,
          "lock": { "filter_env": 7, "resonance": 92 }
        },
        { "key": "A2", "vel": 110, "ratchet": 4 },
        "-",
        "-"
      ]
    },
    "A21": {
      "lfo_rate": 0.7,
      "lfo_delay": 0.5,
      "pwm": 70,
      "pwm_source": "lfo",
      "pulse": "on",
      "saw": "off",
      "cutoff": 2400,
      "resonance": 0,
      "filter_env": 0.5,
      "key_follow": 40,
      "vca_level": -6,
      "attack": 0.8,
      "decay": 2,
      "sustain": 85,
      "release": 2.2,
      "chorus": "II",
      "voice_mode": "poly1"
    },
    "A22": {
      "pulse": "on",
      "pwm": 30,
      "cutoff": 420,
      "resonance": 30,
      "filter_env": 3.5,
      "key_follow": 50,
      "vca_level": 12,
      "attack": 0.0015,
      "decay": 0.3,
      "sustain": 0,
      "release": 0.25,
      "chorus": "II",
      "voice_mode": "chord",
      "chord": [0, 3, 7, 10, 14],
      "sequence": [
        "-",
        "-",
        { "key": "D3", "vel": 110, "lock": { "cutoff": 560 } },
        "-",
        "-",
        "-",
        { "key": "D3", "vel": 90 },
        "-",
        "-",
        "-",
        { "key": "D3", "vel": 110, "lock": { "cutoff": 900 } },
        "-",
        "-",
        { "key": "D3", "vel": 70, "chance": 50 },
        { "key": "D3", "vel": 96, "every": 2, "lock": { "cutoff": 1400 } },
        "-"
      ]
    },
    "A23": {
      "pulse": "on",
      "pwm": 25,
      "cutoff": 260,
      "resonance": 15,
      "filter_env": 4.2,
      "key_follow": 60,
      "vca_level": 6,
      "attack": 0.07,
      "decay": 0.7,
      "sustain": 65,
      "release": 0.4,
      "lfo_rate": 5.2,
      "lfo_delay": 0.8,
      "vco_mod": 0.12,
      "chorus": "I",
      "voice_mode": "poly1",
      "sequence": []
    },
    "A31": {
      "lfo_rate": 5,
      "lfo_delay": 0.6,
      "saw": "off",
      "noise": 15,
      "cutoff": 261.63,
      "resonance": 100,
      "filter_env": 0,
      "filter_mod": 0.02,
      "key_follow": 100,
      "vca_level": -3,
      "attack": 0.12,
      "sustain": 100,
      "release": 0.35,
      "portamento": 0.08,
      "portamento_mode": "on"
    },
    "A32": {
      "pulse": "on",
      "saw": "off",
      "pwm": 55,
      "hpf": "2",
      "cutoff": 650,
      "resonance": 35,
      "filter_env": 4.5,
      "key_follow": 80,
      "vca_level": 4,
      "attack": 0.0015,
      "decay": 0.22,
      "sustain": 0,
      "release": 0.35,
      "chorus": "I",
      "voice_mode": "poly1"
    },
    "A41": {
      "lfo_sync": "on",
      "lfo_division": "2bars",
      "lfo_wave": "random",
      "saw": "off",
      "noise": 100,
      "cutoff": 300,
      "resonance": 10,
      "filter_env": 3.5,
      "filter_mod": 1,
      "vca_level": 7,
      "attack": 1.2,
      "decay": 2.5,
      "sustain": 40,
      "release": 5,
      "trigger": "lfo"
    },
    "A42": {
      "lfo_rate": 5.5,
      "lfo_delay": 0.4,
      "vco_mod": 0.3,
      "cutoff": 700,
      "resonance": 35,
      "filter_env": 3,
      "key_follow": 70,
      "vca_level": 3,
      "attack": 0.005,
      "decay": 0.5,
      "sustain": 70,
      "release": 0.25,
      "portamento": 0.08,
      "portamento_mode": "on",
      "voice_mode": "unison"
    },
    "A43": {
      "lfo_sync": "on",
      "lfo_division": "1/16",
      "saw": "off",
      "noise": 100,
      "hpf": "2",
      "cutoff": 300,
      "resonance": 60,
      "filter_env": 0,
      "filter_mod": 0.4,
      "key_follow": 0,
      "vca_level": 5,
      "attack": 3,
      "sustain": 100,
      "release": 0.15
    },
    "A44": {
      "lfo_rate": 5.8,
      "lfo_delay": 0.35,
      "vco_mod": 0.35,
      "pwm": 45,
      "pwm_source": "lfo",
      "pulse": "on",
      "cutoff": 1000,
      "resonance": 40,
      "filter_env": 3.2,
      "key_follow": 70,
      "vca_level": 3,
      "attack": 0.005,
      "decay": 0.6,
      "sustain": 75,
      "release": 0.35,
      "portamento": 0.06,
      "portamento_mode": "on",
      "lfo_mod": 0.5,
      "voice_mode": "unison"
    }
  }
}

Every step of every part in that clip falls on the same sample as in the whole song from bar 49, and the tests check this for a take that starts a part partway, runs an arpeggio, rolls chance steps, restarts the clock, and has a pattern waiting for the very bar it starts on.

A loop plays the range over and over. At its end, the take lets go of what it holds and starts again from the machine at the range's first bar, so each time round plays the same.

Recording a part over the take, Ctrl+T, replaces what one part does in the range and keeps everything else:

  1. Set the range to the bars to record, and focus the part.
  2. Press Ctrl+T. The take plays from the bar before the range, so you can get ready; from bar 1, it starts at once. The status line says rec part 2.
  3. In the range, the take's own events for that part don't play. As the range starts, the take lets go of the part's keys and pedals, and you hear the other three parts and yourself. Keys you're already holding on the part go down in the take at the range's start.
  4. Play the part: the keys, its controls, its slots, and its sequencer. Only what you play on that part, inside the range, is recorded.
  5. At the range's end, the take stops, and the synth writes the next take-N files: the old take's project and bank, and its script with the part's events in the range replaced by yours. That becomes the take, so the next pass builds on it, and the old files stay as they were.

Every key and pedal stays paired: the take's keys down on the part when the range starts come up there, and their off lines later go; your keys still down at the range's end come up there.

At the range's end, the part is put back as the take had it there. The synth plays both takes up to that bar, compares the part, and writes what differs on the bar's first sample: the slot, with its pattern, then every control that still differs, the chord, and a start or a stop of the sequence. So a slot the take selected just before the range's end, to play after it, still plays after it, though its patch line fell inside the range and went. A pattern put back starts from its first step, and a pattern that isn't a slot's can't be put back, since a script can't write steps.

A part take stopped before the range's end, with Ctrl+T or Esc, isn't kept, so you can stop and try again.

So a song can be built in the window, as Shoreline was built in text: write the sounds and patterns into slots, and save them with the project; record a take of the structure and one part, choosing each pattern a little before its bar; then record the other parts over it one at a time, and redo any bars that went wrong.

A take is still a list of events in seconds, though, with nothing in it that says where a section starts or that two bars are the same. The studio holds a song by its structure, in bars, on tracks of clips, and takes a take in: studio import take-1.txt my-song makes a song of it, its project the synth's state and its script the tracks, clips, and lanes, and studio export my-song take.txt writes a song on one synth back out as a take that synth render plays as the studio does (the command line).

The examples

The examples/ directory has scripts, a patch, and projects to start from. The scripts that need a project or a patch give the command that renders them in their opening comments:

  • a440.txt: one second of A4, the tuning note.
  • alias.txt: a high saw, naive and then with PolyBLEP (chapter 1).
  • juno.txt: the Juno-106's strings on A22, then a unison lead on A61.
  • bass.txt: an SH-101 bass line, played note by note.
  • legato.txt: an arpeggio played legato, then a volume sweep.
  • singing-filter.txt: the filter alone, singing the keys.
  • chords.txt: six voices in Poly 1, then chord mode.
  • arpeggio.txt: the arpeggiator, with hold.
  • sequence.txt: sixteen steps loaded, with rests and ties, then played.
  • play.txt with bassline.json: a patch with a sequence, and the one-line script that plays it.
  • parts.txt with parts.json: four parts on one clock, and a lead over them.
  • steps.txt with steps.json: steps with velocity, ratchets, chance, and a lock.
  • space.txt with space.json: a pluck and a pad in the delay and the reverb, ringing out.
  • sync.txt with sync.json: LFOs locked to the tempo, through a tempo change and swing.

Next: chapter 14, recipes, sounds built from nothing, each with the patch and the reasoning behind it.