From 80ea20fd75f0b49c66f8f07f4166a8887aa04cc6 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 14:45:40 +0000 Subject: [PATCH] CLOUD crackle fix (from sloop-study 535a17e) folded in: its DC state in fx (no new global); more event code for size (LIVE, the words, step parts): 76 B free --- firmware/src/fx.c | 8 ++++---- tools/size_fns.py | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/firmware/src/fx.c b/firmware/src/fx.c index 5a4dc81a..5bd81b32 100644 --- a/firmware/src/fx.c +++ b/firmware/src/fx.c @@ -69,6 +69,7 @@ static struct { uint8_t rs_root; /* .. the note FOLW last heard + 1 (0: none yet) */ uint16_t rs_w; /* .. their write index (each its own line, 1024) */ uint32_t cl_w, cl_rng; /* .. CLOUD: its line's write count (half rate), its random numbers */ + int32_t cl_dc; /* .. (0.9.14) its loop's DC (Q8 samples) */ int32_t cl_next, cl_lp, cl_half, cl_gl, cl_gr; /* .. the samples to the next grain, the output's low-pass, the odd sample */ uint16_t sp_w; /* SPRING: the loop's write index (SP_MASK) */ uint8_t sp_ns; /* (0.6.70) SPRING's allpass stages last block (SP_N, LOAD ECO SP_N_ECO) */ @@ -1012,7 +1013,6 @@ static __attribute__((noinline)) void rev_reso(const int32_t *rev_in, int32_t *o #define CL_WMAX 512 /* (0.9.14) the grains' windows summed: 2 grains' worth at most */ #define CL_BACK (CL_LEN - 6000u - 1024u) /* .. the farthest back a grain may start (rev_cloud) */ static struct { uint32_t pos, inc; uint16_t len, age; int16_t pl, pr; } cl_g[CL_N]; -static int32_t cl_dc; /* (0.9.14) CLOUD's loop: its DC (Q8 samples) */ static uint32_t cl_rand(void) { fx.cl_rng = fx.cl_rng * 1664525u + 1013904223u; return fx.cl_rng >> 8; } /* CLOUD (G_RTYPE 4, JIANT 0.5, made wet in 0.5.1): a granular wash. The input and the cloud's own tail fed back * (SIZE: the tail ~0.09, the grains ~0.43: the wash builds on itself) are written at half rate into a 0.74 s line; @@ -1037,8 +1037,8 @@ static __attribute__((noinline)) void rev_cloud(const int32_t *rev_in, int32_t * int32_t l = 0, r = 0, m; if (!freeze) { /* the line: the input and the tail, two samples into one */ int32_t x = (rev_in[i] >> 1) + mulq15(shim_fb[i], fb) + mulq15(fx.cl_lp, fg); - cl_dc += ((x << 8) - cl_dc) >> 9; /* (0.9.14) a low cut (~14 Hz, Q8) in the loop: ROOM's floors */ - x -= (cl_dc + 128) >> 8; /* gave it a DC that went round for ever (RMS ~1700 at SIZE 126) */ + fx.cl_dc += ((x << 8) - fx.cl_dc) >> 9; /* (0.9.14) a low cut (~14 Hz, Q8) in the loop: ROOM's floors */ + x -= (fx.cl_dc + 128) >> 8; /* gave it a DC that went round for ever (RMS ~1700 at SIZE 126) */ if (fx.cl_w & 1u) cloud_buf[(fx.cl_w >> 1) & (CL_LEN - 1u)] = (int16_t)rv_knee((fx.cl_half + x) >> 1); else @@ -1155,7 +1155,7 @@ static void rev_state_clear(void) for (i = 0; i < CL_N; i++) cl_g[i].len = 0; fx.cl_gl = fx.cl_gr = 0; - cl_dc = 0; + fx.cl_dc = 0; fx.cl_lp = fx.cl_half = 0; /* (0.8.4: CLOUD's tone and odd sample too; its tone's state * was kept, a residue back into the next CLOUD's line) */ } diff --git a/tools/size_fns.py b/tools/size_fns.py index d79f938a..3d02cf4c 100644 --- a/tools/size_fns.py +++ b/tools/size_fns.py @@ -39,8 +39,9 @@ SIZE_FILES = ["ui.c", "favorites.c", "menu_items.c", "cpu_safe.c", "icons.c", "u EVENT_PFX = ("ep0_", "e0_", "ep1_", "ep3_", "sysex_", "midi_", "um_", "uart_midi_", "ml_", "mn_", "mo_", "seq_step", "seq_start", "seq_stop", "seq_note", "seq_release", "seq_ratchet", "arp_", "chord_", "cp_", "rec_", "motion_", "cin_", "latch_", "key_", "kb_", "keys_", "fm6_note_on", "drum_note_on", "dxo_on", "dxo_off", - "dxo_rec_hold", "pfx_fire", "seq_lane_rat", "sy_word", "sy_gen_word", "sy_enter") -EVENT_KEEP = {"mo_block", "key_latch", "midi_clock_advance", "cin_block", "kb_lat"} + "dxo_rec_hold", "pfx_fire", "seq_lane_rat", "sy_word", "sy_gen_word", "sy_enter", "live_", + "mod_key", "mod_note", "sing_note", "ly_", "step_parts", "step_rolls", "tie_span", "every_on", "scale_snap") +EVENT_KEEP = {"mo_block", "key_latch", "midi_clock_advance", "cin_block", "kb_lat", "live_q", "live_adv"} ISR_ROOTS = ("fm1_alnk0_irq", "fm1_timer5_irq", # hal/fm1_isr.S: the audio ISR, the key / LED scan (+ USB poll), "fm1_timer5_top") # (0.9.14) the scan's body, timed DEF = re.compile(r"^(?:static|void|int|uint\w*|int\w*|const)\b[^;=(]*?\b([A-Za-z_]\w*)\s*\(", re.M)