Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
description: "Task list for the clip editor batch (#277, #278, #275, #114, #248, #140)"
Tasks: Clip editor batch — playhead, arrangement ruler, keyboard focus, warp tempo
Input: Design documents from specs/036-clip-editor-batch/
Prerequisites: plan.md, spec.md, research.md, data-model.md, contracts/clip-editor-ui.md, quickstart.md
Tests: The plan adds smoke-test checks for the four pure helpers (--clipeditor
section, linked as source like ValueText). UI flows are verified by the quickstart, not
by automated tests.
Organization: Grouped by user story; each story can be implemented and checked on its own. Story → issue: US1 #277 + #278, US2 #275, US3 #114, US4 #248, US5 #140.
All paths are repo-relative. App/ below means src/managed/Nota.App/.
Format: [ID] [P?] [Story] Description
- [P]: Can run in parallel (different files, no dependencies on incomplete tasks)
- [Story]: US1–US5 from spec.md
Phase 1: Setup (Shared Infrastructure)
- T001 Create folder
src/managed/Nota.App/ClipEditor/for the pure helpers, and link its files into the smoke test: add<Compile Include="..\..\src\managed\Nota.App\ClipEditor\*.cs" LinkBase="ClipEditor" />next to theValueText.cslink intests/Nota.SmokeTest/Nota.SmokeTest.csproj. Helpers must not reference Avalonia or the engine. - T002 Add
tests/Nota.SmokeTest/ClipEditorTests.cs(SPDX header,static IEnumerable<(bool ok, string label)> Run()likeValueEntryTests) and wire a--clipeditorsection intests/Nota.SmokeTest/Program.csbeside--valueentry("-- clip editor --", "CLIP EDITOR PASSED/FAILED"), and add it to the full run.
Phase 2: Foundational (Blocking Prerequisites)
Purpose: The position mapping and ruler labels used by US1 and US2.
- T003 [P] Implement
ClipTimeMapinsrc/managed/Nota.App/ClipEditor/ClipTimeMap.csper data-model.md § ClipTimeMap: fieldsStartBeat, LengthBeats, Domain (WarpBeats|SourceFrames), ContentTotal, PlayStart, PlayEnd, Reversed, IsSlot;PlayFracAtContent(c)=(c·Total − PlayStart) / (PlayEnd − PlayStart)then1 − fwhen reversed, not clamped;ContentAtPlayFrac(f)(inverse);ArrangementBeatAtContent(c) = StartBeat + PlayFracAtContent(c) × LengthBeats;ContentAtArrangementBeat(b)(inverse). Total and NaN-free forContentTotal > 0; degenerate windows (PlayEnd ≤ PlayStart) return 0. - T004 [P] Implement
RulerLabels+RulerDisplayinsrc/managed/Nota.App/ClipEditor/RulerLabels.csper data-model.md § RulerLabels:Bars(beat, stepBeats, beatsPerBar)→N/N.b/N.b.s(1-based, same output asPianoRollView/AudioClipEditorView.BeatLabeltoday);Time(beat, stepSeconds, bpm)→m:ssfor steps ≥ 1 s, thenm:ss.f,m:ss.ff,m:ss.fff; clamp negative positions to 0;TimeStepstable (reuse the seconds steps fromAudioClipEditorView.DrawRuler);static class RulerDisplay { bool ShowTime; event Action? Changed; void Set(bool) }(raises only on change). UseNotaNum.Culture-free formatting (pass a culture in) so it links without the app. - T005 Add
ClipTimeMapandRulerLabelschecks totests/Nota.SmokeTest/ClipEditorTests.cs: warped untrimmed / trimmed Start / reversed / unwarped round trips (ContentAtPlayFrac ∘ PlayFracAtContent = id), a clip at beat 32 reads 32 at its played start, seeking left of a trimmed Start gives a beat < StartBeat; labels for bars at 16th / beat / bar steps and time at 1 s / 0.1 s / 0.01 s / 0.001 s steps. (depends on T002–T004) - T006 Wire
RulerDisplayto the transport: insrc/managed/Nota.App/MainWindow.axaml.cssubscribe tovm.Transport.PropertyChangedforShowTimeDisplayand callRulerDisplay.Set(...); set the initial value on DataContext.
Checkpoint: dotnet run --project tests/Nota.SmokeTest -c Release -- --clipeditor green.
Phase 3: User Story 1 — See and move the playhead from the clip editors (P1) 🎯 MVP
Goal: #277 + #278 — playhead visible while stopped; ruler click / drag and playhead-line drag seek in both editors; Session slots show "not available".
Independent Test: quickstart § 2.
- T007 [US1] In
src/managed/Nota.App/AudioClipEditorView.csbuild aClipTimeMapinReload()fromci/ai(warped:WarpBeats, trimwarp_play_start/_endwithplay_end = 0 → warp_beats; unwarped: source frames,source_offset_frames,length_frames;Reversed;IsSlot = SessionClip.SceneOf(ClipIndex) >= 0) and pass it to the waveform canvas (_wave.SetTimeMap(map)); replace the inline playhead x formula inRender(the_fracblock) withContentAtPlayFrac— the drawing must not change. - T008 [US1] #277: in
AudioClipEditorView.OnPlayheaddrop theplaying &&gate for arrangement clips (inclusive at start and end); keep the session-slot branch as is. - T009 [US1] Add
public Action<double>? Seek(arrangement beat) toAudioClipEditorView, forwarded to the canvas; insrc/managed/Nota.App/MainWindow.Detail.csBuildAudioClipEditorset it only when!slot:Engine.Seek(Math.Max(0, beat)); Timeline.SetPlayhead(...)— same body as the piano roll'sSeek. - T010 [US1] Ruler seek in the waveform canvas (
AudioClipEditorView.cs, nested canvas class): press iny < RulerHwith the left button → capture, seek at x; move → scrub; release / capture lost → end. Position: x → content frac →ArrangementBeatAtContent; snap in the warp-beat domain withSnapWarpwhen warped (Alt =_free), unwarped seeks free; skip when the arrangement beat is unchanged; give immediate feedback viaSetPlayhead. Hand cursor over the ruler whenSeekis set. - T011 [US1] Playhead-line grab in the waveform canvas: hit zone ±4 px around the
drawn playhead x in ruler, marker strip and wave; checked first in
OnPointerPressed(before ADSR / envelope / marker / bracket gestures) only inside the zone; drag scrubs like T010;SizeWestEastcursor in the zone (update the hover cursor logic inOnPointerMoved). - T012 [US1] Piano roll playhead-line grab in
src/managed/Nota.App/PianoRollView.cs: inRulerLanea press within ±4 px of_playheadBeatscrubs (sameSeekAt); inNoteGrid.OnPointerPresseda press within ±3 px of the visible playhead becomes a pending scrub — once the pointer moves ≥ 3 px it scrubs via the ruler's snap / Alt logic, a release without movement runs the grid's normal click (add / select note);SizeWestEastcursor in the zone. Only whenSeekis set and the line is on screen. - T013 [US1] Session-slot "not available" state in both editors: when the clip is a
slot (
Seek is nulland slot), ruler and playhead-line zone showStandardCursorType.NoandToolTip.Tip= "A Session slot plays on its own loop clock — launch it to play from the start" (AudioClipEditorView.cscanvas ruler,PianoRollView.csRulerLane; the slot roll is built inMainWindow.Detail.cs~L772 — pass anIsSessionSlotflag there). - T014 [US1] Verify US1 by quickstart § 2 (headless harness or app): stopped playhead, ruler click / drag / Alt, line drag in both editors, reversed + trimmed clip, Session slot cursor + tooltip, and a click on the line in the note grid still adds a note.
Checkpoint: MVP — the playhead is fully usable from both editors.
Phase 4: User Story 2 — The clip editor ruler reads like the arrangement (P2)
Goal: #275 — arrangement-position labels; bars / time follow the transport read-out on all three rulers.
Independent Test: quickstart § 3.
- T015 [P] [US2] Piano roll ruler in
src/managed/Nota.App/PianoRollView.csRulerLane.Render: label each tick withRulerLabels.Bars(Origin + b, …)for arrangement clips (single and multi; removeRulerBarOffsetonce equivalent), keepOrigin = 0behaviour for Session slots; tick positions and grid lines unchanged (FR-011). In time mode place labelled ticks atRulerLabels.TimeStepsconverted to beats (sec × Bpm / 60), labels viaRulerLabels.Time. Subscribe toRulerDisplay.Changed→InvalidateVisual(unsubscribe on detach). BPM comes from the engine the roll already has or aFunc<double> Bpmset by the host. - T016 [P] [US2] Audio editor ruler in
src/managed/Nota.App/AudioClipEditorView.csDrawRuler: bars mode — ticks at arrangement-beat steps mapped back withContentAtArrangementBeat, labelsRulerLabels.Bars(arrBeat), for warped and unwarped clips (unwarped no longer shows source seconds); before the Start bracket the labels continue backwards (stop at arrangement beat 0). Time mode — the same with time steps. Session slots: clip-relative labels as today (warp beats from 0 / seconds from 0). Keep the existing label-thinning by width. Subscribe toRulerDisplay.Changed. - T017 [P] [US2] Arrangement ruler time mode in
src/managed/Nota.App/ArrangementView.Controls.csRulerControlrender: whenRulerDisplay.ShowTime, ticks at time steps (chosen by pixel width like the bars) andRulerLabels.Timelabels; loop brace, markers and gestures unchanged; subscribe toRulerDisplay.Changed. - T018 [US2] Verify US2 by quickstart § 3: MIDI clip at 9.1 reads 9; warped clip with trimmed Start reads 9 at the bracket and 8 before it; unwarped clip in bars; flip the read-out → all three rulers in m:ss and back; label at clip start matches the read-out.
Phase 5: User Story 3 — Keyboard shortcuts keep working after clicking in the clip editor (P2)
Goal: #114.
Independent Test: quickstart § 4.
- T019 [US3] Reproduce #114 before changing code (quickstart § 4.1): audio clip with
ADSR shown, then a MIDI clip; click props-rail buttons, the ADSR, the wave / grid; press
Space and ⌘1–⌘5; log the focused element (
FocusManager.GetFocusedElement()), whether the focused control re-activates on Space, and the grid target fromGridTarget(). Record the observed cause(s) inspecs/036-clip-editor-batch/research.md§ R4 ("Reproduction"). - T020 N/A — T019: no control takes focus on click, Space is never re-activated (research R4). [US3] Space KeyUp (R4 fix 1, if confirmed): in
src/managed/Nota.App/MainWindow.Input.csremember that the tunnel handler ran Space (_spaceHandled) and add a tunnelKeyUpEventhandler (registered next to the KeyDown one inMainWindow.axaml.csand forwarded from the floating detail window likeHandleTransportKeyTunnel) that marks the matching Space KeyUp handled, so a focused Button / ToggleButton is not clicked. Text fields stay exempt. - T021 N/A — T019: clip editor buttons and segments already take no focus on click (research R4). [P] [US3] Pointer-only props-rail controls not focusable (R4 fix 2, if
confirmed): in
src/managed/Nota.App/ClipEditorKit.cssetFocusable = falseon the buttons, switches and dropdown cells the factories build (Button,SwitchRow,Dropdown, segment cells), and on any equivalent built directly inAudioClipEditorView.cs/ClipEditorView.cs; text fields keep focus. - T022 [US3] Inert clip grid fallback (R4 fix 3, if confirmed): in
src/managed/Nota.App/MainWindow.Commands.csGridTarget()returnEditorKind.Arrangementwhen the clip editor target is the audio editor and its grid is inert (unwarped clip, or ADSR mode) — exposebool GridInertonAudioClipEditorView; the status line already names the target. - T023 N/A — T019 found no other cause in the clip editor (research R4). [US3] Any other cause found in T019: fix at its source and note it in research R4; if T019 refutes a fix in T020–T022, mark that task N/A with the reason instead of doing it.
- T024 [US3] Verify US3 by quickstart § 4.2–4.4 (docked and floating): each region, Space twice + ⌘1, no button re-activates, typing in fields still types, Enter / Esc release focus.
Phase 6: User Story 4 — Find and set the clip's warp tempo (P3)
Goal: #248.
Independent Test: quickstart § 5.
- T025 [P] [US4] Implement
ClipTempoinsrc/managed/Nota.App/ClipEditor/ClipTempo.csper data-model.md § ClipTempo:SrcAt(beat)piecewise linear through markers sorted bysrc(≥ 2), extrapolating with the end segments' slope;Bpm = (PlayEnd − PlayStart) × SampleRate × 60 / (SrcAt(PlayEnd) − SrcAt(PlayStart))withPlayEnd = 0 → last marker beat;Scale(newBpm)→ markers with every beat ×k = newBpm / Bpm,PlayStart × k,PlayEnd × k(PlayEnd = 0stays 0); "Valid range 20–999 BPM;Half()/Double()return null if the result leaves it". - T026 [US4]
ClipTempochecks intests/Nota.SmokeTest/ClipEditorTests.cs: one segment equals the segment-chip formula; scaling keeps segment beat ratios; trim scales; ×2 / ÷2 range limits;PlayEnd = 0handling. (depends on T025) - T027 [US4] Tempo row in
src/managed/Nota.App/AudioClipEditorView.csWarp section, directly under the Warp switch row (per contract § Warp section): label "Tempo", aDragNumber(20–999, two decimals, "BPM" unit, fine drag on the usual modifier, double-click / click → type, Enter / click-away commit, Esc cancel), and compact÷2/×2buttons (ClipEditorKit.Buttonstyle, non-focusable); tooltip on label and value: "The tempo the audio was recorded at. Nota stretches it to the project tempo. ×2 / ÷2 fix a half- or double-time detection." Follow DESIGN.md / nota-design; must fit the current single-column rail. - T028 [US4] Warped-clip edits: on commit compute
ClipTempo.Scale(t)from the current markers / trim /_srcSRand apply insideEngine.BeginUndoGroup()…EndUndoGroup()viaWarpEdit:SetClipWarpMarkersthenSetClipWarpTrim(skip trim when unchanged); thenReload(). A drag scales the canvas markers locally (live redraw, no engine) and commits once on release; ÷2 / ×2 commit once each; disable them whenHalf()/Double()is null. - T029 [US4] Unwarped-clip edits: show
_detectedBpm(or "—", dimmed but editable; ÷2 / ×2 disabled when "—"); a commit callsEngine.AutoWarpClipAtBpm(TrackId, ClipIndex, t)insideWarpEdit(one engine call = one undo step), updates_detectedBpm/_warpEnabled, thenReload(). - T030 [US4] Keep the value in sync: refresh it in
Reload(), after Detect tempo / To transients, after a segment-chip edit and after a marker drag; segment chips keep working (FR-022). - T031 [US4] Verify US4 by quickstart § 5: 120 BPM loop reads 120.00; ÷2, ×2, drag, type — each one undo step; multi-marker ratios kept; unwarped → Warp on at the typed tempo, one undo back.
Phase 7: User Story 5 — See the warp while dragging a marker (P3)
Goal: #140.
Independent Test: quickstart § 6.
- T032 [P] [US5] Implement
WarpRemapinsrc/managed/Nota.App/ClipEditor/WarpRemap.csper data-model.md § WarpRemap:OldBeatAt(newBeat) = BeatAt(committed, SrcAt(live, newBeat)), piecewise linear, usingClipTempo.SrcAt-style interpolation; identity whenlive == committed; no allocation per call (arrays passed in, binary search). - T033 [US5]
WarpRemapchecks intests/Nota.SmokeTest/ClipEditorTests.cs: identity, monotone over a dragged middle marker, end markers fixed, last-marker drag. (depends on T032) - T034 [US5] Live preview in the waveform canvas (
AudioClipEditorView.cs): on a marker press snapshot the committed markers into reusable arrays; while dragging, draw the overview and the zoomed detail peaks column by column at new beatbfrom the peak atWarpRemap.OldBeatAt(b)(both are beat-domain); BPM chips already follow_mk. Release → existingCommit()(one engine call, one undo step) →Reload()swaps in the engine render. No engine call during the drag (FR-026). - T035 [US5] Cancel: add
public bool CancelGesture()onAudioClipEditorView(restores_mkfrom the snapshot, releases capture, redraws, returns true if a drag was active); call it first forKey.Escapeinsrc/managed/Nota.App/MainWindow.Input.csHandleKeyDown(beforeTimeline.EscapePressed), also reached from the floating detail window; capture lost → same restore. - T036 [US5] Verify US5 by quickstart § 6, including a 5-minute clip (SC-004: no lag, no dropouts while playing) and Esc leaving nothing in undo.
Phase 8: Polish & Cross-Cutting Concerns
- T037 Design pass with the
nota-designskill on all new UI (Tempo row, cursors, slot tooltip, time labels) in Studio Dark / Studio Light / Ember Graphite / Ember Paper; the design checks in the smoke test stay green. - T038 [P] Preferences → Shortcuts via the
nota-shortcutsskill: audio-editor ruler click / drag, Alt free seek, playhead-line drag (both editors), Esc cancels a warp-marker drag, Space no longer activates a focused control. - T039 [P] User docs via the
nota-docsskill (EN + RU): clip editor page (playhead, ruler in arrangement position, bars / time), warping page (Tempo field, ÷2 / ×2, live marker drag), arrangement ruler time mode; re-shoot affected screenshots. - T040 [P] FEATURES.md via the
nota-featuresskill. - T041
CHANGELOG.md[Unreleased]: Fixed — #277, #114; Added / Changed — #278, #275, #248, #140 (one line each, user-facing wording, issue links). - T042 Screenshots for the PR (quickstart § 7): before / after for #277, #275, #248 and a mid-drag #140 frame, via the headless harness.
- T043 Run the full quickstart once more end to end.
Nota closing tasks (PR gates)
- T044 Run
scripts/build.shuntil native + managed + smoke test are green (includes--clipeditor). - T045 AGPL-3.0-only SPDX two-line header on every new source file
(
ClipEditor/*.cs,tests/Nota.SmokeTest/ClipEditorTests.cs). - T046 New dependency: N/A (none).
- T047 CHANGELOG entry: see T041.
- T048 FEATURES.md / docs / shortcuts: see T038–T040.
- T049 Engine behaviour change: N/A (UI-only; existing ABI entry points).
- T050 Run
/speckit-convergeand reach Converged before the PR.
Dependencies & Execution Order
Phase Dependencies
- Setup (T001–T002) → Foundational (T003–T006) → user stories.
- US1 needs T003 (map) and T006 is not needed. US2 needs T003, T004, T006.
- US3 needs nothing from Phase 2 (can start right after Setup).
- US4 and US5 need only their own pure helper (T025 / T032) and Setup.
- Polish after the stories it documents.
User Story Dependencies
- US1 → US2 share
AudioClipEditorView's canvas: do US1's canvas tasks (T007, T010, T011) before T016 to avoid conflicting edits. - US4 and US5 both edit the Warp code in
AudioClipEditorView.cs: sequence T027–T030 before T034–T035. - US3 is independent of the others.
Within Each User Story
- Pure helper → its smoke checks → UI wiring → verification task.
Parallel Opportunities
- T003 ∥ T004 (different new files); T025 ∥ T032 ∥ T003 (pure helpers, different files).
- In US2: T015 (PianoRollView) ∥ T017 (ArrangementView.Controls) ∥ T016 (after US1 canvas work).
- In US3: T021 (ClipEditorKit) ∥ T020 (MainWindow.Input).
- Polish: T038 ∥ T039 ∥ T040.
Parallel Example: Foundational + pure helpers
Task: "Implement ClipTimeMap in src/managed/Nota.App/ClipEditor/ClipTimeMap.cs"
Task: "Implement RulerLabels + RulerDisplay in src/managed/Nota.App/ClipEditor/RulerLabels.cs"
Task: "Implement ClipTempo in src/managed/Nota.App/ClipEditor/ClipTempo.cs"
Task: "Implement WarpRemap in src/managed/Nota.App/ClipEditor/WarpRemap.cs"
Parallel Example: User Story 2
Task: "Piano roll ruler labels + time mode in src/managed/Nota.App/PianoRollView.cs"
Task: "Arrangement ruler time mode in src/managed/Nota.App/ArrangementView.Controls.cs"
Implementation Strategy
MVP First (User Story 1)
- Setup + Foundational (T001–T006).
- US1 (T007–T014) → validate by quickstart § 2. The two most-felt issues (#277, #278) are fixed here.
Incremental Delivery
- US1 → US2 (rulers build on the same map) → US3 (keyboard) → US4 (tempo) → US5 (live drag), each validated by its quickstart section.
- Suggested commit split for the user's review (the user commits): one commit per issue, in the order #277, #278, #275, #114, #248, #140, plus one for docs.
Notes
- [P] = different files, no dependency on unfinished tasks.
- The user makes the commits; leave changes uncommitted for review.
- If T019 shows #114 has a cause outside the clip editor, keep the fix scoped and record it.
Phase 9: Convergence
- T051 Add fine drag to the audio clip editor's Tempo field — holding the usual fine-drag modifier (⇧ / ⌘, as on
Knob/SliderTrack) drags it in smaller BPM steps — insrc/managed/Nota.App/Controls/DragNumber.cs(opt-in, so the transport BPM field is unchanged unless chosen) andsrc/managed/Nota.App/AudioClipEditorView.cs; restore the fine-drag note incontracts/clip-editor-ui.md§ Warp section per FR-018 (partial) - T052 Review and justify (or narrow to marker drags) the live warp preview and Esc cancel that also cover the segment BPM-chip scrub and the Tempo-field drag in
src/managed/Nota.App/AudioClipEditorView.cs(Remapped,CancelGesture), beyond the warp-marker drag FR-023 / FR-025 call for; if kept, record it in research.md R6 and the contract per FR-023 (unrequested)