AUDIO
Source snapshot · 11 November 2026

Prepared processor routing graphs

Live convolution transitions

Enable ravet-graph's default-disabled convolution-transitions feature for convolution_transition(initial, maximum_frames, TransitionOptions). It works with ravet-signal's Convolver32/64 and ConvolutionBank32/64. Construction on CONTROL returns a Send control endpoint for a worker and an audio endpoint. Construction creates a one-slot handoff, a four-slot returned-engine queue, a 16-slot report queue, one channel of sample scratch and per-frame gain scratch. This uses the same boxed-owner rtrb handoff and deferred retirement as graph replacement.

The worker prepares an engine or bank, for example from prepare_impulse_response, and calls offer. Channel count, maximum frames and, under LatencyPolicy::RequireEqual, latency are checked there; a refused engine is returned unchanged. Ok means the engine was queued, not that it will play. Audio process admits the whole call before any change, then handles at most one proposal per block boundary (including zero-frame calls). A CrossfadePolicy { frames, law } runs old and new engines together for frames frames: y = S(g_old) * y_old + S(g_new) * y_new with t = (k + 1) / frames. EqualGain uses (1 - t, t) and EqualPower uses (cos, sin)(t * pi / 2), computed once per frame and equal to (0, 1) at the end to rounding. Setting frames = 0 is an explicit cut.

The new engine starts from its own prepared (empty) history. For a response longer than the fade, its output still lacks the tail from earlier input, so for stationary input the blend dips in level by up to 1 - (energy of the first frames taps / total energy). It recovers as the history fills. Engines with different latencies are not aligned. Both limits have explicit, optional remedies described under transition continuity.

When a fade ends, the old engine returns through the returned queue, or through one deferred slot while that queue is full. If neither has room, it stays as a silent, unprocessed outgoing owner and is retried at the next boundary. Further starts wait (retirement_blocked) until the worker calls take_returned or reclaim, which drop engines on that thread. Returned engines keep their history; call their reset before reuse. Mid-fade proposals follow MidFadePolicy:

LatencyPolicy::Report accepts latency changes and reports TransitionEvent::Started { previous_latency, latency, fade_frames } with absolute frames. The consumer applies its host's latency change; during a fade the output mixes both latencies. Per-call TransitionStatus is authoritative, while reports are best-effort with loss counts. reset clears both engines' histories and keeps the fade position.

Audio-side process and reset do not allocate, free, lock or panic. Construct and drop both endpoints outside the callback:

Tests show bit-exact blends against independently computed references for f32 and f64. They cover both laws, three partition pairs and block sizes 64, 1, 7, random and zero. They also cover each mid-fade policy, latest-wins after the fade, refuse under backpressure, latency refusal and reporting, refused calls and offers leaving state unchanged, and zero audio-side allocations and frees through handoff, fade, retirement, backpressure and shutdown. Debug and release runs include a three-seed worker/audio stress test of each policy. The transition is not a Processor, and offline tests make no deadline claim. See decision 0272.

Transition continuity: history priming and latency alignment

convolution_transition_with_continuity(initial, maximum_frames, options, continuity) takes a TransitionContinuity { priming, alignment }. TransitionContinuity::NONE (the default) behaves exactly like convolution_transition, which delegates to it. The default path's ADR 0272 behaviour is guarded by the 15 unchanged transition tests and by digests of output samples, statuses, offer results, reports and returned engines recorded from the ADR 0272 build in 108 scenarios. Construction checks every length, and the total storage (at most 256 MiB of samples), before allocating. Storage is reserved fallibly, and a refusal (Priming, Alignment, Storage, Allocation) returns the identical initial engine.

PrimingPolicy::History { frames, frames_per_block } records the last frames input frames of each channel in a ring prepared at construction. When a proposal is taken, the incoming engine first processes the recorded history and its output is discarded. Its state then matches an engine that had been running on the same input. Choose frames of at least the incoming tail_samples (taps - 1 + latency). The output from the fade start then equals a never-switched engine with the new response to rounding, and the level dip disappears. If fewer than frames frames have been recorded (shortly after construction or reset), only the recorded frames are primed.

Priming work is bounded at frames_per_block history frames per channel per block boundary, on top of normal rendering. Construction requires either frames_per_block >= frames or frames_per_block > maximum_frames:

TransitionStatus::{priming, primed_frames}, TransitionEvent::PrimingStarted and priming_sequence/priming_lag expose the schedule. A proposal that is being primed counts as an in-progress transition for MidFadePolicy, including a proposal that is pending at the boundary where priming completes: Refuse refuses it, QueueOne keeps it queued and LatestWins moves it to waiting, superseding an earlier waiting proposal. reset forgets the history, and a proposal being primed then starts at the next boundary from empty history. A single-block prime can cost up to frames frames of engine work at one boundary; choose frames_per_block > maximum_frames to spread it over several blocks.

AlignmentPolicy::DelayLower { maximum_difference } prepares two delay lines of maximum_difference + maximum_frames frames per channel. Each line records its engine's raw output. For a transition from latency a to b, the lower-latency path is delayed by |a - b| during the whole fade, so both paths are aligned at max(a, b):

Without priming, the incoming engine has no output from before the fade start. When b < a its delayed path therefore reads zeros for the first a - b fade frames and is silent while its gain rises; if a - b is at least the fade length it contributes nothing before the release, and the level dip is deeper. Priming fills those frames.

Each change is reported in TransitionStatus::output_latency_change and TransitionEvent::OutputLatencyChanged with its absolute frame. output_latency_samples() gives the current value; the consumer applies its host's latency change. A proposal whose latency differs from the current engine's by more than maximum_difference is refused at the boundary where it would start. It is returned unused as ReturnReason::Refused with TransitionEvent::AlignmentRefused and TransitionStatus::alignment_refused, through a reserved returned slot. Without a free slot it stays where it is (retirement_blocked) and nothing starts. The check happens on the audio side because only that endpoint knows which engine is current.

Both policies are allocation-free on the audio side. Each block copies the input into the ring and each engine's output through its line, in time proportional to the block. Taking a proposal forgets the incoming line and reset forgets both, in constant time: each line counts the frames written since it was forgotten and reads older positions as zero, so no clear proportional to the prepared size is needed. During a fade, the delayed path (old or new) therefore reads zeros for its delay after a reset.

Tests check bit-exact output against independently computed references for f32 and f64 banks across block sizes 64, 1, 7 and random:

Further tests cover priming from a history shorter than requested (before the ring fills and after reset), LatestWins proposals arriving during priming, reset during aligned fades in both directions against an independent reference, refusals that leave output, histories and returned engines untouched (including under backpressure), setup refusals with zero allocations, zero audio-side allocations through priming, alignment, refusal and reset, and a three-seed worker/audio stress test of each mid-fade policy. These are offline results; they make no deadline claim. See decision 0275.