Add filter automation and kick-ducking sidechain to the DAWproject

Low-pass Equalizer band with automated cutoff on Saw Bass, Pad and Lead;
fader-ducking automation generated from the kick notes (DAWproject has no
sidechain routing). New --no-automation flag; READMEs updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
valknarandClaude Sonnet 5.5 committed 2026-11-25 10:39:10 +01:00
1 parent 3e3776a20d
commit fa33c7fd68
4 files changed
+196 -19

No files matched your search

+3 -1
View File
@@ -48,6 +48,7 @@ tracks/
cd exit-progressive-emulation cd exit-progressive-emulation
python3 build_track.py # writes the .dawproject and midi/ next to the script python3 build_track.py # writes the .dawproject and midi/ next to the script
python3 build_track.py --devices # same, with instrument-device hints on each track python3 build_track.py --devices # same, with instrument-device hints on each track
python3 build_track.py --no-automation # notes only, without the filter and ducking automation
``` ```
Then open Bitwig and use **File → Import → DAWproject**, or drag the `.mid` files onto instrument tracks. Then open Bitwig and use **File → Import → DAWproject**, or drag the `.mid` files onto instrument tracks.
@@ -75,7 +76,8 @@ The shipped `.dawproject` validates against the official schemas. The MIDI files
## Status and limitations ## Status and limitations
- Output has been **validated against the schema but not yet opened in Bitwig**. If an import misbehaves, the MIDI files are the dependable fallback. - Output has been **validated against the schema but not yet opened in Bitwig**. If an import misbehaves, the MIDI files are the dependable fallback.
- Generated tracks carry **notes, clip layout, section markers, volume and pan only**. Instrument patches, effects, automation and sidechain compression are left to be built in the DAW. - Generated tracks carry **notes, clip layout, section markers, volume and pan**, plus (for Exit Progressive Emulation) **low-pass filter automation and kick-ducking volume automation**. Instrument patches and other effects are left to be built in the DAW.
- DAWproject cannot express **sidechain routing**, so "sidechain" in a generated project means volume-ducking automation, not a compressor.
- DAWproject can name a device but cannot carry a Bitwig-specific patch, so device hints (`--devices`) are only hints. - DAWproject can name a device but cannot carry a Bitwig-specific patch, so device hints (`--devices`) are only hints.
## Conventions ## Conventions
+54 -12
View File
@@ -25,12 +25,13 @@ This README documents the song structure, every pattern, the harmony, the file f
4. [Harmony](#harmony) 4. [Harmony](#harmony)
5. [Tracks and patterns](#tracks-and-patterns) 5. [Tracks and patterns](#tracks-and-patterns)
6. [Intensity map](#intensity-map) 6. [Intensity map](#intensity-map)
7. [Sound design guide](#sound-design-guide) 7. [Filter automation and sidechain](#filter-automation-and-sidechain)
8. [File format details](#file-format-details) 8. [Sound design guide](#sound-design-guide)
9. [How the script is organised](#how-the-script-is-organised) 9. [File format details](#file-format-details)
10. [Customising the track](#customising-the-track) 10. [How the script is organised](#how-the-script-is-organised)
11. [Validation](#validation) 11. [Customising the track](#customising-the-track)
12. [Known limitations](#known-limitations) 12. [Validation](#validation)
13. [Known limitations](#known-limitations)
--- ---
@@ -67,6 +68,7 @@ exit-progressive-emulation/
```bash ```bash
python3 build_track.py # bare note tracks python3 build_track.py # bare note tracks
python3 build_track.py --devices # adds an instrument-device hint to each track python3 build_track.py --devices # adds an instrument-device hint to each track
python3 build_track.py --no-automation # notes only: no filter device, no automation
``` ```
The run prints the length and the note count per track. The seeds are fixed, so output is identical on every run. The run prints the length and the note count per track. The seeds are fixed, so output is identical on every run.
@@ -249,24 +251,57 @@ Note count per track and section, as a quick view of where the energy sits:
--- ---
## Filter automation and sidechain
The `.dawproject` carries two kinds of automation, both written as `Points` lanes in the arrangement (about 7,000 breakpoints in total).
### Filter automation
Saw Bass, Pad and Lead each get a standard DAWproject **Equalizer** device holding one **low-pass band**. Its cutoff is automated in Hz, with one breakpoint per bar on an exponential (log-frequency) curve. The filter is a generic device so that it can be expressed in the open format; it is not the Polysynth's own filter.
| Track | Q / order | Cutoff story |
|---|---|---|
| **Saw Bass** | 1.6 / 4 pole | Closed at 150 Hz until the bass enters. Build 1: 180 → 450 Hz offbeat, then 450 → 3,200 Hz as it starts rolling. **Drop 1:** one sweep per 8 bars (500 → 1,500 Hz in the first phrase), every phrase a little brighter. Breakdown: dark drone at 250 Hz, opening to 1,200 Hz. Build 2: 350 → 800 Hz, then 800 → 4,200 Hz. **Drop 2:** 12 phrases of 8 bars, sweeps getting wider (up to 5,000 Hz). Outro: 3,500 → 400 Hz. |
| **Pad** | 0.8 / 2 pole | 400 Hz until the Breakdown, then it blooms to 4,500 Hz. Build 2: 1,500 → 6,000 Hz. Drop 2: breathes between 2,500 and 4,500 Hz over 16 bars. |
| **Lead** | 1.4 / 2 pole | Breakdown: 1,200 → 3,500 Hz. Build 2: 900 → 7,000 Hz (the arp sweeps wide open). Drop 2: alternates 7,000 → 3,000 and 3,000 → 7,000 Hz every 8 bars. |
### Sidechain (kick ducking)
DAWproject has **no sidechain routing** (the schema's Compressor has no sidechain input), so a real sidechain compressor cannot be written into the file. Instead, the pump is **volume-ducking automation** on the channel faders, generated from the actual kick notes:
| Track | Fader level on each kick | Recovery |
|---|---|---|
| Saw Bass | 45 % of its level | 0.5 beat |
| Pad | 25 % of its level | 0.8 beat |
| Lead | 45 % of its level | 0.5 beat |
- Every kick hit drops the fader instantly and it recovers linearly, so the bass, pad and lead breathe around the kick.
- Where kicks come faster than the recovery (the Build 2 kick roll), the fader stays ducked instead of fluttering.
- In the Breakdown there are no kicks, so nothing ducks, and the fader returns to its normal level.
- The ducking is on the channel fader, so you will see a sawtooth on the track's volume lane. It stays editable in Bitwig; scale or delete it there.
To upgrade to a real sidechain in Bitwig: delete the `auto_duck` lanes, put a **Compressor** on the track with its sidechain input set to the **Kick 808** track, and set it to taste.
---
## Sound design guide ## Sound design guide
The files contain notes and arrangement, not sounds. These are suggestions for turning them into the intended character: heavy, industrial, dark. The files contain notes and arrangement, not sounds. These are suggestions for turning them into the intended character: heavy, industrial, dark.
| Track | Suggested instrument | Ideas | | Track | Suggested instrument | Ideas |
|---|---|---| |---|---|---|
| **Kick 808** | Drum Machine or Sampler with a long 808 kick | Tune the tail to F (about 43.65 Hz), add soft saturation and a short click. Use it as the **sidechain source** for the bass, pad and lead. | | **Kick 808** | Drum Machine or Sampler with a long 808 kick | Tune the tail to F (about 43.65 Hz), add soft saturation and a short click. The bass, pad and lead already duck to it (see [sidechain](#sidechain-kick-ducking)); use it as the sidechain source if you switch to a real compressor. |
| **Snare / Clap** | Drum Machine | A tight, cracked industrial snare layered with a clap. Short plate or room reverb, gated. | | **Snare / Clap** | Drum Machine | A tight, cracked industrial snare layered with a clap. Short plate or room reverb, gated. |
| **Hats** | Drum Machine | Closed (key 42) and open (46) hats; keep the open hat short so the groove stays tight. | | **Hats** | Drum Machine | Closed (key 42) and open (46) hats; keep the open hat short so the groove stays tight. |
| **Jungle Perc** | Drum Machine | Congas, bongos, toms, a rim and maracas on the key map above. Pan some hits wide. The track is panned slightly left by default. | | **Jungle Perc** | Drum Machine | Congas, bongos, toms, a rim and maracas on the key map above. Pan some hits wide. The track is panned slightly left by default. |
| **Saw Bass** | Polysynth | Three detuned saws plus a sub sine, low-pass filter with an envelope. Automate the cutoff upwards through each build. Add distortion for grit and sidechain from the kick. | | **Saw Bass** | Polysynth | Three detuned saws plus a sub sine, low-pass filter with an envelope. The file already automates a separate low-pass band on the track; you can drive the Polysynth's own filter too. Add distortion for grit. |
| **Pad** | Polysynth or Wavetable | Wide, slow-attack pad, low-passed, with long reverb. Most prominent in the Breakdown. | | **Pad** | Polysynth or Wavetable | Wide, slow-attack pad, low-passed, with long reverb. Most prominent in the Breakdown. |
| **Lead** | Polysynth or Wavetable | Plucky or acid-style saw with delay; automate the filter open towards Drop 2. | | **Lead** | Polysynth or Wavetable | Plucky or acid-style saw with delay; automate the filter open towards Drop 2. |
| **FX** | Sampler | Risers, impacts, crashes and reverse crashes on the keys above. | | **FX** | Sampler | Risers, impacts, crashes and reverse crashes on the keys above. |
**Mix starting points** (set in the project): Kick 0.90, Snare 0.72, Clap 0.60, Hats 0.55, Jungle Perc 0.60, Saw Bass 0.82, Pad 0.50, Lead 0.50, FX 0.55 (linear gain), master 0.8. **Mix starting points** (set in the project): Kick 0.90, Snare 0.72, Clap 0.60, Hats 0.55, Jungle Perc 0.60, Saw Bass 0.82, Pad 0.50, Lead 0.50, FX 0.55 (linear gain), master 0.8.
Further ideas not covered by the generator: filter and drive automation on the bass, a sidechain compressor driven by the kick, a bus compressor and a limiter on the master, and tempo-synced delay on the lead. Further ideas not covered by the generator: drive automation on the bass, a true sidechain compressor driven by the kick, a bus compressor and a limiter on the master, and tempo-synced delay on the lead.
--- ---
@@ -284,11 +319,12 @@ A zip archive with two files:
| File | Content | | File | Content |
|---|---| |---|---|
| `metadata.xml` | Title, genre, comment (tempo, key and bar count) | | `metadata.xml` | Title, genre, comment (tempo, key and bar count) |
| `project.xml` | Transport (150 BPM, 4/4), 9 tracks plus a master track, mixer channels (volume and pan), arrangement and section markers | | `project.xml` | Transport (150 BPM, 4/4), 9 tracks plus a master track, mixer channels (volume and pan), Equalizer filters, arrangement, automation and section markers |
- The arrangement uses `timeUnit="beats"`. Each track holds **8-bar clips** (32 beats) named after the section, such as "Drop 2 3", so the track is easy to rearrange or mute section by section. - The arrangement uses `timeUnit="beats"`. Each track holds **8-bar clips** (32 beats) named after the section, such as "Drop 2 3", so the track is easy to rearrange or mute section by section.
- Markers at each section start: Intro, Build 1, Drop 1, Breakdown, Build 2, Drop 2, Outro. - Markers at each section start: Intro, Build 1, Drop 1, Breakdown, Build 2, Drop 2, Outro.
- With `--devices`, each track also gets a `BuiltinDevice` hint (Drum Machine, Polysynth or Sampler). - With `--devices`, each track also gets a `BuiltinDevice` hint (Drum Machine, Polysynth or Sampler).
- Automation lives in `Points` lanes inside each track's arrangement lane: `auto_flt5/6/7` target the filter cutoff (`unit="hertz"`) and `auto_duck5/6/7` target the channel `Volume` (`unit="linear"`). Interpolation is `linear`, with `hold` where the fader waits for the next kick. `--no-automation` leaves out both the filter devices and the lanes.
--- ---
@@ -305,6 +341,7 @@ A zip archive with two files:
| `build_tracks()` | The track table: name, notes, channel, colour, volume, pan, device hint. Each generator gets its own seed (`1337 + n`). | | `build_tracks()` | The track table: name, notes, channel, colour, volume, pan, device hint. Each generator gets its own seed (`1337 + n`). |
| `finalize()` | Clamps notes to the arrangement, drops dead notes, sorts | | `finalize()` | Clamps notes to the arrangement, drops dead notes, sorts |
| MIDI writer | `vlq`, `meta`, `note_events`, `write_midi` | | MIDI writer | `vlq`, `meta`, `note_events`, `write_midi` |
| Automation | `FILTERS`, `DUCK`, `hold`, `sweep`, `tidy`, `filter_curves`, `duck_points` |
| DAWproject writer | `chunk_clips`, `build_dawproject` | | DAWproject writer | `chunk_clips`, `build_dawproject` |
| `main()` | Builds the tracks, writes the MIDI files and the `.dawproject`, prints a summary | | `main()` | Builds the tracks, writes the MIDI files and the `.dawproject`, prints a summary |
@@ -318,6 +355,8 @@ A zip archive with two files:
| Percussion groove | `PERC_A`, `PERC_B`, `PERC_C`, each a list of `(step, key, velocity)` | | Percussion groove | `PERC_A`, `PERC_B`, `PERC_C`, each a list of `(step, key, velocity)` |
| Feel of the hats, snares or bass | The matching `gen_*` function | | Feel of the hats, snares or bass | The matching `gen_*` function |
| Mix levels, colours, pan | The table in `build_tracks()` | | Mix levels, colours, pan | The table in `build_tracks()` |
| Filter curves | `filter_curves()` (breakpoints per track via `hold()` and `sweep()`), `FILTERS` for Q and order |
| Pump depth and release | `DUCK` (per track: depth, release in beats) |
| A different variation | Change the seed offsets in `build_tracks()` (`r(n)`) | | A different variation | Change the seed offsets in `build_tracks()` (`r(n)`) |
After editing, re-run `python3 build_track.py` and re-import into Bitwig. After editing, re-run `python3 build_track.py` and re-import into Bitwig.
@@ -330,12 +369,15 @@ xmllint --noout --schema Project.xsd /tmp/dp/project.xml
xmllint --noout --schema MetaData.xsd /tmp/dp/metadata.xml xmllint --noout --schema MetaData.xsd /tmp/dp/metadata.xml
``` ```
Both schemas come from [bitwig/dawproject](https://github.com/bitwig/dawproject). The shipped file validates with and without `--devices`. The MIDI files were parsed back: 150 BPM, 960 PPQ, nine instrument tracks, and the last note-ons fall within bar 320. Both schemas come from [bitwig/dawproject](https://github.com/bitwig/dawproject). The shipped file validates with and without `--devices` and `--no-automation`. A script check also confirmed that every automation target resolves to a real parameter id and that breakpoint times strictly increase. The MIDI files were parsed back: 150 BPM, 960 PPQ, nine instrument tracks, and the last note-ons fall within bar 320.
## Known limitations ## Known limitations
- **Not yet tested in Bitwig.** The project is schema-valid, but I could not open it in Bitwig from the build machine. - **Not yet tested in Bitwig.** The project is schema-valid, but I could not open it in Bitwig from the build machine.
- **Notes, clips, markers, volume and pan only.** No instrument patches, effects, automation or sidechain: those are the next layer, built in the DAW. - **Notes, clips, markers, volume, pan and the automation above.** No instrument patches or other effects: those are the next layer, built in the DAW.
- **The sidechain is volume ducking, not a compressor.** DAWproject cannot express sidechain routing.
- **The filter is an Equalizer low-pass band, not the instrument's own filter.** Bitwig-specific device parameters cannot be addressed from the open format.
- Whether Bitwig imports the Equalizer band and the automation lanes exactly as written is **untested**.
- The `--devices` option only names a device type; Bitwig may still need you to load the instrument yourself. - The `--devices` option only names a device type; Bitwig may still need you to load the instrument yourself.
- The strictly regular, generated groove is tight by design. Humanisation is limited to small timing jitter on hats, percussion and shaker, plus velocity variation on the hats. - The strictly regular, generated groove is tight by design. Humanisation is limited to small timing jitter on hats, percussion and shaker, plus velocity variation on the hats.
- Chord changes are fixed per section, so the harmony is deliberately simple. The progression carries the track through repetition. - Chord changes are fixed per section, so the harmony is deliberately simple. The progression carries the track through repetition.
+139 -6
View File
@@ -7,8 +7,9 @@ Generates (stdlib only, deterministic):
midi/full_arrangement.mid all tracks, one SMF type 1 file midi/full_arrangement.mid all tracks, one SMF type 1 file
midi/NN_<track>.mid one full-length MIDI file per track midi/NN_<track>.mid one full-length MIDI file per track
Usage: python3 build_track.py [--devices] Usage: python3 build_track.py [--devices] [--no-automation]
--devices add instrument-device hints to each track (default: bare note tracks) --devices add instrument-device hints to each track
--no-automation leave out the filter automation and kick-ducking (bare note tracks)
""" """
import os import os
import random import random
@@ -508,6 +509,105 @@ def write_midi(path, tracks):
f.write(header + b"".join(chunks)) f.write(header + b"".join(chunks))
# ---------------------------------------------------------------- automation
# Filter: a low-pass band on a standard DAWproject Equalizer, cutoff automated in Hz.
# Sidechain: DAWproject has no sidechain routing, so the kick "pump" is written as
# volume-ducking automation on the channel faders (synchronised to the kick notes).
FILTERS = { # track -> (Q, filter order)
"Saw Bass": (1.6, 4),
"Pad": (0.8, 2),
"Lead": (1.4, 2),
}
DUCK = { # track -> (depth = fraction of fader level at the kick hit, release in beats)
"Saw Bass": (0.45, 0.5),
"Pad": (0.25, 0.8),
"Lead": (0.45, 0.5),
}
def hold(pts, bar0, bar1, hz):
pts += [(bar0 * 4.0, hz), (bar1 * 4.0, hz)]
def sweep(pts, bar0, bar1, f0, f1):
"""Exponential (log-frequency) cutoff sweep, one breakpoint per bar."""
n = max(1, bar1 - bar0)
for i in range(n + 1):
pts.append(((bar0 + i) * 4.0, f0 * (f1 / f0) ** (i / n)))
def tidy(pts):
"""Make breakpoint times strictly increasing (a reset becomes a 1/16-beat snap)."""
pts = sorted(pts, key=lambda p: p[0])
for i in range(len(pts) - 2, -1, -1):
if pts[i][0] >= pts[i + 1][0]:
pts[i] = (pts[i + 1][0] - 0.0625, pts[i][1])
return pts
def filter_curves():
"""Cutoff breakpoints in Hz, as {track: [(beat, hz)]}; bars are 0-based."""
bass = []
hold(bass, 0, 48, 150)
sweep(bass, 48, 56, 180, 450) # Build 1: offbeat bass creeps in
sweep(bass, 56, 64, 450, 3200) # Build 1: rolling bass opens up
for i in range(8): # Drop 1: one sweep per 8-bar phrase, ever brighter
sweep(bass, 64 + 8 * i, 72 + 8 * i, 500 + 50 * i, 1500 + 150 * i)
hold(bass, 128, 136, 250) # Breakdown: dark drone ...
sweep(bass, 136, 160, 250, 1200) # ... slowly opening
hold(bass, 160, 172, 600)
sweep(bass, 172, 180, 350, 800) # Build 2: offbeat bass
sweep(bass, 180, 192, 800, 4200) # Build 2: rolling bass opens
for i in range(12): # Drop 2: sweeps get wider every phrase
sweep(bass, 192 + 8 * i, 200 + 8 * i, 900 + 60 * i, min(2200 + 250 * i, 5000))
sweep(bass, 288, 304, 3500, 1500) # Outro: closing down
sweep(bass, 304, 312, 1500, 400)
hold(bass, 312, 320, 400)
pad = []
hold(pad, 0, 128, 400)
sweep(pad, 128, 160, 400, 4500) # Breakdown: pad blooms
hold(pad, 160, 176, 1500)
sweep(pad, 176, 192, 1500, 6000) # Build 2: pad opens into the drop
for i in range(6): # Drop 2: breathing over 16 bars
sweep(pad, 192 + 16 * i, 200 + 16 * i, 2500, 4500)
sweep(pad, 200 + 16 * i, 208 + 16 * i, 4500, 2500)
hold(pad, 288, 320, 2500)
lead = []
hold(lead, 0, 128, 1200)
sweep(lead, 128, 160, 1200, 3500) # Breakdown: melody brightens
hold(lead, 160, 176, 900)
sweep(lead, 176, 192, 900, 7000) # Build 2: arp sweeps wide open
hold(lead, 192, 200, 7000)
for i in range(11): # Drop 2: alternate closing and opening
if i % 2 == 0:
sweep(lead, 200 + 8 * i, 208 + 8 * i, 7000, 3000)
else:
sweep(lead, 200 + 8 * i, 208 + 8 * i, 3000, 7000)
hold(lead, 288, 320, 3500)
return {"Saw Bass": tidy(bass), "Pad": tidy(pad), "Lead": tidy(lead)}
def duck_points(kick_notes, base, depth, release):
"""Fader automation: drop to base*depth on every kick, recover over `release` beats."""
ons = sorted({n[0] for n in kick_notes})
pts = []
ducked = False
if not ons or ons[0] > 0:
pts.append((0.0, base, "hold"))
for i, t in enumerate(ons):
if not ducked:
pts.append((t, base * depth, "linear"))
ducked = True
nxt = ons[i + 1] if i + 1 < len(ons) else None
if nxt is not None and nxt - t <= release + 0.05:
continue # next kick arrives before recovery: stay ducked (kick roll)
pts.append((t + release, base, "hold"))
ducked = False
return pts
# ---------------------------------------------------------------- DAWproject writer # ---------------------------------------------------------------- DAWproject writer
def fmt(x): def fmt(x):
return ("%.5f" % x).rstrip("0").rstrip(".") return ("%.5f" % x).rstrip("0").rstrip(".")
@@ -529,8 +629,11 @@ def chunk_clips(notes):
return out return out
def build_dawproject(path, tracks, devices): def build_dawproject(path, tracks, devices, automation=True):
q = quoteattr q = quoteattr
kick = next(t[1] for t in tracks if t[0] == "Kick 808")
curves = filter_curves() if automation else {}
n_points = 0
x = ['<?xml version="1.0" encoding="UTF-8"?>', x = ['<?xml version="1.0" encoding="UTF-8"?>',
'<Project version="1.0">', '<Project version="1.0">',
' <Application name="build_track.py" version="1.0"/>', ' <Application name="build_track.py" version="1.0"/>',
@@ -542,9 +645,21 @@ def build_dawproject(path, tracks, devices):
for i, (name, notes, ch, color, vol, pan, dev) in enumerate(tracks): for i, (name, notes, ch, color, vol, pan, dev) in enumerate(tracks):
x.append(' <Track contentType="notes" loaded="true" id="t%d" name=%s color=%s>' % (i, q(name), q(color))) x.append(' <Track contentType="notes" loaded="true" id="t%d" name=%s color=%s>' % (i, q(name), q(color)))
x.append(' <Channel role="regular" audioChannels="2" destination="c_master" id="c%d">' % i) x.append(' <Channel role="regular" audioChannels="2" destination="c_master" id="c%d">' % i)
if devices: has_filter = automation and name in FILTERS
if devices or has_filter:
x.append(' <Devices>') x.append(' <Devices>')
x.append(' <BuiltinDevice deviceName=%s deviceRole=%s id="d%d"/>' % (q(dev[0]), q(dev[1]), i)) if devices:
x.append(' <BuiltinDevice deviceName=%s deviceRole=%s id="d%d"/>' % (q(dev[0]), q(dev[1]), i))
if has_filter:
fq, order = FILTERS[name]
x.append(' <Equalizer deviceName="Filter" deviceRole="audioFX" id="eq%d">' % i)
x.append(' <Band type="lowPass" order="%d">' % order)
x.append(' <Freq unit="hertz" value="%s" min="20" max="20000" id="flt%d"/>'
% (fmt(curves[name][0][1]), i))
x.append(' <Q unit="linear" value="%s" min="0.1" max="10" id="flq%d"/>' % (fmt(fq), i))
x.append(' <Enabled value="true" id="fle%d"/>' % i)
x.append(' </Band>')
x.append(' </Equalizer>')
x.append(' </Devices>') x.append(' </Devices>')
x.append(' <Pan unit="normalized" value="%s" id="pan%d"/>' % (fmt(pan), i)) x.append(' <Pan unit="normalized" value="%s" id="pan%d"/>' % (fmt(pan), i))
x.append(' <Volume unit="linear" value="%s" id="vol%d"/>' % (fmt(vol), i)) x.append(' <Volume unit="linear" value="%s" id="vol%d"/>' % (fmt(vol), i))
@@ -571,6 +686,22 @@ def build_dawproject(path, tracks, devices):
x.append(' </Notes>') x.append(' </Notes>')
x.append(' </Clip>') x.append(' </Clip>')
x.append(' </Clips>') x.append(' </Clips>')
if automation and name in FILTERS:
x.append(' <Points id="auto_flt%d" unit="hertz" timeUnit="beats">' % i)
x.append(' <Target parameter="flt%d"/>' % i)
for t, hz in curves[name]:
x.append(' <RealPoint time="%s" value="%s" interpolation="linear"/>' % (fmt(t), fmt(hz)))
x.append(' </Points>')
n_points += len(curves[name])
if automation and name in DUCK:
depth, rel = DUCK[name]
dp = duck_points(kick, vol, depth, rel)
x.append(' <Points id="auto_duck%d" unit="linear" timeUnit="beats">' % i)
x.append(' <Target parameter="vol%d"/>' % i)
for t, v, interp in dp:
x.append(' <RealPoint time="%s" value="%s" interpolation="%s"/>' % (fmt(t), fmt(v), interp))
x.append(' </Points>')
n_points += len(dp)
x.append(' </Lanes>') x.append(' </Lanes>')
x.append(' </Lanes>') x.append(' </Lanes>')
x.append(' <Markers id="markers">') x.append(' <Markers id="markers">')
@@ -586,6 +717,7 @@ def build_dawproject(path, tracks, devices):
with zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED) as z: with zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED) as z:
z.writestr("metadata.xml", meta_xml) z.writestr("metadata.xml", meta_xml)
z.writestr("project.xml", "\n".join(x) + "\n") z.writestr("project.xml", "\n".join(x) + "\n")
return n_points
def main(): def main():
@@ -597,11 +729,12 @@ def main():
slug = name.lower().replace(" ", "_") slug = name.lower().replace(" ", "_")
write_midi(os.path.join(HERE, "midi", "%02d_%s.mid" % (i, slug)), [(name, ch, notes)]) write_midi(os.path.join(HERE, "midi", "%02d_%s.mid" % (i, slug)), [(name, ch, notes)])
out = os.path.join(HERE, "exit-progressive-emulation.dawproject") out = os.path.join(HERE, "exit-progressive-emulation.dawproject")
build_dawproject(out, tracks, devices) n_auto = build_dawproject(out, tracks, devices, automation="--no-automation" not in sys.argv)
secs = TOTAL_BARS * 4 * 60 / BPM secs = TOTAL_BARS * 4 * 60 / BPM
print("%s: %d bars @ %d BPM = %d:%02d" % (TITLE, TOTAL_BARS, BPM, secs // 60, secs % 60)) print("%s: %d bars @ %d BPM = %d:%02d" % (TITLE, TOTAL_BARS, BPM, secs // 60, secs % 60))
for name, notes, *_ in tracks: for name, notes, *_ in tracks:
print(" %-12s %5d notes" % (name, len(notes))) print(" %-12s %5d notes" % (name, len(notes)))
print("automation breakpoints: %d" % n_auto)
print("wrote", out) print("wrote", out)