Files
JIANT/tools/size_fns.py
T
Claude 56e57cc5d4 V10.8.75: MATH USER, a formula of one's own on a MATH track (JIANT BYTE's formula machine); ALGO 128 .. 191 saved; the stop-side click
Juan: "Lo implementaría solo en math" (formulas of his own, not only the
factory ones).

MATH USER (firmware/src/math_user.c, new):
- The machine is JIANT BYTE's (its fvm.c, GPL-3.0, Juan's): the instructions
  BYTE's compiler makes from a text, serialized, with BYTE's operator numbers
  (FO_*) and meaning (FVM_OPS2 / FVM_OPS1, copied), run a sample at a time
  (BYTE runs each instruction over a block). Every stateless instruction:
  - INT (bytebeat): + - * / % & | ^ << >>, every comparison (unsigned and
    signed), && ||, min max;
  - FIX (floatbeat, Q16.16): MULF MULIF DIVF DIVFI MODF ITOF FTOI FLOOR;
  - NEG NOT LNOT ABS, sin tri saw sqr rnd (both kinds), SAT (clip, cos
    compile to these), ?: and the string tables;
  - the variables t, w (FLOAT's phase), a (VAR's 1..16), n v (note,
    velocity); BYTE's others read 0, as BYTE's own do where its host does
    not make them.
  Not here (refused when checked): ph() lp() hp() (a state per voice), eu(),
  FUNC's calls and func{}. DIVF uses the divider and at most 16 steps (no
  64-bit division linked); products through core.h's mul64.
- The bytes: [0] the type (bit 0 FIX) | 2 a table pool follows ([1] its
  length 1..32, its bytes); then op | md << 6 each, md 0 the stack, 1 a
  number (LEB128), 2 a variable (BYTE's FA_ / FU_ index), 3 t (no byte); TAB
  its table as a number. At most 64 bytes (MU_MAX), a stack of 12 (BYTE's
  FVM_DEPTH). B16 (65) and F43 (125) don't fit; every other of BYTE's 96
  factory texts does (14 .. 63 B).
- Checked when it arrives (mu_check): every op known, its operand whole, the
  stack never under 1 nor over 12, one left, a table inside its pool. The
  machine itself stays inside its stack (16, indexed & 15) and its bytes
  whatever they are (a set half-written while a block reads it); / and % by
  0 give 0, shifts & 31.
- One a track (mu_c, 6 x 65 B). Played at ALGO USER: P_E2 stored -4 (-4 ..
  -1), before B01 / F01. lofi_byte / lofi_float: case 63 (f = p >> 2,
  unsigned) in their jump tables, so MATH's own formulas take no test a
  sample (scene 0d's instructions below V10.8.74's).
  - BYTE (WAVE 5, 7): the result's low byte, with VAR, MOTION, LOOP, BEND,
    GRIT, CHIP, SYNC as MATH's own; a t already read is not read again (t
    moves at ~8 kHz at C4).
  - FLOAT (WAVE 6): BYTE's fvm_sample (FIX -1 .. 1; INT as bytebeat), w = x << 3,
    BYTE's phase in Q16 turns.
- The knob: lofi_desc gives a track that holds a formula (or is at USER)
  ALGO -4 .. 191, USER first (N_BYTEU / N_FLOATU: "USER\0" before B01 / F01
  in PNE, 10 B); a track without one keeps 0 .. 191 exactly as before, so
  DICE, the matrix and MIDI see the same ranges. params.c param_fit keeps
  -4 .. 191 for MATH's ALGO when a project / preset / automation is read.

Limits (Juan: "cuidá la CPU"):
- read at most 11025 times a second, at every rate (VH_SH) and hold (GRIT,
  4B/2): a bucket of two reads, so a t a little uneven under the cap is read
  as it comes; past it the value read last. Below about F4 (t under 11 kHz)
  BYTE wave is bit for bit BYTE's machine; above it, held.
- at most 4 voices of formulas of one's own sounding, every track's together
  (voice.c mu_cap: a fifth fades the oldest out); the voice admission
  (load_admit, measured) stays the backstop.
- one pass over at most 64 bytes a read, no loop but DIVF's 16 steps.

