Files
fm1-x0x/tests/host/make_test_loops.py
T
Charles VestalandClaude Opus 5.5 7a58fed674 Reverb + delay sends on every part; breaks optional at build, uploadable to slots
- every part has Rev and Dly sends (drum kits on top of per-voice sends);
  FX opens on the send pages, with the delay type (DIGI / TAPE) and time
- the firmware ships no recorded breaks: the built-in loops are rendered at
  build time by X0X's own 909 (909 GR, 909 FL)
- opt-in: X0X_BREAK_BANK=DIR builds a bank of one-bar WAVs into the firmware
  (tools/import_breaks.py cuts BB Gen's classics into build/breaks/; a 150 KB
  flash budget is enforced by tools/gen_break_bank.py)
- every zone of a user sample slot is now its own loop; tools/upload_breaks.py
  cuts, packs (~3 one-bar breaks per slot) and uploads, or --dry-run builds the
  images; the simulator loads those images through the firmware's slots.c
- scenarios: jam (sends), upload (synthetic loops through the real slot format)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011D8j7XnG2okLwUaC1MexPV
2026-10-03 19:35:45 +02:00

26 lines
1.1 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-only
"""Synthetic one-bar test loops (no recordings): 8 tone bursts each, a different pitch set per
loop, so a slice is identifiable. Used by the upload scenario.
make_test_loops.py OUTDIR"""
import math
import struct
import sys
from pathlib import Path
out = Path(sys.argv[1])
out.mkdir(parents=True, exist_ok=True)
sr, bpm = 44100, 110
n = int(sr * 240 / bpm) # one bar
for k, base in enumerate((220, 330, 440, 550)):
x = []
for i in range(n):
e, t = divmod(i, n // 8)
f = base * (1 + e / 8)
x.append(0.8 * math.sin(2 * math.pi * f * t / sr) * math.exp(-t / (sr * 0.04)))
pcm = b"".join(struct.pack("<h", int(v * 32767)) for v in x)
(out / f"loop{k + 1}.wav").write_bytes(b"RIFF" + struct.pack("<I", 36 + len(pcm)) + b"WAVEfmt " +
struct.pack("<IHHIIHH", 16, 1, 1, sr, sr * 2, 2, 16) + b"data" +
struct.pack("<I", len(pcm)) + pcm)
print(f"4 test loops in {out}")