Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
Bug Assessment: Discard and retry ignores count-in
- Slug: retry-take-count-in
- Created: 2026-11-10
- Source: https://github.com/nota-daw/nota/issues/521 (host: github.com — allowlisted)
- Verdict: valid
- Severity: medium
Report (verbatim or summarized)
Discard and retry ignores count-in (#521, Nota 0.59.1, Arch Linux x86_64)
When using Discard and retry take, the recording starts immediately instead of respecting the configured count-in. The count-in appears to be respected visually by the playhead, but the actual recording starts immediately. This causes the playhead to lag behind the recording by the duration of the count-in.
Related: PR #486 (Discard and retry the take being recorded, specs/078).
Symptom
An Arrangement take started from stop with a count-in, then retried (⌘. / Ctrl+.), counts in again on the transport, but the audio input is captured from the moment of the retry: the retried audio clip begins with the count-in bar(s), so everything in it sits late by the count-in length. Expected: nothing is captured until the count-in runs out, as on a fresh take.
Reproduction
- Set a count-in (1 bar or more); arm an audio track on a hardware input.
- From stop, press Record: the count-in clicks, then the take records (correct).
- While recording, Discard and retry take.
- The count-in clicks again, but the new clip holds the count-in audio at its start.
MIDI takes are not affected (see below). The reporter did not say which track type; the "recording ahead of playhead" description matches an audio take.
Suspected Code Paths
src/native/nota.engine/src/engine/Engine_TakeRetry.cpp:retryTake()— for a counted-in Arrangement take it queuesTransportStop,Seek,TakeRestart(gate stays shut), thenstartArrangementTake(..., retryCountIn=true)→startCountIn().src/native/nota.engine/src/engine/Engine.cpp:startCountIn()— shutscaptureGate_on the message thread at once, then queuesTransportPlay(bars).src/native/nota.engine/src/engine/Engine_Render.cppcase CommandType::TransportStop→endCountIn()— re-openscaptureGate_on the audio thread when the queued Stop lands, i.e. afterstartCountIn()already shut it.Engine_Render.cppcase CommandType::TransportPlay(count-in branch) — starts the count-in but leaves the gate as it found it: open.src/native/nota.engine/src/engine/Engine_Recording.cpp:onInputBlock()— the hardware input thread captures whenevercaptureGate_is open; it has no notion ofcountInActive_.
Root Cause Hypothesis
Ordering race between threads, confidence high. On a fresh take nothing precedes the
count-in, so the gate startCountIn() shut stays shut until the count-in's end opens it. On a
retry, the stop queued just before is applied by the audio thread after the message thread
shut the gate, and endCountIn() opens it again; the following TransportPlay(bars) starts
the count-in without shutting it. The hardware input thread therefore pushes the count-in into
the take, which starts at the take's start beat — so the take's audio is late by the count-in.
MIDI capture and the internal (resampling) tap gate on countInActive_ on the audio thread as
well, which is why they stay correct.
Proposed Remediation
Preferred: make the audio thread's count-in start shut the capture gate itself — in
case CommandType::TransportPlay, when it starts a count-in, captureGate_.store(false). The
gate is then shut in the same order as the commands that open it (Stop/endCountIn, the
count-in end), whatever was queued before. startCountIn() keeps its immediate store for the
window before the command lands.
Alternatives:
- Don't queue
TransportStopin the retry when the count-in follows — would need a separate "rewind and count in" command; more surface for the same effect. - Make
onInputBlockalso check a publishedcountInActive_— a second flag for the same state.
Files likely to change:
src/native/nota.engine/src/engine/Engine_Render.cpp- a test hook to drive the hardware input path between offline renders
(
include/nota/nota_engine.h,src/abi/…,Nota.Infrastructureinterop) tests/Nota.SmokeTest/RetryTakeTests.cs
Tests to add or update:
- Retry of a counted-in audio take on a (test) hardware input, with input frames pushed through the real input-thread path every render block: the retried clip starts at the take start and is about as long as the time recorded after the count-in, not count-in + that.
Risks & Considerations
- The Session count-in also uses
TransportPlay(bars); it already shuts the gate instartCountIn(), so the extra audio-thread store changes nothing there. - A retry with
countInBars() == 0takes the!countedInpath and is untouched.
Open Questions
- None blocking.