diff --git a/.github/workflows/voice-user-check.yml b/.github/workflows/voice-user-check.yml index 4b24c6b2..4326aa79 100644 --- a/.github/workflows/voice-user-check.yml +++ b/.github/workflows/voice-user-check.yml @@ -1,4 +1,4 @@ -name: VOICE user lyric candidate +name: Target layout probe (not releasable) on: push: branches: [codex/voice-user-lyrics] @@ -41,6 +41,7 @@ jobs: test -s "$T/uboot.boot" && test -s "$T/cfg_tool.bin" && test -s "$T/cfg/eq_cfg_hw.bin" - name: FM-1 package and target budgets env: + FELUCCA_REPIN: keep AC79_SDK: /home/runner/fw-AC79_AIoT_SDK JIELI_TOOLCHAIN: /home/runner/.jieli/toolchain run: | @@ -52,88 +53,13 @@ jobs: } - name: Firmware memory and reach checks run: tail -n 20 build/song-check/target.log - - name: DRUM performance and multilingual intentional lyric regression - run: | - set -euo pipefail - cc -O1 -g -w -Wno-implicit-function-declaration -fsanitize=address,bounds -Ibuild/gen -Ifirmware/src tests/drum_voice_extensions_test.c -lm -o build/song-check/drum-voice - ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=halt_on_error=1 build/song-check/drum-voice | tee build/song-check/drum-voice.log - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/drumx_oct_test.c -lm -o build/song-check/classic-octaves - build/song-check/classic-octaves | tee build/song-check/classic-octaves.log - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/voice_test.c -lm -o build/song-check/voice-reading - build/song-check/voice-reading | tee build/song-check/voice-reading.log - python3 tests/voice_web_test.py - - name: FIT clock, persistence and audio timing - run: | - set -euo pipefail - mkdir -p build/song-check - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/persistence_test.c -lm -o build/song-check/persistence - build/song-check/persistence | tee build/song-check/persistence.log - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/backup_test.c -lm -o build/song-check/backup - build/song-check/backup > build/song-check/backup.log - cc -O1 -w -Wno-implicit-function-declaration -DSONG_SAVE_ONLY -Ibuild/gen -Ifirmware/src tests/ui_test.c -lm -o build/song-check/ui - build/song-check/ui | tee build/song-check/ui.log - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/project_test.c -lm -o build/song-check/project - build/song-check/project > build/song-check/project.log - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/fit_test.c -lm -o build/song-check/fit - build/song-check/fit | tee build/song-check/fit.log - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/probability_component_test.c -lm -o build/song-check/probability - build/song-check/probability | tee build/song-check/probability.log - cc -O1 -w -Wno-implicit-function-declaration -DTIMING_FIT -Ibuild/gen -Ifirmware/src tests/ctl64_timing_test.c -lm -o build/song-check/fit-timing - build/song-check/fit-timing | tee build/song-check/fit-timing.log - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/ctl64_timing_test.c -lm -o build/song-check/timing - build/song-check/timing > build/song-check/timing.log - python3 tests/uac_input_irq_test.py > build/song-check/usb-input.log - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/midi_control_test.c -lm -o build/song-check/midi - build/song-check/midi | tee build/song-check/midi.log - - name: Generator song progress and whole-song save regression - run: | - set -euo pipefail - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/song_generator_test.c -lm -o build/song-check/generator - build/song-check/generator | tee build/song-check/generator.log - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/song_draft_test.c -lm -o build/song-check/draft - build/song-check/draft | tee build/song-check/draft.log - - name: Matrix and track follower regression - run: | - set -euo pipefail - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/mod_test.c -lm -o build/song-check/mod - build/song-check/mod > build/song-check/mod.log - cc -O1 -g -w -Wno-implicit-function-declaration -fsanitize=address,bounds -Ibuild/gen -Ifirmware/src tests/track_follow_test.c -lm -o build/song-check/follow - ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=halt_on_error=1 build/song-check/follow | tee build/song-check/follow.log - - name: Contextual destinations, legacy routes and editor protocol - run: | - set -euo pipefail - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/matrix_context_test.c -lm -o build/song-check/context - build/song-check/context | tee build/song-check/context.log - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/matrix_editor_test.c -lm -o build/song-check/context-editor - build/song-check/context-editor | tee build/song-check/context-editor.log - python3 tests/matrix_web_test.py - - name: Verified pre-split baseline for UI regression comparison - uses: actions/checkout@v4 - with: - ref: f5f6b1bde3a2eefa14444ad2212626c7aa4d46a8 - path: build/ui-baseline - persist-credentials: false - - name: Full UI comparison against known baseline - run: | - set -euo pipefail - mkdir -p build/ui-baseline-gen - python3 build/ui-baseline/tools/gen_lyrics.py build/ui-baseline-gen/felucca_lyrics.h - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/ui_test.c -lm -o build/song-check/ui-full - cc -O1 -w -Wno-implicit-function-declaration -Ibuild/ui-baseline-gen -Ibuild/gen -Ibuild/ui-baseline/firmware/src build/ui-baseline/tests/ui_test.c -lm -o build/song-check/ui-base - set +e - build/song-check/ui-full > build/song-check/ui-full.log - FULL_RC=$? - build/song-check/ui-base > build/song-check/ui-base.log - BASE_RC=$? - set -e - python3 tests/ui_baseline_compare.py build/song-check/ui-base.log build/song-check/ui-full.log "$BASE_RC" "$FULL_RC" - name: Recorded audio layout if: always() run: cat tools/audio_layout.txt - uses: actions/upload-artifact@v4 if: always() with: - name: voice-user-candidate + name: voice-user-layout-probe path: | build/song-check/*.log build/felucca.fwsc diff --git a/docs/DRUM-VOICE-EXTENSIONS.md b/docs/DRUM-VOICE-EXTENSIONS.md index 274693f0..e5a9bcb4 100644 --- a/docs/DRUM-VOICE-EXTENSIONS.md +++ b/docs/DRUM-VOICE-EXTENSIONS.md @@ -19,7 +19,7 @@ The FX variations do not rewrite the kit or global FX controls. Reverb/delay sti With ARP OFF, fills and sets start/switch on the next track step (DIV, FIT and swing apply). The last pressed key replaces the active performance at that boundary. Older held keys do not restart it when the latest key is released. A pending replacement released before its boundary is cancelled. Mild per-step velocity humanization (−4…+3 in MIDI velocity) varies successive repetitions without moving hit times off the tempo grid. -Recording expands fills/sets into ordinary GM hits and per-lane ratchets, with the humanized step velocity. Chromatic and per-hit FX sounds retain encoded note values. Both step components and master components remain available. GM notes 35–81 are unchanged. In EXTENDED, external MIDI uses 0–12 for kick, 13–26 for tom; FX at 27–34 and 82–85; 27 fills at 86–112; sets at 113–127. In CLASSIC all previous MIDI bands remain unchanged. +During an active fill/set, that track's original sequencer hits are suppressed. Without REC the saved pattern stays intact. With REC each occupied step is replaced by the performance, including its rests: previous notes, lane hits and ratchets do not get overdubbed underneath. Humanized step velocity is recorded. The recorded step remains when the key is released, even early in the step. Both step components, conditions, probability and parameter automation are preserved; the master remains available. Chromatic and per-hit FX sounds retain encoded note values. GM notes 35–81 are unchanged. In EXTENDED, external MIDI uses 0–12 for kick, 13–26 for tom; FX at 27–34 and 82–85; 27 fills at 86–112; sets at 113–127. In CLASSIC all previous MIDI bands remain unchanged. ## VOICE diff --git a/docs/TRACK-GENERATOR-PROPOSAL.md b/docs/TRACK-GENERATOR-PROPOSAL.md new file mode 100644 index 00000000..ec20814c --- /dev/null +++ b/docs/TRACK-GENERATOR-PROPOSAL.md @@ -0,0 +1,18 @@ +# Per-track generator: implementation proposal + +Requested alongside the DRUM/VOICE beta; not implemented in that release. + +There is already reusable per-track generation in `gen.c:dice_seq(track_t *)`, reached by holding SEQ and turning SELECT. It calls `gen_role` for DRUM, BASS, PAD, LEAD, ARP or TEXTURE, uses existing genre/rhythm tables, and leaves the selected engine/preset in place. The user wants explicit controls, not just dice. + +Proposed last SEQ page: **GENERATE**. Four knobs: GENRE, SEED, ROLE (tonal) / FILL (DRUM-X), ENERGY/DENSITY. OCT+ generates the selected track; OCT− restores its previous pattern through the existing dice/undo machinery. Keep HOME's full-song generator and all other tracks untouched. Use the track's current root, scale, length, DIV and FIT. A drum-and-bass rhythm on DRUM-X and a generated bass can accompany manually played lead/chords. + +Required implementation details before release: + +- Reuse pattern routines; never call `gen_make` or `gen_clean`, which rebuild the whole project. +- Isolate generator context. Current `dice_seq` mutates `gs`/`gmut`; the configurable wrapper must restore HOME's context instead of changing its song state. Existing main-loop scratch may hold the saved context if a compile-time size assertion proves it fits. +- Preserve other tracks, the selected sound, mix level, effects, automation, sections and arrangement. Current dice's `dlevel` and implicit length adjustments must not leak into this new operation. +- Keep generation atomic with the existing selected-track load guard; replace a phrase on a musical boundary while playback continues. +- Validate DRUM and tonal controls separately; don't offer meaningless roles to DRUM-X or change a tonal engine into another engine. +- Measure target flash and RAM after the fill changes. Generation adds no per-sample DSP or voices, but a page, controls and context isolation still consume firmware bytes. The previous complete candidate had only eight app bytes free; existing code reuse alone is not proof that a new page fits. Do not borrow loader space, the secondary-core safety reserve, audio buffers or the protected pool reserve. + +Tests should snapshot all nonselected tracks and HOME generator state, generate each role/genre on the selected engine, verify those snapshots are unchanged, exercise live replacement/undo, and save/reload the resulting pattern. Normal target layout/flash/RAM checks are required. diff --git a/firmware/src/seq.c b/firmware/src/seq.c index d63d2c11..2d7ea41a 100644 --- a/firmware/src/seq.c +++ b/firmware/src/seq.c @@ -85,8 +85,10 @@ static uint32_t blk_n = CTL; static void ev_at(uint32_t k) { ev_off = k < blk_n ? k : blk_n; } /* (blk_n: the next block's first) */ /* a note the FM-1 plays (not a key's): sounded, and with ALL sent as it sounds: the punch-ins' OCT- / OCT+ and RANDOM * on it (pfx.c pfx_pit, pfx_rpit: drawn by trk_note_on) */ +static int dxp_overrides(const track_t *t); static void seq_note_on(track_t *t, uint32_t note, uint32_t vel) { + if(dxp_overrides(t)) return; /* held fill owns this track; direct/live notes stay independent */ uint32_t i = trk_index(t) % NTRK, send = mo_lvl == MO_ALL && note < 128u && mo_plays(t, note) && !pfx_holds(t); trk_note_on(t, note, vel); if (send) { @@ -924,6 +926,11 @@ typedef struct { } dxo_t; static dxo_t dxo[NPART][DXO_N]; static uint8_t dxo_n[NPART]; +static int dxp_overrides(const track_t *t) +{ + uint32_t ti=trk_index(t); + return ti=2u&&dxo[ti][0].ph<16u; +} static step_t dxo_bak[NPART]; /* the step a held one was last recorded into, as it was */ static uint8_t dxo_bak_at[NPART]; /* .. which (its source step + 1; 0 none), entered at play idx */ static uint16_t dxo_bak_idx[NPART]; @@ -1041,17 +1048,18 @@ static void dxo_on(track_t *t, uint32_t note, int32_t o, uint32_t vel, uint32_t } static void dxo_off(track_t *t, uint32_t id) { - uint32_t ti = trk_index(t), k, j = 0; + uint32_t ti = trk_index(t), k, j = 0, ext=0; if (ti >= NPART || !dxo_n[ti]) return; for (k = 0; k < dxo_n[ti]; k++) if (dxo[ti][k].id != id) dxo[ti][j++] = dxo[ti][k]; + else ext|=dxo[ti][k].half>=2u; if (j == dxo_n[ti]) return; dxo_n[ti] = (uint8_t)j; if (!j && dxo_bak_at[ti]) { /* let go early in a step it was held into: that step back */ - if (rec_on(t) && dxo_bak_idx[ti] == t->seq_idx && seq_src(t, t->seq_idx) == dxo_bak_at[ti] - 1u && + if (!ext && rec_on(t) && dxo_bak_idx[ti] == t->seq_idx && seq_src(t, t->seq_idx) == dxo_bak_at[ti] - 1u && t->seq_pos < step_samples(t, div_samples((uint32_t)t->p[P_SDIV]), t->seq_idx) / 2u) t->step[dxo_bak_at[ti] - 1u] = dxo_bak[ti]; dxo_bak_at[ti] = 0; @@ -1077,8 +1085,16 @@ static __attribute__((noinline)) void dxo_rec_hold(track_t *t, uint32_t idx) dxo_bak_idx[ti] = (uint16_t)idx; bak = 1; } - if(e->half>=2u) dxp_fire(t,e,e->ph,0,2); - else { + if(e->half>=2u) { + step_t *s=&t->step[src]; + /* Replace this step's musical contents, including rests in a fill. + * Both components, conditions, probability and automation remain. */ + memset(s,0,__builtin_offsetof(step_t,probability));s->time=ST_REST;memset(s->lm,0,sizeof s->lm); + dxp_fire(t,e,e->ph,0,2); + s->comp=dxo_bak[ti].comp;s->carg=dxo_bak[ti].carg; + s->comp2=dxo_bak[ti].comp2;s->carg2=dxo_bak[ti].carg2; + continue; /* hear the live performance once, not its sequencer copy */ + } else { dx_in_rat = e->r; rec_drum(t, &t->step[src], e->note, e->vel, 0); dx_in_rat = 0; diff --git a/tests/drum_voice_extensions_test.c b/tests/drum_voice_extensions_test.c index 5f0f2176..48213ba4 100644 --- a/tests/drum_voice_extensions_test.c +++ b/tests/drum_voice_extensions_test.c @@ -99,17 +99,39 @@ static int extensions(void) bad+=check("EXT external keyboard starts ratchet sets",dxo_n[3]==1&&dxo[3][0].half==3); dxo_off(dt,DXO_MIDI+113); bad+=check("EXT external keyboard releases the performance",!dxo_n[3]); + drum_setup();dt->p[P_DKEYMODE]=1; + for(k=0;k<16;k++) { + dt->step[k]=(step_t){{81},1,ST_NOTE,0,100,1u<step[k],DV_BELL,LM_X8); + } + step_t original[NSTEP];memcpy(original,dt->step,sizeof original); + seq_start();lanes_until(1,step_len(1)/8u);dxo_on(dt,86,0,100,DXO_MIDI+86); + lanes_until(2,step_len(2)/8u);before=vage;seq_note_on(dt,81,100); + ok=dxp_overrides(dt)&&vage==before&&!dxp_overrides(&trk[0]); + dxo_off(dt,DXO_MIDI+86);seq_stop(); + bad+=check("EXT live fill suppresses original sequencer hits without altering its pattern",ok&&!memcmp(original,dt->step,sizeof original)); /* Recording stores the same lane/rate recipe, not virtual control notes. */ - drum_setup();dt->p[P_DKEYMODE]=1;song.rec=1u<<3;seq_start(); + drum_setup();dt->p[P_DKEYMODE]=1; + for(k=0;k<16;k++) { + dt->step[k]=(step_t){{81},1,ST_NOTE,0,100,1u<step[k],DV_BELL,LM_X8); + dt->step[k].comp=dt->step[k].comp2=CO_MAKE(CA_SOUND,CC_ALWAYS); + dt->step[k].carg=2;dt->step[k].carg2=1; + } + song.rec=1u<<3;seq_start(); lanes_until(1,step_len(1)/8u);dxo_on(dt,114,0,100,DXO_MIDI+114); lanes_until(5,step_len(5)/4u);dxo_off(dt,DXO_MIDI+114);seq_stop(); ok=1;n=0; for(k=2;k<5;k++) { const step_t *s=&dt->step[k];n+=s->hit!=0;ok &= s->vel>=96u&&s->vel<=103u; + ok &= !(s->hit&(1u<n&&!step_lmode(s,DV_BELL)&& + s->comp==CO_MAKE(CA_SOUND,CC_ALWAYS)&&s->carg==2&&s->comp2==s->comp&&s->carg2==1; for(j=0;jn;j++) ok &= s->note[j]<86; for(j=0;j<8;j++) ok &= step_lmode(s,j)<=LM_X4; } - bad+=check("EXT held recording writes actual GM lanes and per-lane ratchets",ok&&n>=2); + bad+=check("EXT recording replaces original notes and ratchets, preserving both components",ok&&n>=2); + bad+=check("EXT release keeps the recorded fill; steps outside it remain intact", + !dt->step[5].n&&!(dt->step[5].hit&(1u<step[1].note[0]==81&&dt->step[6].note[0]==81); /* Lane view and lane editing must agree with the renderer for encoded FX. */ step_t *s=&dt->step[7];step_clear(s);s->time=ST_NOTE;s->n=1;s->note[0]=drum_fx_note(10);s->vel=100; ok=step_lanes_of(dt,s)==(1u<