Add TTS vocal (140 BPM, dark smoky British female) as an audio track

vocal/make_vocal.py renders the line with Piper, pitched down and processed,
on a 140 BPM grid. build_track.py embeds it in the DAWproject as an unwarped
audio track (bars 129 and 185); --no-vocal opts out. README updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
valknarandClaude Sonnet 5.5 committed 2026-11-25 12:31:51 +01:00
1 parent fa33c7fd68
commit 2d1be6ffb0
6 files changed
+252 -10

No files matched your search

+41 -3
View File
@@ -7,14 +7,16 @@ Generates (stdlib only, deterministic):
midi/full_arrangement.mid all tracks, one SMF type 1 file
midi/NN_<track>.mid one full-length MIDI file per track
Usage: python3 build_track.py [--devices] [--no-automation]
Usage: python3 build_track.py [--devices] [--no-automation] [--no-vocal]
--devices add instrument-device hints to each track
--no-automation leave out the filter automation and kick-ducking (bare note tracks)
--no-vocal leave out the TTS vocal audio track
"""
import os
import random
import struct
import sys
import wave
import zipfile
from xml.sax.saxutils import quoteattr
@@ -25,6 +27,13 @@ PPQ = 960
TOTAL_BARS = 320
CHUNK = 8 # bars per arrangement clip
# Vocal (TTS) audio clip, rendered at 140 BPM by vocal/make_vocal.py. It is placed UNWARPED
# (original speed, clip content in seconds) so it keeps its own 140 BPM feel against the 150 BPM track.
VOCAL_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "vocal", "when_you_change_140bpm.wav")
VOCAL_BARS = [128, 184] # 0-based start bars: Breakdown opening, and the final riser into Drop 2
VOCAL_COLOR = "#c77dff"
VOCAL_VOLUME = 0.75
SECTIONS = [ # name, start bar, length
("Intro", 0, 32),
("Build 1", 32, 32),
@@ -629,8 +638,12 @@ def chunk_clips(notes):
return out
def build_dawproject(path, tracks, devices, automation=True):
def build_dawproject(path, tracks, devices, automation=True, vocal=True):
q = quoteattr
vocal = vocal and os.path.exists(VOCAL_FILE)
if vocal:
with wave.open(VOCAL_FILE) as w:
v_sr, v_ch, v_secs = w.getframerate(), w.getnchannels(), w.getnframes() / w.getframerate()
kick = next(t[1] for t in tracks if t[0] == "Kick 808")
curves = filter_curves() if automation else {}
n_points = 0
@@ -665,6 +678,13 @@ def build_dawproject(path, tracks, devices, automation=True):
x.append(' <Volume unit="linear" value="%s" id="vol%d"/>' % (fmt(vol), i))
x.append(' </Channel>')
x.append(' </Track>')
if vocal:
x.append(' <Track contentType="audio" loaded="true" id="t_vocal" name="Vocal" color=%s>' % q(VOCAL_COLOR))
x.append(' <Channel role="regular" audioChannels="%d" destination="c_master" id="c_vocal">' % v_ch)
x.append(' <Pan unit="normalized" value="0.5" id="pan_vocal"/>')
x.append(' <Volume unit="linear" value="%s" id="vol_vocal"/>' % fmt(VOCAL_VOLUME))
x.append(' </Channel>')
x.append(' </Track>')
x.append(' <Track contentType="audio notes" loaded="true" id="t_master" name="Master">')
x.append(' <Channel role="master" audioChannels="2" id="c_master">')
x.append(' <Volume unit="linear" value="0.8" id="vol_master"/>')
@@ -703,6 +723,19 @@ def build_dawproject(path, tracks, devices, automation=True):
x.append(' </Points>')
n_points += len(dp)
x.append(' </Lanes>')
if vocal:
x.append(' <Lanes track="t_vocal" id="lanes_vocal">')
x.append(' <Clips id="clips_vocal">')
for k, bar in enumerate(VOCAL_BARS):
x.append(' <Clip time="%s" duration="%s" contentTimeUnit="seconds" playStart="0" name=%s color=%s>'
% (fmt(bar * 4.0), fmt(v_secs * BPM / 60.0), q("When you change... %d" % (k + 1)), q(VOCAL_COLOR)))
x.append(' <Audio timeUnit="seconds" duration="%s" channels="%d" sampleRate="%d" id="vocal_audio%d">'
% (fmt(v_secs), v_ch, v_sr, k))
x.append(' <File path="audio/%s" external="false"/>' % os.path.basename(VOCAL_FILE))
x.append(' </Audio>')
x.append(' </Clip>')
x.append(' </Clips>')
x.append(' </Lanes>')
x.append(' </Lanes>')
x.append(' <Markers id="markers">')
for name, start, _ in SECTIONS:
@@ -717,6 +750,8 @@ def build_dawproject(path, tracks, devices, automation=True):
with zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED) as z:
z.writestr("metadata.xml", meta_xml)
z.writestr("project.xml", "\n".join(x) + "\n")
if vocal:
z.write(VOCAL_FILE, "audio/" + os.path.basename(VOCAL_FILE))
return n_points
@@ -729,12 +764,15 @@ def main():
slug = name.lower().replace(" ", "_")
write_midi(os.path.join(HERE, "midi", "%02d_%s.mid" % (i, slug)), [(name, ch, notes)])
out = os.path.join(HERE, "exit-progressive-emulation.dawproject")
n_auto = build_dawproject(out, tracks, devices, automation="--no-automation" not in sys.argv)
n_auto = build_dawproject(out, tracks, devices, automation="--no-automation" not in sys.argv,
vocal="--no-vocal" not in sys.argv)
secs = TOTAL_BARS * 4 * 60 / BPM
print("%s: %d bars @ %d BPM = %d:%02d" % (TITLE, TOTAL_BARS, BPM, secs // 60, secs % 60))
for name, notes, *_ in tracks:
print(" %-12s %5d notes" % (name, len(notes)))
print("automation breakpoints: %d" % n_auto)
print("vocal track: %s" % ("yes (bars %s)" % ", ".join(str(b + 1) for b in VOCAL_BARS)
if "--no-vocal" not in sys.argv and os.path.exists(VOCAL_FILE) else "no"))
print("wrote", out)