Storage:
- the project: FUNC's 'F' 'U' block after 'O' 'T' (the last: an older firmware
  stops before it), each track's length and bytes, when one holds a formula;
  checked again when read. proj_mu beside the project, not in it (the pool has
  32 B to spare): proj_scratch, the firmware's one project_t, reads and writes it.
  A project without the block loads none; CLEAR PROJECT clears them; UNDO and
  backups carry them. An older firmware loads ALGO -4 as B01.
- a user preset keeps ALGO USER but not the formula (its 192-byte record has
  ~12 bytes spare): the track's formula plays.
- a song's sections share the formulas loaded (as VOICE's lyrics).

ALGO 128 .. 191 saved (a bug since p6): MATH's ALGO above 127 (B33 .. B48,
F33 .. F48) made every project save fail with SAVE FORMAT ERROR 4 (proj_pack
refused a value over 127) and a user preset load it as B01 (its byte read
-128 .. -65). proj_pack takes MATH's ALGO to 191; projects and user presets
read -128 .. -65 back as 128 .. 191 (math_user.c mu_algo_in), param_fit keeps
it. Not fixed (separate, older): FLOAT's ALGO B (P_E0) is clamped to CHIP's
0..3 when a project loads (F01 .. F01).

Editor protocol 1.5 (editor.c):
- FORMULA (100): track, op (0 query, 1 set + pack7 of the bytes, 2 clear) ->
  track, rc (1: refused, the track's as it was), length, pack7. pack7 is
  BACKUP_PUT's groups (ed_unpack7 / ed_bk_pack).
- INFO tag 45 02 64 12 ('E', before 'C'); 'C' 43 02 01 05.
- web/EDITOR_PROTOCOL.md "1.5" (also in the site's, wt-ed formula-work).
- The emulator (web/emu) needs nothing more: web_ed carries FORMULA, so the
  editor's preview runs this machine.

The stop-side click (crash screen, UBOOT, update reset), commit 65691824 on
pop-fix, cherry-picked: fm1_audio_stop lowers PC6 first, keeps the DMA 5 ms
more, then stops (out of line); ota_commit stops the audio before its reset;
tests/audio_order_test.py (run_tests.sh). audio.c and the golden renders
unchanged.

Flash (V10.8.74: 96 B free; this work ~2.5 KB: the machine 1.7 KB, FORMULA
~0.35 KB, the project block ~0.3 KB, the ALGO fix and the descs ~0.15 KB, the
stop fix 54 B):
- MATH's 48 floatbeats (lofi_float) built for size: the sines a call each
  instead of inlined, half its size, -1682 B.
- a block's control and once-an-event sound functions built for size, none in
  HOT_FNS: the kit's sounds (dx_run_fx), the master's TAPE, a track's COMB,
  the kit's bus, DRONE CLAY's composer, the punch-in lane's step; a quiet tail
  looked for, a punch-in's SLICER let go, a fitted span, a punch-in slot, a
  kit step's hit, a note's VEL and HUMAN, a key's MIDI out, MATH USER's cap.
- tools/size_fns.py: math_user.c in SIZE_FILES (its main-loop side).
Image 204 B free (584132 of 584336), BT 36 B free (73692 of 73728), RAM
.data+.bss 184 B free (98120 of 98304: the formulas 390 B, their project copy
390 B, the cores' voices 64 B), pool spare 8224 B, RAM code 40384 of 42496 B.
audio.c is V23's. REPIN=keep; a plain build passes; tools/audio_layout.txt
and audio_map.txt recorded.

CPU (tests/cpu_lines_test.py), each scene's worst block, core 0/core 1,
V10.8.74 -> V10.8.75 (both measured now):
  101 78/44 -> 79/44   102 62/28 -> 62/28   103 85/14 -> 85/14
  104 51/14 -> 51/14   105 66/42 -> 66/41   106 52/36 -> 52/36
  107 63/11 -> 63/11   108 50/29 -> 51/29   0c  70/57 -> 69/58
  0d  71/51 -> 71/52   0e  --    -> 85/61
Instructions identical in 101 .. 108 and 0c; 0d's lower (135.5k / 160.4k ->
135.2k / 160.2k a block). The lines move by a few with the flash layout
(+-1 point, as before). New scenes: 0d the CPU TEST's song with its three
synths MATH (BYTEBEAT B02, MATH KEYS F28, MATH PAD F12: factory formulas,
what V10.8.74 runs too); 0e the same with the first two MATH USER (B03's
bytecode on BYTE, 37 B; F20's floatbeat in FIX on FLOAT, 63 B, the longest
of BYTE's factory ones that fit), their chords capped at four voices: +14 /
+9 points over 0d, opt-in.

Tests:
- tests/math_user_test.c (new, in the workflow and run_tests.sh):
  - BYTE: the 135 formulas of tests/math_user_gold.h (BYTE's own
    fvm_compile and fvm_run on BYTE's 96 factory texts and formulas of every
    operator: tools/math_user_gold.c, built in a BYTE checkout, and
    tools/math_user_gold.py) give BYTE's values, 3 x 4160 each; the two over
    64 bytes refused;
  - factory: MATH's own 47 bytebeats as bytecode give lofi_byte's values,
    every a, 2^17 + random t;
  - DIVF and MULF against 64-bit arithmetic, 2M random operands; BYTE's
    operator numbers;
  - check: lp ph eu, a push without a value, the stack under 1 / over 12 / two
    left, a number cut short or of six bytes, a header bit, a table out of its
    pool, 0 and 65 bytes refused; a refused set leaves the track's;
  - fuzz: 400000 random and mutated inputs, checked and run, and 400000 run
    unchecked (any length byte): no crash under ASan, 0.2 s;
  - voice: B01's bytecode at ALGO USER renders B01 bit for bit at C4; the cap
    holds at C7; FLOAT plays it; nine USER notes on three tracks: four sound;
  - storage: a project with two formulas, ALGO USER and ALGO 150 packs,
    loads, restores byte for byte; 'F' 'U' the last block; one without it
    loads none; user presets keep ALGO 150 and USER; the knob: USER only
    where a formula is.
- app_contract: INFO's 'E' 64 12 before 'C'; FORMULA's query, a set (pack7)
  read back, a malformed one refused (rc 1, the track's kept), no reply for
  track 9, a clear.
- project, descdump (identical to V10.8.74's), audio_order pass; editor_test
  fails the same 6 checks as V10.8.74.
- The local workflow: steps 2 .. 29 pass, the emulator job included (emsdk
  6.0.11: the wasm built, native-check, gen-web, resound-web, emu_test).
- The site's editor (wt-ed formula-work, not here): its FVM port of BYTE's
  compiler gives BYTE's bytes for all 135, its math_test and
  editor_browser_test pass against this commit's wasm (a formula sent to
  track 4 with FORMULA, ALGO -4, read back).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
2026-11-30 11:12:39 +00:00

235 lines
18 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-only
# Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments
# Portions Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
"""Build the main-loop code for size (build.py): the functions defined in SIZE_FILES get LLVM's
minsize (about -Oz) while everything else (the sound, render and ISR code, the flash and OTA code,
the main loop) keeps -Os. The JieLi clang 4 has no '#pragma clang attribute' and its minsize
attribute is an error on variables, so build.py compiles felucca.c to LLVM IR without the
optimizer, this script adds 'minsize' to those definitions, and the IR is then compiled at -Os
(without the edit, that round trip is byte-identical to compiling felucca.c directly).
size_fns.py IN.ll OUT.ll"""
import re
import sys
from pathlib import Path
_ROOT = Path(__file__).resolve().parents[1]
SRC = _ROOT / "firmware" / "src" if (_ROOT / "firmware" / "src").is_dir() else _ROOT / "src" # either layout
# the UI, the stores, the editor and the console: main loop only, never called by sound code; and (1.1) every
# other file without DSP: USB, MIDI, the sequencer, the drawing, the LCD, OTA, ... Of those, what an interrupt
# reaches (ISR_ROOTS and everything they call or name, from the IR) keeps -Os (isr_reach)
SIZE_FILES = ["ui.c", "favorites.c", "menu_items.c", "icons.c", "ui_graph.c", "ui_draw.c", "ui_menu.c", "ui_input.c",
"storage.c", "upreset.c", "project.c", "settings_persist.c",
"editor.c", "editor_preferences.c", "editor_backup.c", "editor_menu.c", "console.c",
"usb.c", "midi_uart.c", "midi_control.c", "midi_clock.c", "seq.c", "song_chain.c", "motion.c",
"panel.c", "lcd.c", "gfx.c", "ota.c", "ota_hw.c", "up_fm6.c", "params.c", "editor_fm6.c",
"ui_layer.c", "ui_name.c", "ui_events.c", "song_main.c", "main.c", "libc.c", "storage_hw.c", "engines.c", "fm4_convert.c",
# (0.9.0) the files the ones above include, missed until now (-16.7 KB): GEN, DICE, the lenses, the line
# art, the beings, the tech graphs, the tools, the FM6 bank and VOICE's words (its sound side, reached
# from the audio ISR through ENG[]'s hooks, keeps -Os: isr_reach follows globals)
"gen.c", "gen_tables.c", "song_dice.c", "ui_lens.c", "ui_organic.c", "ui_fm6op.c", "ui_being.c",
"ui_engvis.c", "ui_tech.c", "ui_lzsave.c", "ui_lzfx.c", "ui_lzhome.c", "ui_lzedit.c", "ui_lzpage.c", "ui_dx.c",
"ui_tools.c", "fm6_vbank.c", "sing.c",
# (0.9.7) the main-loop functions of the sound files (what the interrupts reach stays -Os, as above): the
# MASTER pot's boot and poll, FM6's patch store, the kit's names and grids, MOD's names, the PUNCH lane
"pfx.c", "master.c", "audio.c", "mod.c", "fx.c", "drumx_voice.c", "eng_drum.c", "eng_fm6.c",
# (V10.29) the files added since, and the other engines' main-loop side (as 0.9.7's: what the
# interrupts reach keeps -Os): EUCLID, SCENE, LIVE, MIDI LEARN, the song player, PERFORM, PLAYHEADS
"ui_euclid.c", "ui_scene.c", "seq_live.c", "midi_learn.c", "song_play.c", "perform.c",
"fugue.c", "slicer.c", "voice.c", "fm6_core.c", "eng_add.c", "eng_analog.c", "eng_animal.c",
"eng_digital.c", "eng_formant.c", "eng_lofi.c", "eng_west.c", "eng_phase.c", "eng_string.c",
"eng_wheel.c", "bt.c", "click.c",
# Whole-song SAVE is main-loop storage work, added after this list.
# As above, anything reached from an ISR remains at -Os.
"song_save.c", "eng_input.c", "usb_host.c", "gen_track.c", "gen_loop.c",
# (V10.6z6) the velocity diagnostic and the keys' velocity: their main-loop side (the scan's, -Os)
"vel_diag.c", "vel.c", "cpu_safe.c", "bt_hw.c", "sing_ext.c", "seq_fit.c",
# (V10.8.53) the pictures' shared engine, the screen mirror, the stopped notes' preview (main loop)
"ui_gx.c", "editor_screen.c", "seq_preview.c",
# (V10.8.71, as JIANT BYTE: flash for OTT) DRONE CLAY's pages and composer, their main-loop side (clay_tick,
# what the audio runs, an interrupt reaches: -Os, isr_reach)
"clay.c", "clay_form.c",
# (V10.8.75) MATH USER: its main-loop side (a formula checked and set; the machine an interrupt reaches: -Os)
"math_user.c"]
ISR_ROOTS = ("fm1_alnk0_irq", "fm1_timer5_irq") # hal/fm1_isr.S: the audio ISR, the key / LED scan (+ USB poll)
DEF = re.compile(r"^(?:static|void|int|uint\w*|int\w*|const)\b[^;=(]*?\b([A-Za-z_]\w*)\s*\(", re.M)
IR_DEF = re.compile(r"^(define [^\n]*?@\"?([\w.]+)\"?\([^\n]*\)(?: unnamed_addr| local_unnamed_addr)?)( #\d+[^\n]*\{)$",
re.M)
def definitions(text):
"""names of the functions text defines (a signature at column 0 whose ')' is followed by '{')"""
names = []
text = re.sub(r"/\*.*?\*/|//[^\n]*", " ", text, flags=re.S) # comments (none hold code)
text = re.sub(r"\b__attribute__\s*\(\((?:[^()]|\([^()]*\))*\)\)", " ", text) # (0.9.0) before the name too
text = re.sub(r"^(?:BTAPP_FN|UH_SEG)[ \t]+", "", text, flags=re.M) # (V10.8.72) the Bluetooth segment's: a macro first
for m in DEF.finditer(text):
i, depth = m.end() - 1, 0
while i < len(text):
depth += {"(": 1, ")": -1}.get(text[i], 0)
i += 1
if depth == 0:
break
rest = re.sub(r"^(__attribute__\s*\(\(.*?\)\)\s*)+", "", text[i:i + 200].lstrip())
if rest.startswith("{"):
names.append(m.group(1))
return names
def size_names():
names = set()
for f in SIZE_FILES:
names.update(definitions((SRC / f).read_text()))
return names
IR_BODY = re.compile(r"^define [^\n]*?@\"?([\w.]+)\"?\((.*?)^\}", re.M | re.S)
IR_REF = re.compile(r"@\"?([\w.]+)\"?")
IR_GLOBAL = re.compile(r"^@\"?([\w.]+)\"? = [^\n]*", re.M)
def isr_reach(ir, with_globals=False):
"""the functions an interrupt can run: ISR_ROOTS and, transitively, every function their bodies call or
name (a pointer taken there counts as called), from the unoptimised IR (before inlining: a superset).
(0.9.0) A global they name counts as its initialiser: a function in a table they read (an engine's hooks:
ENG[].block -> formant_block -> sing_block) is reached too. with_globals: the globals reached as well (the
constant tables the sound reads: tools/build.py's flash layout)"""
body = {m.group(1): m.group(2) for m in IR_BODY.finditer(ir)}
fns = set(body)
for m in IR_GLOBAL.finditer(ir):
body.setdefault(m.group(1), m.group(0))
seen, todo = set(), [r for r in ISR_ROOTS if r in body]
while todo:
f = todo.pop()
if f in seen:
continue
seen.add(f)
todo += [g for g in IR_REF.findall(body[f]) if g in body and g not in seen]
return seen if with_globals else {f for f in seen if f in fns}
def main(src, dst):
ir = Path(src).read_text()
isr = isr_reach(ir)
# Sparse MIDI control dispatch runs per received message, never per rendered sample.
# Keep synthesis, clocks, DMA, note release and ownership queries at -Os.
input_size = {"midi_event", "midi_control", "midi_cc_map", "midi_cc_set", "midi_learned", "midi_route_ch14",
# (V10.6z4) live recording: once a note, a release or a step a held note reaches (seq.c), never a sample
"rec_note_at", "rec_end", "rec_drum", "rec_hold", "rec_len", "rec_repeats", "cin_keep", "dxo_rec_hold",
# .. and what runs once a transport start / stop, a section or song row, a chord or scene key, a
# punch-in press, an automation record (the UI's calls, the ISR's few)
"chord_build_mode", "scene_key", "scn_notes", "seq_start", "seq_stop", "motion_capture", "motion_put",
"motion_djf_set", "sec_apply", "chain_apply", "midi_nrpn",
"perf_press", "perf_switch", "cin_record", "cin_block", "latch_release", "scene_capture",
"srec_finish", "srec_add",
# .. and a track's step (its components, its automation): once a step, a pass
"motion_step", "motion_unlock", "motion_restore", "seq_step",
"arp_pick", "dxp_fire", "pfx_fire", "fg_play", "midi_clock_pulse", "rev_state_clear", "mo_knobs",
"mo_flush_of"}
cold_ui = {"mod_dst_ok", "mod_dst_offer_bt", "mod_dst_name_bt", "gen_value", "gen_cards_bt", "gen_panel_bt",
"song_remove_parts", "song_copy_section",
"proj_unpack_bt", "about_load", "bt_prox_panel", "bt_prox_input",
"fm4_abs", "fm4_lg", "fm4_ms", "fm4_samples", "fm4_rate", "fm4_fall", "fm4_level", "fm4_outlevel", "fm4_convert_bt",
"crash_log_put", "cpu_status", "cpu_put"} # (V10.6z4: a crash's record, the CPU menu)
# (V10.6z5) more code an interrupt reaches but runs once an event, never once a sample: a note's start and end
# (the engines' note_on hooks, the voice's allocation, the words VOICE sings: once a word), MIDI's and USB's
# configuration and messages, the arpeggiator's and the keys' chords, the descriptors (UI text the ENG[] tables
# name), a crash's report, the USB host's descriptor parse. Chosen from a callgrind profile of tests/cpu_vg.c
# (built -O1 -fno-inline: every function's own instructions): together they are < 0.1 % of the audio path's
# instructions there; none is in HOT_FNS or called from RAM code (build.py's RAM code size is unchanged)
event_size = {
"add_note_on", "ain_note_on", "analog_desc", "analog_from_chip", "analog_from_trio",
"analog_note_on", "animal_desc", "animal_init", "animal_note_on", "arp_chord", "arp_chord_off",
"arp_forget", "arp_off", "arp_owner", "arp_silence", "bt_hw_seg", "chord_auto", "chord_pick",
"cin_begin", "cp_order", "crash_code", "delay_zero", "drum_lane", "drum_note_lane", "drum_note_on",
"drum_oct_note", "drum_oct_of", "dx_mute_set", "dxo_hit", "dxo_off", "dxo_on", "dxo_part",
"dxp_choke", "e0_send", "eng_gone", "fg_release", "fg_reset", "fm1_fault_c", "fm6_done",
"fm6_note_on", "formant_desc", "formant_note_on", "glide_from_trk", "glide_set", "glide_sung",
"hex8", "input_desc", "input_off", "input_on", "kb_lat", "kb_map", "key_next", "key_place",
"live_next", "live_swap", "lm_hits", "lm_once", "load_admit", "load_cost_q8", "lofi_desc",
"lofi_note_on", "lv_neutral", "ly_at", "ly_pick", "ly_word", "mc_lost", "midi_channel",
"midi_clock_transport", "midi_expression", "midi_expression_channel", "midi_forget_track",
"midi_local_held", "midi_mapped", "midi_note_event", "midi_note_held", "midi_out_event_at",
"midi_pedal_up", "midi_release", "midi_targets", "midi_track", "midi_val_set", "ml_free_cc",
"ml_map", "mn_get", "mo_key", "mo_plays", "mo_send", "mod_midi", "mono_pick", "mono_play",
"mono_remove", "motion_begin", "motion_desc", "motion_enabled", "motion_set_event", "name_of",
"noise_desc", "noise_note_on", "nrpn_g_ok", "param_desc_of", "param_fit", "params_by_count",
"perf_buf_done", "perf_buf_start", "perf_glt_seg", "perf_glt_step", "perf_hush_end", "perf_key",
"perf_len", "perf_mute", "perf_unhush", "pfx_hush", "pfx_lane_at", "pfx_lane_put", "pfx_rec_ok",
"phase_note_on", "rec_note", "rec_on", "rec_release", "rev_line_clear", "room_zero", "scale_mask",
"scale_snap", "scale_steps", "seq_note_off", "seq_note_on", "seq_release", "seq_unit",
"shed_voice", "shift_step_pass", "sl_enter", "sound_v04", "sp_chain", "srec_stop", "st_micro_set",
"step_lm_any", "step_lmode", "step_rolls", "step_set_chance", "step_set_lmode", "step_set_ratchet",
"str_cpy", "string_desc", "string_note_on", "sy_en_expand", "sy_enter", "sy_es_tok", "sy_gen_word",
"sy_norm", "sy_norm_lang", "sy_phrase_len", "sy_take_entry", "sy_tok", "sy_word", "sy_word_next",
"track_desc", "trk_all_off", "trk_chance", "trk_fade_out", "trk_kit", "trk_note_off", "trk_nvoice",
"trk_trans", "uac_ep4_reset", "uac_rate_set", "uac_stream", "uh_parse_midi", "uh_parse_uac",
"uin_ep_config", "voice_begin", "voice_cap", "voice_off_at", "voice_room", "voice_start_rec",
"wheel_note_on",
# (V10.6z6) SWARM's block (its voices' values, not their samples: ain_swarm), its melody's step, its
# FAR / NEAR values
"sw_prep", "sw_step", "sw_sv",
# (V10.6z6) the keys' velocity: once a strike, a release, a driven sample of a held key (every
# 4.4 ms), a press (V10.7.10: and its wait's bound, a test a tick); the keys' pressure once a block
"vel_map", "vel_driven", "vel_lift", "vel_take", "vel_tick", "vel_note_on",
# .. and to make room for it, more of the same kind: a voice stolen, a SHIFT pass prepared (once a
# pass) and its conditions, a lyric's POS, the PLAYHEADS back in phase, a chord glide's note, USB's
# control transfers, a step's parts
"voice_victim", "shift_prepare_pass", "shift_cond", "sy_seek", "live_heads", "cg_near", "e0_chunk",
"step_parts",
# (V10.6z8) a section's change: the sounds the player changed
"snd_sig", "snd_own",
# (V10.8.71, flash for OTT) a note's start on its track and its voice, a SCENE key's track: once a
# note, never a sample
"trk_note_on", "voice_start", "sc_track",
# .. a FILL applied, a CLAY strike, a track silenced, the punch-ins let go, a FUGUE head's next step,
# the stopped preview's end, a key let go, a punch key pressed: once an event
"fill_apply", "clay_strike", "midi_silence_track", "pfx_end", "fg_next", "preview_end", "key_off",
"pk_press",
# (V10.8.72, flash for DIST's formulas and GEN's OTT) a punch key, the load's half-buffer count, a step's
# held chord, ramp and JAM, LIVE's queue and ghost, a section's anchor, the scene's kit, a FUGUE head,
# a grain born, SWARM's ear: once a key, a half buffer, a step or a block's control, never a sample
"perf_kpress", "load_half", "uac_render_start", "hc_run", "ramp_run", "jam_step", "live_q", "live_adv",
"seq_anchor", "scene_drum_tick", "fugue_tick", "cl_spawn", "sw_heard",
# (V10.8.73, flash for OTT's extreme zone) WEST's and SWARM's note, a JAM's next sequence, CLAY's key, a
# SCENE's follower, an automation's id, the FX's fault, a MIDI message queued, a fitted step's length, a
# step's lanes, the ratchets' next hit: once a note, a message, a step or a fault, never a sample
"west_note_on", "sw_note", "jam_in", "clay_kb", "scene_follow", "motion_param", "fx_trip", "midi_enqueue",
"fit_step_samples", "step_lanes_of", "seq_ratchet", "seq_lane_rat",
# (V10.8.74, flash for FX > GATE's page) a PANIC's notes off, a step's first lock (a RAMP's), SCENE's
# followers let go, a MIDI note-off sent, FM6's note's velocity: once a panic, a step, a stop, a note
"panic_block", "motion_lock_at", "scene_follow_off", "mo_koff", "vel_sound",
# .. and a block's control (none in HOT_FNS, none a sample loop): a track's queued notes due (STRUM,
# HUMAN TIME, the gate's end), the held kit hits' next, LIFE's routes, REVERSE's grains set
"seq_due", "dxo_tick", "life_mod", "dly_rev_set",
# (V10.8.75, flash for MATH USER) MATH's 48 floatbeats (a sample each: the sines a call each instead
# of inlined, half its size; not in HOT_FNS, the lines model reads it the same) and MATH USER's voice cap
# (once a note on such a track)
"lofi_float", "mu_cap",
# .. and more once-an-event ones: a punch-in's SLICER let go, a quiet tail looked for (once a note), a
# fitted span, a punch-in slot, a kit step's hit, a note's VEL and HUMAN, a key's MIDI out
"perf_drop_slicer", "quiet_tail_lv", "fit_span", "perf_slot", "dxp_step", "vel_note", "hum_pm", "tvel",
"mo_kon",
# .. and two once-a-block ones: the kit's sounds (a voice's block), the master's
# TAPE (cpu_lines: every scene as before)
"dx_run_fx", "tape_block",
# .. and two of a block's control: DRONE CLAY's composer, the punch-in lane's step
"clay_tick", "pfx_block",
# .. and a track's COMB filter, the kit's bus (a block each)
"track_comb", "drum_bus"}
names, hit = ((size_names() | cold_ui) - isr) | input_size | event_size, set()
def mark(m):
if m.group(2) not in names:
return m.group(0)
hit.add(m.group(2))
return m.group(1) + " minsize" + m.group(3)
Path(dst).write_text(IR_DEF.sub(mark, ir))
print(f"size: {len(hit)} main-loop functions built for size ({len(names) - len(hit)} not in this build; "
f"{len(size_names() & isr)} reached from an interrupt kept -Os)")
return 0
if __name__ == "__main__":
sys.exit(main(*sys.argv[1:3]))