RAVET architecture¶
RAVET keeps portable processing independent of plug-in formats, audio devices, and editors. The gain reference product supplies one processor implementation; the offline example and CLAP prototype exercise it through different boundaries. The catalogue lists the current Cargo packages.
Topics in this guide
- Crate boundaries
- Processor ownership and lifecycle
- Audio and event contract
- CLAP translation
- Real-time evidence
- Portable parameter and meter layer
- Native C++ editor backends
- Standalone device boundary
- Local media worker boundary
- Control-thread runtime boundary
- Native format reference boundary
- Optional native hosting boundary
- Embedded processing
- Optional CPU raster pixels
- Optional worker image assets
Crate boundaries¶
ravet-foundation owns the processor lifecycle, validated preparation limits,
borrowed planar audio, events, transport types, and validated borrowed parameter
schemas with fixed-size complete state and explicit migration. ravet-signal owns reusable
numerical components: a linear smoother, prepared double-precision delay and
feedback diffusion, fixed streaming 2x half-band conversion, and caller-owned
quadrature rotation, stable biquad filters, prepared complex FFT/FIR convolution
and selectable 1x/2x/4x/8x oversampling, phase oscillators, peak compression
and arbitrary-ratio sinc conversion. See signal processing. Neither requires
a host or platform backend. ravet-surface supplies portable parameter attachments and contains an independently built
macOS Cocoa/WebKit native backend. ravet re-exports these three modules.
The explicit ravet-webview crate owns its Cargo/FFI binding, and is not part
of the umbrella graph.
ravet-gain implements the gain product using those portable contracts.
ravet-clap translates Clack's safe host audio and event views into that
contract. ravet-gain-clap owns plug-in metadata, ports, parameters, threading,
and the exported CLAP entry. ravet-clap-smoke is a development loader and host.
The umbrella crate does not re-export the CLAP adapter.
Proprietary consumer products live in separate private sibling projects and are not workspace members. Only general reusable components enter the public framework; see publication policy and prepared DSP decision.
Portable processing adds pinned pure-Rust libm for foundation parameter math
without std; default desktop mappings retain their existing math behavior.
Other portable DSP dependencies remain local workspace crates. The explicit
ravet-data package adds bounded XML, hashing, and legacy integer verification
through pinned quick-xml, sha2, and num-bigint dependencies; these allocating
services stay on control/worker threads. See control data
and native editor for the new boundaries. The safe CLAP
bridge depends on Clack, while the export and smoke host isolate narrowly
allowed unsafe ABI operations. See the
CLAP decision for dependencies
and foreign-pointer responsibilities.
The explicit ravet-state crate owns allocating transactional trees, undo/redo,
revision subscriptions and complete preset records on control threads.
ravet-audio-file owns bounded WAV/AIFF worker I/O and optional compressed clips and prepared SPSC audio handoff;
file methods never run in callbacks. ravet-instrument adds portable fixed-capacity
voice ownership and configured per-note expression, leaving DSP and device/format
exports to consumers. The explicit ravet-graph schedules owned portable nodes and prepared latency
routes; its distinct fault status exposes partial node progress rather than
claiming whole-graph DSP rollback. These crates are not implicitly re-exported
by the umbrella.
The explicit ravet-native-dsp crate owns scoped current-thread floating-point
policy and explicit packed/vector operations behind private native modules; it is
not re-exported by the umbrella. See native DSP.
Native format reference wrappers use the explicit public ravet-gain-native
and ravet-performance-native archives; their SDKs stay external. See observable state,
audio files, MIDI, VST3,
AudioUnit, AAX and LV2.
Processor ownership and lifecycle¶
The processing thread exclusively owns mutable DSP state. Preparation validates sample rate, channel layout, maximum frames, and event capacity, and may allocate storage. Stop callbacks before preparing again or deactivating.
The lifecycle is create, prepare, process or reset, then deactivate. A failed gain preparation leaves the processor inactive. Reset preserves preparation and requested parameter values while snapping smoothing to the latest request. Deactivation preserves that request for the next activation.
The reference gain accepts mono/stereo effects. Foundation also represents no-input instruments and up to 64 channels per direction, plus eight auxiliary buses; contract tests exercise those boundaries, the separate public sine/performance references and CLAP/VST3/LV2 profiles exercise their stated subsets. See MIDI and the format guides.
Audio and event contract¶
Audio is borrowed planar f32 or f64, specialized per processor, on one main bus and up to eight auxiliary buses. Separate-buffer views borrow immutable
inputs and mutable outputs; in-place views borrow mutable channels. Constructors
validate channel lengths, and accessors expose only active frames. Zero frames
are legal; unused backing tails remain untouched.
Input events are bounded by prepared capacity and ordered by nondecreasing frame offset. Same-frame events retain input order and take effect before that sample. Nonempty blocks require offsets below the frame count. Empty blocks allow only offset zero and apply events without advancing DSP time.
Processors validate the complete block before applying events or changing DSP state. A fault rejects the block, silences all active bus outputs and discards emitted events. Caller-owned output event storage has its own prepared capacity. These obligations are documented by Processor and decision 0001; types alone do not enforce an implementation's real-time behavior.
CLAP translation¶
Activation preallocates scratch audio and event storage. Callbacks copy host inputs into scratch, run the gain processor in place, and copy results to host outputs, allowing separate, in-place, and mixed host channel pairs. This costs two sample copies per channel.
The bridge caps preparation at 65,536 frames and translation at 1,024 input
events, including ignored event kinds. Only global core parameter-value events
are translated. Validated block-start transport position/tempo/playback context is forwarded, with seek detection. Notes, modulation, output events, extra buses and f64 remain outside that gain
bridge. Separate MainBusBridge/MultiBusBridge profiles provide explicit native
precision, note/MIDI/scoped parameter input, generated events and auxiliary buses
with their own opt-ins and bounds. See extended processing.
The main thread reads requested gain, boolean bypass and a 31-bit restore generation from one atomic 64-bit word. Complete state load and inactive host flush publish a new generation; audio synchronizes at callback boundaries and reflects values using bounded conditional publication. State load explicitly migrates legacy gain-only records. See state protocol. Foundation's word mailbox remains available for arbitrary complete multi-parameter publications with caller-owned encodings and contention policy.
The gain export has a separate editor control bridge: one
main-thread producer queues up to 32 complete edits or live gesture commands, and the serialized CLAP
consumer emits host begin/value/end while retaining output backpressure progress.
Restores invalidate older edits; accepted editor changes precede host automation
and are reflected independently of malformed host streams. A separate coherent
meter mailbox receives successful audio blocks. Fault diagnostics remain atomic,
without callback logging. A default optional macOS GUI uses this bridge through main-thread JSON;
ravet-editor-smoke owns a native parent/main loop to exercise the built bundle.
Real-time evidence¶
Processing implementations must avoid allocation, deallocation, blocking, and I/O. Allocation-counter tests cover the gain processor, CLAP bridge, and host ABI, including reset and malformed inputs, on the measured processing thread.
These tests do not establish callback deadlines, native allocation behavior, device latency, or DAW compatibility. Work status records the executed workloads and environment. Future editor, broader state, and device integration must preserve the processor's ownership and callback obligations.
Portable parameter and meter layer¶
The parameter guide describes schema validation, complete versioned records and explicit migration. Portable gain adds bypass and complete gain/bypass restore; CLAP exposes both parameters and complete session recall. Signal provides peak/RMS accumulators; gain measures successful nonempty blocks and offers a separate coherent meter mailbox. Audio owns restore and publication timing, while the embedded editor owns display scheduling. Current meter bars have no decay or peak retention; fuller display ballistics remain future work. See decision 0010.
Native C++ editor backends¶
The separate native editor boundary provides Cocoa/WebKit, Windows HWND/WebView2 and Linux GTK3 X11/WebKitGTK prototypes. Linux format consumers own a UI-loop timer and call the bounded GLib pump. Windows consumers own an STA message loop and deploy the matching loader plus runtime prerequisite. These C++ backends do not add browser dependencies to the portable graph or extend the macOS-only Rust binding/CLAP GUI to other platforms. Product wrappers, assets, licensing fixtures and format SDKs remain outside the public repository. See decision 0014.
Standalone device boundary¶
The explicit ravet-device crate adds CPAL outside the portable umbrella. Control
threads enumerate/select/configure output devices and prepare output-only f32
processors. Callbacks use preallocated planar scratch and partition variable
interleaved buffers into bounded blocks. ravet-device-probe validates silent
output callbacks; ravet-standalone-probe lists devices and MIDI ports, sends
test notes and captures/analyses output for standalone-application evidence. Separate input/FIFO and clocked duplex, buffered graph workers and explicit
caller-scheduled recovery prototypes have their own bounds and evidence. MIDI
connections and prepared handoff live in ravet-midi-device; physical hotplug,
long-session drift and broader standalone scheduling require further validation. See
audio devices and decision 0018.
Local media worker boundary¶
The separate ravet-media macOS prototype owns explicit local-video metadata
and timestamped RGBA frame extraction through AVFoundation. Native assets remain
thread-confined; decoding, allocation and destruction belong on UI/workers. It
adds no video/audio/network/device dependency to portable DSP or the umbrella.
See local video for bounds and validation limits.
Control-thread runtime boundary¶
Optional ravet-runtime owns bounded files/HTTPS and background workers/timers
in safe Rust. ravet-runtime-ffi provides opaque handles, buffers, callbacks and
narrow OS queries. C++ facades translate ownership only. Product authorization
and storage/payload policy remain private; see runtime services
and decision 0020. Surface dialogs are
OS UI shims. These services add no networking/thread dependencies to portable
processing and must stay outside audio callbacks.
Native format reference boundary¶
ravet-gain-native exposes a narrow static-library ABI for the public reference
DSP/state codec. Native VST3 processor/controller classes compile against an
external SDK with preallocated scratch and bounded queue translation. Portable
crates acquire no SDK or pointer dependency. Reusable native processor/schema/cache/audio-state/publication helpers now
underpin Gain and a separate performance archive. The VST3/LV2 performance
instruments remain scoped prototypes; further format/editor/platform mappings
and host evidence remain separate work. See VST3.
Optional native hosting boundary¶
ravet-host discovers explicit bounded CLAP candidates without executing them,
then loads a caller-selected trusted library through an unsafe native-code
boundary. It owns bounded byte-preserving metadata and exposes Clack's retained
entry for consumer-owned instance/callback/audio/state policy. A main-thread borrowing guard owns negotiated GUI lifecycle
with explicit native parent lifetime. It supplies
no automatic system scan, sandbox or device dependency to portable processing.
See plug-in hosting.
Explicit graph audio sessions may bracket processing with optional
Processor::start_audio/stop_audio hooks. Their defaults are no-ops; existing
adapters retain ordinary portable behavior. Owner-confined borrowed graph sessions
start/stop nodes on audio and return stopped graphs for control deactivation.
See graph sessions for rollback,
retirement and native integration limits.
Native/backend runtime BackendFailure clears outputs/events while acknowledging
that native histories may have advanced. This differs from validation rejection
before mutation; consumers stop/reset/rebuild under their session policy. Hosted
graph nodes use that explicit runtime fault contract. Their prepared f32/f64
scratch matches the native sample format; f64 requires advertised native port
support before activation, without precision conversion. Explicit packed-port
factories preserve native enumeration boundaries while graph routes use summed
main channel indices; portable auxiliary pairing is not inferred. Block-start
transport is separately enabled while stopped on main; unrepresentable known
context rejects before native calls with InvalidTransport. Separate parameter
input factories cache validated writable metadata/identities and fixed event slots
on main; audio processes exact offsets or flushes zero-frame input without
advancing native process time. The preparation builder also selects bounded global
parameter output, including read-only telemetry: checked mapped output publishes
through graph event routes, while runtime output faults clear the block without
rolling back native history. Other native event kinds remain separate mappings.
The native preparation builder also selects one explicit note/MIDI input index and dialect, sharing bounded slots with optional global parameters. Whole input validates before native calls, preserving offsets/order; zero-frame performance rejects before parameter flush. CLAP notes use wildcard IDs, MIDI/MPE quantize velocity, and MIDI2 preserves framed UMP without translation. See the selected-input guide and decision 0114 for limits and probes.
A separate selected native performance-output profile shares bounded output storage with mapped parameters. It preserves representable CLAP notes, short MIDI/MPE or framed UMP through explicit graph edges; unsupported targets filter, and selected malformed output clears audio/events with nonrollback failure. See the output guide and decision 0115.
Hosted native graphs expose guarded main-thread editor creation through their retained control. The separately owned audio node may run, while exclusive editor borrowing prevents control retirement until GUI destruction. Core callbacks can be serviced once per consumer main tick through the guard. See the hosting guide and decision 0116.
The optional device crate has an explicit buffered f32 graph-worker output bridge. A non-Send graph session stays on its worker while a separate device processor consumes a prepared queue; stop/join precedes main graph/native retirement. No device clock or callback-thread teardown is inferred. See the device guide and decision 0117.
The optional ravet-native crate prepares generic f32/f64 main/auxiliary planar
scratch and typed generated events for consumer native shims. Its narrow pointer
module copies all inputs before output writes and contains processing panic with
explicit poisoning. Public Gain C handles use this core; product event/state
codecs, SDK registration/editor/format mapping remain outside it. Optional native
facade traits expose control-cached global state and separate raw f64 telemetry on
exclusive prepared owners; control byte codecs and cross-thread publication remain
explicitly separate. See the
native processing guide and
decision 0142.
Embedded processing¶
Foundation can disable its default std feature for allocation-free contracts.
ravet-embedded owns fixed-array f32 planar scratch and validates interleaved
f32/i16/i32 blocks before portable DSP. It introduces no HAL, device, allocator,
OS or implicit atomic emulation. Existing allocating signal/graph/runtime/editor
crates retain their desktop boundaries. ravet-embedded-gain is a distinct
immediate stereo reference and narrow caller-owned C bridge. Native Arduino
C++11 consumers have an explicit stereo processing subset, independent of Rust
exports. Pi Linux consumers choose the target for installed OS bitness.
See embedded projects and
decision 0152 for contracts and limits.
The AUv3 and mobile native prototypes pair exported processor, parameter and live-state entries outside portable DSP. Apple AU editor/extension ownership, Apple AVAudioEngine device lifecycle and Android AAudio/JNI application ownership remain distinct native adapters; proprietary consumers still live in private sibling projects.
The separate ravet-metal macOS prototype owns an explicit offscreen GPU
pipeline for ordered filled portable rectangles, explicit bitmap scenes and
independent RGBA readback.
Creation, submission, completion waiting and readback belong to its owner UI/worker
thread; this is outside the processing graph and creates no window.
See Metal drawing for bounds and validation limits.
Optional CPU raster pixels¶
The portable ravet-surface/raster feature owns CPU premultiplied RGBA8 canvases
and prepared finite device paths. The ravet/raster umbrella feature forwards it;
all default dependency graphs retain their previous shape. Combining raster
with text prepares owned local TrueType glyph geometry. Input, output and
accounted covered-pixel budgets are explicit, while backend working memory and
execution time remain external. Consumers choose a presenter, including explicit
MetalBitmap adoption. See CPU raster and
decision 0187.
Optional worker image assets¶
ravet-surface/image and umbrella ravet/image opt into byte codecs separately
from raster/window dependencies. Immutable validated straight RGBA8 transfers
through explicit consuming PMA conversion and consumer presentation. Bounded
structural preflight precedes strict PNG/JPEG backends; private bounded PNG
output exposes no partial bytes. Allocating codecs belong to UI/worker threads,
with backend memory/time separate from framework input/output limits. See
image assets and decision0195.