Skip to content

Add alpha mask system for virtual channel gating#13

Open
oisee wants to merge 6 commits intopaator:mainfrom
oisee:feature/alpha-mask
Open

Add alpha mask system for virtual channel gating#13
oisee wants to merge 6 commits intopaator:mainfrom
oisee:feature/alpha-mask

Conversation

@oisee
Copy link

@oisee oisee commented Feb 28, 2026

Summary

  • Add alpha field to the AY instrument system (per-row alpha mask controlling virtual channel mixing)
  • Make alpha the sole gating mechanism for virtual channel mixing in the audio engine
  • Add navigation shortcuts, natural tuning roots, resizable instrument/table panel, and editor UX improvements
  • Update README with alpha mask documentation

Commits

  1. Add alpha field to instrument system (Phase 1)
  2. Add fill column / alpha mask description to README
  3. Add navigation shortcuts, natural tuning roots, editor UX improvements
  4. Make alpha functional in audio engine (Phase 2)
  5. Make alpha the sole gating mechanism for virtual channel mixing
  6. Update README with alpha mask virtual channel gating docs

Test plan

  • Verify alpha column appears in AY instrument editor
  • Test virtual channel mixing responds to alpha values
  • Confirm navigation shortcuts work (channel jump, cursor home/end)
  • Check resizable right panel drag handle works
  • Run pnpm check — no type errors

🤖 Generated with Claude Code

oisee and others added 6 commits February 28, 2026 23:29
Alpha (0-15, default 15) controls per-tick transparency for future fill
column system. Fully backward-compatible — old .btp files default to 15.
Includes UI column in instrument editor and "Add row" button at top.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Documents the intent and current state of the alpha field in the
instrument system, explaining the upcoming fill column feature.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Ctrl+Arrow shortcuts for pattern editor: jump channels (L/R), home/end (U/D)
- Natural tuning tables for all 12 root notes using just intonation ratios
- Duplicate row button in instrument and table editors
- Add new row button at top of instrument and table editors
- Resizable right panel with localStorage persistence
- Persistent Hex mode toggle across browser sessions
- Updated README with changelog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Alpha values from instrument rows now drive virtual channel mixing:
alpha=F is fully opaque, alpha=0 is transparent, and underlying
channels punch through when their alpha exceeds the primary's.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Volume and mixer state no longer control channel priority — only alpha
does. A silent primary with alpha=F blocks underlying channels (opaque
silence), while alpha=0 lets them through regardless of primary volume.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
defaultShortcut: 'Mod+ArrowRight'
},
{
id: ACTION_CURSOR_HOME,
Copy link
Owner

Choose a reason for hiding this comment

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

Image

Cursor to first row and cursor to last row are already covered by Home/End, alongside with cursor to first column/last column. Maybe we can rename existing shortcuts instead to be more descriptive:) Now we would have doubled shortcuts for the same thing.

- **Pattern editing**: Field-based editing system in `src/lib/services/pattern/editing/` with strategies per field type.
- **Path alias**: `@` maps to `./src` (configured in both vite and vitest).

Currently bitphase supports only AY-8910/YM2149F chip, but architecture needs to support other chips in the future. Therefore, it is important to keep the code modular and easy to extend. Using AY specific code in generic parts is not allowed, because when we get to the point of adding another chip, we will have to rewrite a lot of code.
Copy link
Owner

Choose a reason for hiding this comment

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

Why removing this rule for Claude? ^^ is it covered by other new rules perhaps?

<Input class="w-48 text-xs" bind:value={name} />
</div>

<div class="mb-2 ml-2">
Copy link
Owner

Choose a reason for hiding this comment

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

this one thing would need to be fixed - the "loop" showing wrong row and the expanded volume editor being "too high". I believe this error appeared due to addition of the alpha, or "duplicate row"

Image


When multiple virtual channels (e.g. A, A', A'') share one hardware channel, alpha on the **primary** (leftmost) channel acts as a gate:

- **Alpha = F (15)**: Fully opaque — primary channel always wins, even if silent. This is the default, so existing songs are unaffected.
Copy link
Owner

Choose a reason for hiding this comment

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

I have a case of file that worked fine before these changes but now doesn't work properly despite all instruments getting 0xF alpha by default. Gonna send you a dm, because our beloved .btp isn't supported on github 👍

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