Skip to content

Fix: Digitakt II linked voices: VOICES row label and icon, voices keep the lead's sound and machine - #2204

Merged
repeat98 merged 10 commits into
repeat98:base/digitakt-ii-nextfrom
Claptom-music:base/dt2-voices-fixes
Dec 3, 2026
Merged

repeat98 merged 10 commits into
repeat98:base/digitakt-ii-nextfrom
Claptom-music:base/dt2-voices-fixes

Conversation

@Claptom-music

@Claptom-music Claptom-music commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What was wrong or hard

The release checks of base 948be0c4 (image 27dfadf8, in #1999) found two linked-voices bugs and asked for an icon on the VOICES row:

  • SETTINGS > VOICES read T9 VOICES on every track. SETTINGS builds its rows once, so the label kept the track that was on then.
  • Lowering VOICES while playing, the first note after the change sounded wrong (a plain kick on a Morpha lead). Two causes: a former voice's fading note was handed to its own machine's player (SAMPLE played the lead's sample slot), and its note-off, which still names the lead, went to the lead.

A first fix (f702c908, test image e0244b16) cleared each leaving voice's loaded-sound pointer. On the unit that caused a new bug, the synth randomly playing unedited: after VOICES 3, 1, 3 a key note on a voice loaded the voice's own sound with the lead's machine. The emulator reproduced it, and this PR fixes it at the root.

What this changes

sdk/machines/digitakt-ii/elekloader/modwerk/voices.c, voices-entry.s (base only, no module):

  • The VOICES row is core's value row (core_addrow) with its own draw: a 9x9 icon in the stock icons' place, the count right-aligned at x + 19 as before, and a label rewritten each time the menu asks for it (core_voice_row_label, then core's core_value_label).
  • A note-on moved to a voice track that names no sound (keys, MIDI) now names the lead's kit sound (+0x3c), so stock loads the lead's sound there whenever the voice last loaded another, never the voice's own.
  • A track that leaves a group stays its lead's former voice until it plays a note of its own. It keeps the lead's machine (core_voice_lead), takes note-offs naming the lead for a note it still holds, and its own note-on clears its pointer at 0x8000470c, so that note loads its own sound.
  • lead_of starts as none (it read as "track 1's voice" before the first project load).
  • While regroup runs, core_voice_event routes nothing (a regrouping flag set at its start and cleared after leads = found), so a lead's note in that moment plays where stock sends it instead of going to track 16 (review of 26 and 30 November).
  • The lead's track level (LEVEL, the mixer) is the group's: each frame the voices' levels (0x80003340 + 2 t, the level the sound chip gets) are set to the lead's, and a track leaving the group gets its own back from the kit ([0x80004704] + 0x14 + 2 t). Added after the tester asked for the lead's mixer volume to lower its voices.

Base 632bf110 (.run 16,944, .bss 12,652, 47 sites; 2ead25d6 before the shared level). base-binding.json still names 948be0c4: the binding, package and pin are a release step for the owner, as for #2138.

Records: VOICES.md (design, the release checks, both fix rounds), docs/verification/2026-11-24-digitakt-ii-linked-voices-base.md (the release-check table for 948be0c4), changelog/2026-11-25-digitakt-ii-voices-fixes.md.

How I checked it

On a unit: Claptom-music tested image b6ee842b (this base 2ead25d6 + the Morpha package of 27dfadf8) on a Digitakt II, OS 1.17, over USB. Covered: the icon and label on several tracks, the kick when lowering VOICES while playing, edits kept after VOICES 3, 1, 3, a held chord when VOICES drops, and a former voice played on its own. They reported it ready for review, with no case failing. The first round (e0244b16) is recorded in VOICES.md.

The review's unit cases (reported by the tester, 1 December 2026, image d3372d20, SHA-256 d3372d2028941687702804defef5f220253d656c90c6eb4200dd7ce7c73ebdcb: this code with #2477's chord recording and Morpha): a kit reload while linked then a chord from the keys, a sound lock on the lead's trig then a chord, MIDI chords, and Load Project into a project with every track at 1 (the former voices' first notes are their own sounds): all pass. VOICES.md now lists every tested base and image by its full SHA-256.

The shared level, on a unit (reported by the tester, image 094b8a09: this branch with #2138 and Morpha, and again on 2b4850e1): the chord follows the lead's LEVEL and mixer volume, and tracks 2 and 3 return to their own levels at VOICES 1. Emulator: VOICES 3 with track 1's LEVEL at 0, a three-key chord is silent, where the build without it still played tracks 2 and 3; the same chord with LEVEL untouched plays both voices.

Emulator (ColdFire panel probe and coupled ColdFire and sound-chip runs, same Morpha package):

Case Why this change makes it a risk How run Result
Every track at 1 The note entry and frame run for every note Coupled, same script on 27dfadf8 and b6ee842b First note identical sample for sample; the level identical in every 50 ms window. The second key lands a few ms apart, so the mix after it is not compared sample for sample
Label on tracks 1, 5, 16, 5, 1, 9, 6 Label rewritten from the active track Panel probe Follows the track; T5 keeps its count 3
Icon placement Own draw in a stock menu Panel probe, pixels x 42-50, rows 53-61 like the stock icons; the count's digit from x 58
VOICES 3, 1, 3, then a chord Which sound a voice loads Panel probe, targets and 0x8000470c e0244b16: track 2 loaded its own sound. This base: the lead's values and pointer
Chord held while VOICES drops to 1 Note-offs of former voices Panel probe 0x47db4310; coupled with Morpha 27dfadf8: tracks 2 and 3 stay held, the voice stops abruptly. This base: all notes end; both fade with the lead's release
A former voice played on its own Its own sound comes back Panel probe It loads its own sound
Kick pattern while VOICES drops The reported case Unit Reported fixed. Not replayable in the emulator, whose sequencer stops after step 1
Muted lead from the keys, MIDI chords, two machine modules Open from the release checks Not run here Open, as recorded in VOICES.md

sdk/tests/test_machine_base.py passes (25). The branch is merged with the current base/digitakt-ii-next (0befcd0fe; it differs from it only in the five files above). npm run check -- --base upstream/base/digitakt-ii-next: every stage passed except test, whose failures were time-outs on this computer (the checkout sits on a Windows drive under WSL). Rerun alone with --testTimeout=300000, module-guides.test.ts and octatrack-emulator/session.test.mjs pass. Two module-doctor.test.mjs cases still fail: the doctor they start takes 30-41 s here against the test's own 30 s limit, so it is cut off with no output. They failed the same way before these changes, and no module is changed here. CI reruns them.

What the guides lacked: the stock "load a sound only when it changed" rule (0x8000470c) and that fw_fillrect counts a menu row's lines upward were undocumented. Both are now in VOICES.md.

The release-check results for #1999's test table are in docs/verification/2026-11-24-digitakt-ii-linked-voices-base.md.

… track that leaves a group

- SETTINGS > VOICES: the label is rewritten each time the menu asks for it (SETTINGS builds its rows once, so it kept
  the track that was on then), and the row draws an icon in the stock icons' place with the count beside it.
- Lowering VOICES while notes ring: a former voice's note-off, which still names the lead, goes to the track that
  holds the note (it ended the lead's note of the same pitch instead, and the voice's note rang on), with the lead's
  machine until the note ends; the track's loaded-sound pointer is cleared so its next note loads its own sound.
- VOICES.md and the 948be0c4 verification record: the release checks on 27dfadf8 and the emulator checks of this base.
…ices keep its machine until their own note; icon eyes
@repeat98

Copy link
Copy Markdown
Owner

Thanks, that's a good root-cause fix. Naming the lead's sound in the note-on (+0x3c) instead of clearing pointers explains the "synth plays unedited" report, and the former-voice routing covers the kick on the first hit. It's on the right branch, and the unit run of b6ee842b covers the cases that were reported.

Before it goes into base/digitakt-ii-next:

  1. Routing while regroup runs. Its comment says nothing is routed while the groups change, but with formers set core_voice_event now carries on while leads is 0 and lead_of is half rebuilt. A lead's note in that window reaches the lead_of[lead] != NONE branch and goes to track 16, so it is dropped. That's a short window, but the sequencer runs during it while someone turns VOICES. Please make core_voice_event return while regroup runs, for example with a flag set at its start and cleared after leads = found.
  2. The full SHA-256 of what was tested. VOICES.md names base 2ead25d6 and image b6ee842b only by their short form. Please give both in full, the way base-binding.json gives 948be0c4's identity.
  3. Unit cases this diff touches that the run didn't cover. The new note-on path is there because stock forgets the loaded sound after a kit change or a sound lock, and it handles MIDI notes too. Please add from your unit, on this image:
    • a kit load (or reload) while linked, then a chord from the keys;
    • a sound lock on a lead's trig, then a chord from the keys;
    • MIDI chords (still open from 27dfadf8; the recording you mentioned would settle it);
    • Load Project into a project with different VOICES settings. regroup takes the former voices from the previous project's groups (was[]), so check that those tracks play their own sound on their first note.
  4. Improvement: Digitakt II base: chords recorded across linked voices #2138. This conflicts with Improvement: Digitakt II base: chords recorded across linked voices #2138 in voices.c and VOICES.md, and the two find the kit's track sounds differently: here [0x80004704] + 0x34, there the fixed KIT_SOUNDS 0x426532ec. Once this one is in, please merge it into Improvement: Digitakt II base: chords recorded across linked voices #2138 (don't rebase) and use one of the two. Since a voice now loads the lead's sound note by note, does Improvement: Digitakt II base: chords recorded across linked voices #2138 still need to overwrite the voice tracks' kit sounds? That was my main question there.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the unit note on the shared level and for the changelog entry. It's good to hear the chord follows the lead's LEVEL and mixer volume on a real unit.

The four points from the review on 26 November are still open on this head (0befcd0f), so here they are again:

  1. Routing while the groups change. core_voice_event still keeps going while regroup has leads at 0 and lead_of half rebuilt (whenever formers is set), so a lead's note in that moment can go to track 16 and be lost. Please make it return while regroup runs, for example with a flag set at the start of regroup and cleared after leads = found.
  2. Full SHA-256s of the tested base and image in VOICES.md, the way base-binding.json gives 948be0c4.
  3. Unit cases on the image you test, added to the table:
    • a kit load or reload while linked, then a chord from the keys;
    • a sound lock on a lead's trig, then a chord from the keys;
    • MIDI chords (still open: the recording would settle it);
    • Load Project into a project with different VOICES settings, checking that the former voices play their own sound on their first note.
  4. #2138. Once this one is in, merge it into #2138 (merge, don't rebase) and use one way to find the kit's track sounds. Does #2138 still need to overwrite the voice tracks' kit sounds now that a voice loads the lead's sound note by note?

Pull requests into base/digitakt-ii-next get only the description check in CI, so please run npm run pr:ready on the new head and paste the result. Once these are in, I'll review it for the base.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this settles the review:

  1. Routing while the groups change: regrouping now stops core_voice_event from the start of regroup until leads = found. Former voices are covered too.
  2. Full hashes: VOICES.md now lists every tested base and image by its full SHA-256.
  3. Unit cases: a kit reload, a sound lock, MIDI chords, and Load Project into a project with every track at 1 all passed on d3372d20.
  4. #2138: it merged into base/digitakt-ii-next on 26 November, so that point no longer applies.

One small thing for later, which doesn't block this: lead_of and former_of are written between two volatile stores, and nothing in the language stops the compiler moving the plain lead_of stores past regrouping = 0. A compiler barrier (__asm__ volatile("" ::: "memory")) before clearing the flag would make the order certain.

This now waits for the owner's approval to go into the Digitakt II base.

@repeat98
repeat98 merged commit eb9b7ab into repeat98:base/digitakt-ii-next Dec 3, 2026
2 of 3 checks passed
repeat98 pushed a commit that referenced this pull request Dec 3, 2026
…ecording, restored sounds

The base of this branch (base/digitakt-ii-next with chord recording brought back, #2204 and the restore of a voice
track's own sound), recorded by machine:base --write with the reviewed toolchain (18,852 bytes .run, 30,732 bytes
.bss, 48 sites) and vendored for step 2's pin. It is byte for byte the base of the unit-tested images b8cff950 and
2b4850e1. The machine page's core image size follows; the verification record names the build and its checks.
repeat98 added a commit that referenced this pull request Dec 3, 2026
…again

Digitakt II base: chord recording back, voices' own sounds restored, with #2204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants