Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
description: "Task list for the adaptive snap grid (arrangement + piano roll, with triplets)"
Tasks: Adaptive Snap Grid
Input: Design documents from specs/003-adaptive-snap-grid/
Prerequisites: plan.md, spec.md, research.md, data-model.md, contracts/grid-ui.md, quickstart.md
Tests: Included. The plan and quickstart §1 call for a pure-logic smoke-test section
(SnapGridTests, --grid). Write each test task before its implementation and see it
fail first.
Organization: By user story (spec.md): US1 snap follows zoom (P1), US2 menu and shortcuts (P2), US3 triplets (P3).
Format: [ID] [P?] [Story] Description
- [P]: Can run in parallel (different files, no dependencies on incomplete tasks)
- [Story]: US1, US2 or US3
Path Conventions
- Rule (pure):
src/managed/Nota.Application/Editing/ - App and views:
src/managed/Nota.App/ - Tests:
tests/Nota.SmokeTest/ - Every new
.csfile starts with the two-line SPDX header from CONTRIBUTING.md and a short comment header explaining why the file exists (matchTapTempo.cs).
Phase 1: Setup (Shared Infrastructure)
Purpose: The empty test section and its runner flag, so later tasks can add cases.
- T001 Create
tests/Nota.SmokeTest/SnapGridTests.cswithinternal static class SnapGridTests { public static IEnumerable<(bool Ok, string Label)> Run() { yield break; } }, following theTapTempoTests.cspattern (header comment,using Nota.Application.Editing;) - T002 Wire the section into
tests/Nota.SmokeTest/Program.cs: a--gridearly-exit block printingGRID PASSED/GRID FAILED (n)next to the--tapblock (around line 210), andConsole.WriteLine("-- snap grid --"); foreach (...) Check(ok, label);in the full run after the tap-tempo section (around line 14514)
Phase 2: Foundational (Blocking Prerequisites)
Purpose: The rule, its persistence and the live state. Every story builds on them.
⚠️ CRITICAL: No user story work can begin until this phase is complete.
Tests (write first, see them fail)
- T003 Add the foundational cases to
tests/Nota.SmokeTest/SnapGridTests.cs:GridStep(Index 0..7)beats in 4/4 = 0.125, 0.25, 0.5, 1, 2, 4, 8, 16, and in 3/4 the bar steps are 3, 6, 12;Indexis clamped to 0..7;- labels "1/32" … "1/2", "1 bar", "2 bars", "4 bars";
- default
GridSettingresolves to 1/4 at 28 px per beat in 4/4 (FR-003); - at a fixed zoom, Narrow < Medium < Wide (strictly finer to coarser);
- clamps to 1/32 at 240 px per beat (Narrow) and to 4 bars at 0.5 px per beat (Wide);
SnapBeatreturns the nearest position and is never negative;- for many zoom and step combinations, every
GridLinesposition snaps to itself and everySnapBeatresult is inGridLines(SC-001); Labelgives "Auto · 1/4" for Adaptive and "1/8" for Fixed 1/8.
Implementation
- T004 Create
src/managed/Nota.Application/Editing/SnapGrid.cswith the value types from data-model.md:GridStepwithIndex(int, "clamped to 0..7") andTriplet(bool, "forced false whenIndex ≥ 5"),Beats(int beatsPerBar)andLabel;enum GridDensity { Narrow, Medium, Wide }with thresholds 8, 16 and 32 px (research R2);GridSettingas a record withAdaptive= true,Density= Medium,FixedIndex,Triplets= false,SnapOn= true, and staticDefaultArrangement(FixedIndex3) andDefaultPianoRoll(FixedIndex1);ResolvedGrid(Snap,Draw,FinerThanVisible,SnapOn).
- T005 In
src/managed/Nota.Application/Editing/SnapGrid.cs, implementstatic ResolvedGrid Resolve(GridSetting s, double pixelsPerBeat, int beatsPerBar):- Adaptive: the smallest Index in the setting's triplet family with
Beats × ppb ≥ threshold(Density), clamped, andDraw = Snap; - Fixed:
Snap = (FixedIndex, Triplets), andDrawis the smallestIndex ≥ FixedIndexmeeting the Medium threshold (16 px), clamped to 7; FinerThanVisible = Draw.Index > Snap.Index.- Allocation-free; the zero and negative ppb guard returns 1/4.
- Adaptive: the smallest Index in the setting's triplet family with
- T006 In
src/managed/Nota.Application/Editing/SnapGrid.cs, implementstatic double SnapBeat(double beat, double stepBeats, int beatsPerBar)andstatic IEnumerable<double> GridLines(double from, double to, double stepBeats, int beatsPerBar)on one shared position rule, anchored per bar (research R4):- sub-bar steps:
barStart + n·stepfor every n withn·step < barLength − 1e-6, plus the next bar start; - bar steps: multiples of
k·beatsPerBarfrom beat 0; - results clamped at 0.
- sub-bar steps:
- T007 In
src/managed/Nota.Application/Editing/SnapGrid.cs, implementstatic string Label(GridSetting s, ResolvedGrid r): "Auto · " +r.Snap.Labelwhen Adaptive, elser.Snap.Label. - T008 [P] Add
public GridSetting ArrangementGrid { get; set; } = GridSetting.DefaultArrangement;,public GridSetting PianoRollGrid { get; set; } = GridSetting.DefaultPianoRoll;andpublic GridStep QuantizeStep { get; set; } = new(1, false);tosrc/managed/Nota.Application/Settings.cs, with doc comments ("app-wide, never written to project files", FR-017). Make the types JSON-friendly (public get/set or init, parameterless construction) forSystem.Text.JsoninSettingsService. - T009 Add settings cases to
tests/Nota.SmokeTest/SnapGridTests.cs:- deserializing
{}intoSettingsgives the FR-016 defaults; - a serialize, change and deserialize round trip keeps
ArrangementGrid,PianoRollGridandQuantizeStepindependent; - an out-of-range
FixedIndex(for example 42) is clamped on resolve.
- deserializing
- T010 Create
src/managed/Nota.App/EditorGrids.cs(research R8):enum EditorKind { Arrangement, PianoRoll };sealed class EditorGrids(ISettingsService settings)exposingGet(EditorKind),Set(EditorKind, GridSetting),Quantize,SetQuantize(GridStep)andevent Action<EditorKind>? Changed;- it loads from
settings.Currentand saves viasettings.Save()on each change; a no-op when the value is unchanged.
- T011 Create the
EditorGridsinstance insrc/managed/Nota.App/MainWindow.axaml.cs, next to where_vmand services are set up, fromApp.Services.GetRequiredService<ISettingsService>(). Expose it asinternal EditorGrids GridssoDetailWindowand the detail builders can reach it.
Checkpoint: dotnet run --project tests/Nota.SmokeTest -- --grid prints GRID PASSED.
Phase 3: User Story 1 - Snap follows the zoom (Priority: P1) 🎯 MVP
Goal: In both editors the step to snap to equals the finest drawn line, chosen from the zoom, with Adaptive · Medium as the default. The snap controls show the step in effect.
Independent Test: With default settings, zoom each editor in and out and drag a clip or note. It lands only on drawn lines, and the control reads "Auto · " and changes with zoom (quickstart §3 rows 1–3, 11).
Arrangement
- T012 [US1] In
src/managed/Nota.App/ArrangementView.cs:- replace
_snapBeatsand_snapEnabled(lines 41–42) and theSnapBeats/SnapEnabledproperties (lines 432 and 437) with a requiredEditorGrids Grids(init or constructor), a cachedResolvedGrid _gridandinternal ResolvedGrid Grid => _grid; - recompute
_gridin aRefreshGrid()that runs on zoom changes (both_pixelsPerBeatwrites around lines 646 and 655, plusArrangementView.Overview.cs:95), onBeatsPerBarset (line 430) and onGrids.Changed(Arrangement); - raise
event Action? GridChangedonly when_gridactually changes.
- replace
- T013 [US1] In
src/managed/Nota.App/ArrangementView.cs, changeSnap(double)(line 1051) to_grid.SnapOn ? SnapGrid.SnapBeat(beat, _grid.Snap.Beats(_beatsPerBar), _beatsPerBar) : beat. KeepSnapMaybe(Alt bypass) andSnapMagnetic(magnet) as they are. Replace the two_snapBeatsuses in the loop range (lines 561 and 588) with the resolved step's beats. - T014 [P] [US1] In
src/managed/Nota.App/ArrangementView.LaneControl.cs(vertical grid around lines 1275–1285), draw lines fromSnapGrid.GridLines(viewStart, viewEnd, _o.Grid.Draw.Beats(_o._beatsPerBar), _o._beatsPerBar):BarPenon bar starts,BeatPenon whole beats, and a new sub-beat pen (NotaPalette.GridSubBeat, as inPianoRollView) otherwise. Remove theshowBeatsthreshold. - T015 [P] [US1] The same grid-line change in
src/managed/Nota.App/ArrangementView.Controls.cs(footer grid around lines 189–200). - T016 [US1] In
src/managed/Nota.App/MainWindow.axaml.cs:- delete
SnapSteps,_snapIndex(lines 570–574) andOnCycleSnap(line 656); - pass
GridstoTimeline; - bind
SnapToggleboth ways toGrids.Get(Arrangement).SnapOn(rewriteOnToggleSnapEnabledat line 721 toGrids.Set(... with { SnapOn = on }), and updateSnapToggle.IsCheckedonGrids.Changed).
- delete
Snap chip (label only in this story)
- T017 [US1] Create
src/managed/Nota.App/SnapChip.cs, a control taking(EditorKind kind, EditorGrids grids, Func<ResolvedGrid> current):- renders
SnapGrid.Labelin the Mono style of today'sSnapLabel(MainWindow.axaml:240), with the tooltip from contracts/grid-ui.md; - exposes
Refresh(), called onGrids.Changed(kind)and on the editor'sGridChanged; - fixes its width to the widest label ("Auto · 1/16T") so the toolbar does not jitter (plan Risks). The menu comes in US2.
- renders
- T018 [US1] In
src/managed/Nota.App/MainWindow.axaml(lines 238–240), replace theSnapChipbutton'sClick="OnCycleSnap"cell content with theSnapChipcontrol, keeping the cell classes. Check thatMainWindow.TransportFit.csstill hides and shows the cell correctly with the wider label.
Piano roll
- T019 [US1] In
src/managed/Nota.App/PianoRollView.cs:- remove
_grid(line 72), theGridproperty (line 348),GridLadderandGridStepBeats()(lines 761–770); - add a required
EditorGrids Grids, aBeatsPerBarproperty (default 4), a cachedResolvedGrid _resolvedwithinternal ResolvedGrid ResolvedGridState, andGridChanged; - recompute
_resolvedon every_pixelsPerBeatwrite (lines 146, 166 and 367), onBeatsPerBarset and onGrids.Changed(PianoRoll).
- remove
- T020 [US1] In
src/managed/Nota.App/PianoRollView.cs, switch every snap use from_gridto the resolved snap step throughSnapGrid.SnapBeat(honouringSnapOnand the existing Alt handling):NoteGrid.Snap(line 950);- new-note start and length (line 1120, length = one step);
- the duplicate shift and caps (lines 427–428, 1184, 1203, 1215);
- the paste anchor (line 646);
- note length minimum (line 654);
- ← → nudges (lines 1373–1374).
- T021 [US1] In
src/managed/Nota.App/PianoRollView.cs:- the note-grid line loop (around line 976) iterates
SnapGrid.GridLines(..., _resolved.Draw.Beats(BeatsPerBar), BeatsPerBar); GridPen(b)andGridLabel(b)(lines 783–799) useBeatsPerBarinstead of the literal 4 (research R5);LabelStepBeats()stays.
- the note-grid line loop (around line 976) iterates
- T022 [P] [US1] In
src/managed/Nota.App/PianoRollView.Expression.cs(line 251), replace_o.GridStepBeats()with the resolved draw step and iterateSnapGrid.GridLines. - T023 [US1] In
src/managed/Nota.App/PianoRollView.cs, changeQuantize(strength)(line 592) to useGrids.Quantize.Beats(BeatsPerBar)(FR-008a). Insrc/managed/Nota.App/MidiToolsView.cs(line 170), setGrid = _roll.Grids.Quantize.Beats(_roll.BeatsPerBar)(research R11). - T024 [US1] In
src/managed/Nota.App/ClipPropsView.cs(lines 20–65):- rename the GRID section to QUANTIZE;
- replace
GridValues,GridLabelsand_gridIndexwith the straight sub-bar steps 1/32 … 1/2 (Index0..4, "Bar steps are not offered for Quantize"); - the dropdown calls
grids.SetQuantize(...)and showsgrids.Quantize.Label; default 1/16 comes from Settings; - the Quantize button and STRENGTH slider are unchanged. Triplet values are added in US3.
- T025 [US1] In
src/managed/Nota.App/MainWindow.Detail.cs, at bothnew PianoRollViewsites (lines 394 and 595), passGrids = GridsandBeatsPerBar = Timeline.BeatsPerBar(or the transport's numerator), and keepBeatsPerBarin sync when the time signature changes (whereTimeline.BeatsPerBaris updated today). PassGridstoClipPropsViewviasrc/managed/Nota.App/ClipEditorView.cs(line 48). - T026 [US1] In
src/managed/Nota.App/ClipEditorView.cs, add aSnapChip(EditorKind.PianoRoll, roll.Grids, () => roll.ResolvedGridState)to the header's right group, beforeScaleControls()(line 61), with aHeaderDivider()between them. - T027 [US1] Build and fix every remaining reference to the removed members:
dotnet build src/managed/Nota.App/Nota.App.csproj. Check withgrep -rn "SnapBeats\|SnapEnabled\|GridStepBeats\|_roll.Grid\b\|\._grid\b" src/managed(expect none).
Checkpoint: US1 works on its own: the default is Auto, lines and snapping agree in both editors, the chips show the live step, and ⌥ and the magnet still work.
Phase 4: User Story 2 - Pick a grid quickly from a menu or the keyboard (Priority: P2)
Goal: The chip opens a menu with every option; ⌘1, ⌘2, ⌘4 and ⌘5 drive the grid from the keyboard; and Fixed mode marks a step that is finer than the drawn lines.
Independent Test: Quickstart §3 rows 4, 5, 8, 9 and 10, plus the palette checks in
scripts/build.sh.
Tests (write first)
- T028 [P] [US2] Add transition cases to
tests/Nota.SmokeTest/SnapGridTests.csper the data-model.md transitions table:NarrowerandWiderin Fixed mode stepFixedIndexand stop at 0 and 7;- in Adaptive mode they step the density and stop at Narrow and Wide;
ToggleAdaptivetwice restores both the density and the fixed step;ToggleSnapflips onlySnapOn;PickAdaptiveandPickFixedsetSnapOn = true;- Fixed 1/32 at 4 px per beat gives
FinerThanVisibletrue with a coarserDraw; at 240 px per beat it is false (FR-005a).
Implementation
- T029 [US2] In
src/managed/Nota.Application/Editing/SnapGrid.cs, add pure transitions returning a newGridSetting:Narrower,Wider,ToggleSnap,ToggleAdaptive,PickAdaptive(GridDensity)andPickFixed(int index). The exact rules are in the data-model.md table. "The shortcuts other than ⌘4 leaveSnapOnas it is." - T030 [US2] In
src/managed/Nota.App/SnapChip.cs:- add the click menu from contracts/grid-ui.md (Auto · Narrow/Medium/Wide, separator, the 8 fixed steps, separator, Snap to grid ⌘4), with a check mark on the active row; build it with the app's existing menu helpers (the
ShowMenustyle used byClipPropsView); - add the label states: dimmed secondary colour plus the "finer than the visible grid" tooltip when
FinerThanVisible, and struck through in the disabled colour when!SnapOn; - follow
DESIGN.mdEmber tokens (nota-design skill).
- add the click menu from contracts/grid-ui.md (Auto · Narrow/Medium/Wide, separator, the 8 fixed steps, separator, Snap to grid ⌘4), with a check mark on the active row; build it with the app's existing menu helpers (the
- T031 [US2] In
src/managed/Nota.Application/Palette/CommandCatalog.cs, add a// ---- Gridblock withgrid.narrower"Narrow Grid" ⌘1,grid.wider"Widen Grid" ⌘2,grid.snap"Toggle Snap to Grid" ⌘4 andgrid.adaptive"Toggle Adaptive Grid" ⌘5, with aliases from contracts/grid-ui.md.grid.tripletscomes in US3. - T032 [US2] In
src/managed/Nota.App/MainWindow.Commands.cs:- bind the four commands to
Grids.Set(target, SnapGrid.X(Grids.Get(target))); - set the status line to
"<Arrangement|Piano roll> grid: <label>"(FR-014); - choose the target with a helper
EditorKind GridTarget(): PianoRoll when_detailWasLastFocusedand the detail area shows aClipEditorView, else Arrangement (research R9).
- bind the four commands to
- T033 [US2] In
src/managed/Nota.App/MainWindow.axaml, add an Edit → Grid submenu withNativeMenuItems carryingapp:Commands.Id="grid.narrower","grid.wider","grid.snap"and"grid.adaptive"(the gestures come from the catalog viaMainWindow.MenuKeys.cs). - T034 [US2] In
src/managed/Nota.App/PreferencesWindow.cs(the shortcuts table around lines 1000–1080), add the GRID group with the rows from contracts/grid-ui.md (⌘1 ⌘2, ⌘4, ⌘5, ⌥ while dragging). Use the nota-shortcuts skill to check that the list matches the handlers. - T035 [US2] Run
dotnet run --project tests/Nota.SmokeTest -- --gridand the palette checks (scripts/build.sh). Confirm "every catalog shortcut is listed in Settings → Shortcuts" and that every id is bound.
Checkpoint: US1 and US2 both work. The grid is fully controllable without cycling.
Phase 5: User Story 3 - Triplet grid (Priority: P3)
Goal: Triplet lines and snapping in both editors and both modes, ⌘3 to toggle, and triplet Quantize values.
Independent Test: Quickstart §3 rows 6 and 7; the triplet cases in --grid.
Tests (write first)
- T036 [P] [US3] Add triplet cases to
tests/Nota.SmokeTest/SnapGridTests.cs:- triplet beats are 2/3 of straight ones (1/8T = 1/3, 1/4T = 2/3, 1/2T = 4/3);
- bar steps ignore
Triplet; - labels "1/8T" and "Auto · 1/16T";
- Adaptive with triplets moves through the triplet family as the zoom changes;
ToggleTripletsflips onlyTriplets;- in 3/4, 1/2 and 1/2T keep every bar start as a snap point and in
GridLines; - line and snap agreement (SC-001) holds for all triplet steps.
Implementation
- T037 [US3] In
src/managed/Nota.Application/Editing/SnapGrid.cs:- make sure
Resolvekeeps the triplet family for sub-bar steps and switches to straight bar steps once the Index reaches 5; - add
ToggleTriplets; GridStep.Labelappends "T".
- make sure
- T038 [P] [US3] Add triplet rows to the chip menu in
src/managed/Nota.App/SnapChip.cs: a "Triplets ⌘3" check row, with the fixed rows showing 1/32T … 1/2T when triplets are on (contract menu). - T039 [US3] Add
grid.triplets"Toggle Triplet Grid" ⌘3 tosrc/managed/Nota.Application/Palette/CommandCatalog.cs, bind it insrc/managed/Nota.App/MainWindow.Commands.csthe same way as T032, add it to the Edit → Grid submenu insrc/managed/Nota.App/MainWindow.axaml(after Widen Grid), and add the ⌘3 row to the GRID group insrc/managed/Nota.App/PreferencesWindow.cs. - T040 [P] [US3] Grid pens for triplet lines in
src/managed/Nota.App/PianoRollView.cs(GridPen) and in the arrangement grid loops (ArrangementView.LaneControl.csandArrangementView.Controls.cs): the bar and beat tests use a tolerance, so 2/3-beat positions draw with the sub-beat pen and whole beats keepBeatPen(FR-006).GridLabelstays 1/16-based. Ruler labels never show triplet indices (LabelStepBeatslimits them). - T041 [US3] Add the triplet Quantize values 1/32T … 1/2T (
Index0..4,Triplettrue) to the QUANTIZE dropdown insrc/managed/Nota.App/ClipPropsView.cs, after the straight values, as today's list does.
Checkpoint: All three stories work independently.
Phase 6: Polish & Cross-Cutting Concerns
- T042 [P] Add an
[Unreleased]entry toCHANGELOG.md:- Added: the adaptive snap grid in the arrangement and piano roll, with Narrow/Medium/Wide, triplets, the grid menu, ⌘1–⌘5 and a separate Quantize value;
- Changed: the snap cell opens a menu instead of cycling, and the piano roll's GRID becomes QUANTIZE; mention ⌘5 to get a fixed grid back.
- T043 [P] Update
FEATURES.mdvia thenota-featuresskill. - T044 Update the user docs (
../nota-docs, EN + RU) via thenota-docsskill: the arrangement grid, the piano roll grid and Quantize pages, the regenerated shortcuts page, and re-shot screenshots of the chip and menu. - T045 Headless UI verification per quickstart §3 (the nota-ui-verify recipe,
NOTA_DATA_DIR=/tmp/nota-grid): screenshots of the arrangement chip at default zoom, Fixed 1/32 zoomed out (dimmed), and the piano roll with triplets, in Ember Graphite and Ember Paper. Check the toolbar at narrow widths (MainWindow.TransportFit.cs). - T046 Check SC-004 and SC-005:
- no allocation in
ResolveorSnapBeatper pointer move (review the code; the label updates only when the step changes); - open an existing project and confirm no clip or note positions change.
- no allocation in
- T047 Run quickstart.md end to end.
Nota closing tasks (PR gates)
- T048 Run
scripts/build.shuntil native, managed and the smoke test (including-- snap grid --) are green - T049 Check that the AGPL-3.0-only SPDX two-line header is on
SnapGrid.cs,EditorGrids.cs,SnapChip.csandSnapGridTests.cs - T050 New dependency: N/A (none added)
- T051 CHANGELOG entry: covered by T042
- T052 FEATURES.md, docs and shortcuts: covered by T043, T044 and T034/T039 (nota-shortcuts)
- T053 Engine behaviour change: N/A (UI only); the smoke test still gains the SnapGrid section (T001–T003, T009, T028, T036)
Dependencies & Execution Order
Phase Dependencies
- Setup (T001–T002): none.
- Foundational (T003–T011): after Setup; blocks every story. Inside the phase: T003 → T004 → T005, T006, T007 (same file, sequential) → T008 [P with T004–T007] → T009 → T010 → T011.
- US1 (T012–T027): after Foundational.
- US2 (T028–T035): after Foundational. It touches
SnapChip.csfrom T017, so do it after US1's T017–T018 in practice. - US3 (T036–T041): after Foundational. The menu rows (T038) need T030, and the command (T039) mirrors T031–T034, so do it after US2.
- Polish (T042–T053): after the stories you ship.
Within US1
T012 → T013 → (T014 ∥ T015) → T016 → T017 → T018; then T019 → T020 → T021 → (T022 ∥ T023) → T024 → T025 → T026 → T027.
Parallel Opportunities
- T008 (Settings.cs) alongside T004–T007 (SnapGrid.cs).
- T014 and T015 (different arrangement partials).
- T022 (Expression lanes) alongside T023 (Quantize and MidiTools).
- Test tasks T028 and T036 alongside their stories' early implementation in other files.
- T040 alongside T038; T042 and T043.
Parallel Example: User Story 1
# After T013 lands, the two arrangement grid loops are independent:
Task: "T014 grid lines from SnapGrid.GridLines in ArrangementView.LaneControl.cs"
Task: "T015 grid lines from SnapGrid.GridLines in ArrangementView.Controls.cs"
# After T021, the Expression lanes and Quantize are independent:
Task: "T022 Expression lanes use the resolved draw step in PianoRollView.Expression.cs"
Task: "T023 Quantize + MidiToolsView use Grids.Quantize"
Implementation Strategy
MVP first (US1)
- Phases 1–2: the rule, its tests, persistence,
EditorGrids. - Phase 3: both editors snap and draw from the rule, and the chips show "Auto · step".
- Stop and validate: quickstart rows 1–3 and 11, plus
--grid. This alone fixes the reported pain.
Incremental delivery
- US2: the menu, ⌘1/⌘2/⌘4/⌘5 and the finer-than-visible mark.
- US3: triplets everywhere and ⌘3.
- Polish: docs, screenshots, the gates. One PR for the whole feature (Constitution V).
Notes
- Keep
SnapBar(sections) andAudioClipEditorView's own snap switch unchanged (research R12). - Do not commit. The user reviews and commits the changes.
Phase 7: Convergence
- T054 Make ⌘1–⌘5 work while the floating detail window is active on macOS: that window has no native menu, so the key equivalents never fire there. In
src/managed/Nota.App/MainWindow.Input.csHandleFloatingKeyDown, match ⌘/Ctrl + 1–5 (no Alt/Shift) and rungrid.narrower/grid.wider/grid.triplets/grid.snap/grid.adaptivethrough_commands.Run, then mark the key handled. Keep Windows/Linux from running it twice (theirTryMenuShortcutpath). Per FR-013 and plan R9 (partial) - T055 Snap the dragged note edge's absolute position in the piano roll, not only the drag delta. In
src/managed/Nota.App/PianoRollView.cs(Mode.Resize/Mode.ResizeLeft,_resizeAnchor), the end (or start) of the grabbed note should land onSnapBeat(XToBeat(p.X)), and the other selected notes should move by the same delta. Today a note whose end is off the grid keeps that offset when you resize it. Per US1/AC3 and FR-008 (partial) - T056 Decide and reconcile the arrangement toolbar label with FR-011, which requires "Auto · " in Adaptive mode. The toolbar cell shows the step plus an "AUTO GRID" caption (
src/managed/Nota.App/SnapChip.cs,MainWindow.axamlSnapChip cell). Either render "Auto · 1/8" in the cell, or amend FR-011 in spec.md to allow the two-line toolbar variant that is already documented in contracts/grid-ui.md. Per FR-011 (contradicts) - T057 Ignore grid shortcuts while a text field has keyboard focus: on macOS the native menu fires ⌘1–⌘5 even in a TextBox. Add a guard at the top of
StepGridinsrc/managed/Nota.App/MainWindow.Commands.cs: return if the focused element is inside aTextBoxorNumericUpDown. Per spec Edge Cases "Text entry" (partial) - T058 Fix the snap controls' width to their widest label so they never shift while zooming. The toolbar value
MinWidth="46"(src/managed/Nota.App/MainWindow.axaml) fits "1/16T" but not "2 bars" / "4 bars". The piano-roll chip'sMinWidth = 82(src/managed/Nota.App/SnapChip.cs) is narrower than "Auto · 4 bars". Measure the widest label in the mono font, or raise the minimums. Per plan Risks (toolbar width) (partial)
Phase 8: User Story 4 - The same grid in the audio clip editor (Priority: P2)
Goal: The audio clip editor snaps its trim brackets, warp markers and envelope points to the grid it draws, using the piano roll's setting and the same chip (spec US4, FR-018–FR-021, research R13).
Independent Test: Open a warped clip; zoom in and out; drag a warp marker, a trim bracket and an envelope point; each lands on a drawn line; the chip shows the step; ⌥ drags freely (US4 acceptance 1–5).
- T059 [US4] In
src/managed/Nota.App/AudioClipEditorView.csWaveformView:- add
ResolvedGrid WarpGrid(SnapGrid.Resolve(EditorGrids.Shared.Get(EditorKind.PianoRoll), _zoom * Bounds.Width / TotalBeats, BeatsPerBar)) andResolvedGrid EnvGrid(the same at_zoom * Bounds.Width / _clipBeats); - add a
GridChangedevent raised fromInvalidateVisualcallers when the drawn axis's grid changes; - subscribe to
EditorGrids.Changedwhile attached (redraw onEditorKind.PianoRoll).
- add
- T060 [US4] Replace the static whole-beat
SnapBeatwith an axis-aware snap that honoursSnapOnand a live Alt flag (set frome.KeyModifierson press and move):- trim brackets (around line 1034, replacing the
_snapGridflag); - warp-marker add (double-click, around line 924) and drag (around line 1053);
- envelope point add (around line 885) and drag (around line 997), on the envelope axis.
- trim brackets (around line 1034, replacing the
- T061 [US4] Draw the wave grid with
SnapGrid.GridLinesat the drawn step: warp axis (BeatToX) normally, envelope axis (EnvBeatToX) in Envelope mode (warped or not). Replace theBeatStep/GridFinestthinning in the grid loop (around line 1316). Keep the ruler's own label and tick logic. - T062 [US4] In the
AudioClipEditorViewheader (around line 208), replace the SnapSwitchRowand_snapToGrid/ToggleSnap/SetSnapToGridwithSnapChip.Create(EditorKind.PianoRoll, () => _wave.DrawnGrid), wired to_wave.GridChanged. Update the file's header comment. - T063 [US4] Shortcut target and status line (FR-021): in
src/managed/Nota.App/MainWindow.Commands.cs,GridTarget()returns the clip editor when the detail area was used last and_clipEditoror_audioEditoris open.StepGridresolves the label from the open editor and names it "Clip editor grid". - T064 [US4] Docs: CHANGELOG entry (the audio editor joins the grid; the Snap switch is replaced), FEATURES.md audio-editor bullet, nota-docs
editing/audio-clipsEN + RU (andbasics/transportsnap-grid section: "the clip editors share one setting"), re-shootediting/audio-clip-editor, thennpm run buildandnpm run check. - T065 [US4] Verify with the headless harness (warped clip: marker, trim and envelope drags with and without ⌥; chip label shared with the piano roll) and run
scripts/build.sh.