FieldAssist is a Cargo workspace. Library crates form a DAG from leaf utilities up to the desktop application. Sibling crates in the same layer do not depend on each other; traits live in the crate that consumes data, and higher layers supply adapters.
Product behavior is described in docs/spec/ (application, workflows, analysis, processing). This file covers only crate boundaries and composition patterns. The shared Lua surface is documented in scripting/.
field-core (file URLs, ProgressHandle, CompositionId `comp:`)
├── field-variables (scoped string vars, compose, `${…}` interpolate)
├── field-audio-model
│ (MediaId `media:`, MediaDescriptor, MediaPool, MediaStore, pager;
│ MediaVariableStore for probe + enrich_media — depends on field-variables)
│ ├── field-audio-process
│ └── field-composition ← also field-audio-io, field-core, field-variables
├── field-audio-io (also field-variables for source.* probe / TagMap)
├── field-session (depends on field-core + field-audio-model serde + field-variables;
│ DocumentId `doc:`, SessionId `session:`; no
│ field-composition edge)
└── field-audio-playback (device list for field.audio_devices)
field-features (feature flag registry; no gpui)
field-settings (settings.json schema + I/O; no gpui)
field-audio-monitor (Faust listen DSP; lock-free ParamStore)
field-ui-components (gpui widgets + host traits / DTOs; field-variables
for `${…}` template completion)
field-scripting (mlua host; depends on field-settings; NO gpui)
├── field-batch (CLI: REPL + script + shebang)
├── field-play (CLI: composition → default device + monitor;
│ init.lua + detect_layout)
└── FieldAssist (GPUI app; Settings UI; also monitor, ui-components,
playback, field-features, field-settings)
| Crate | Level | Responsibility |
|---|---|---|
field-core |
leaf | File URLs, ProgressHandle, prefixed CompositionId |
field-variables |
leaf | Scoped string variables, compose (last-wins), ${…} interpolate, variables.json I/O |
field-features |
leaf | Feature flag IDs, defaults, and in-memory registry |
field-settings |
leaf | Shared settings.json schema and load/save (no GPUI) |
field-audio-model |
leaf | PcmBuffer, regions, markers, MediaId / descriptors, MediaPool / MediaStore, BlockPager / BlockSource |
field-audio-io |
leaf | Probe/decode/encode above Symphonia and format encoders; source metadata → variables; tagged encode |
field-audio-process |
mid | Offline peaks, resampling; future analysis/ops (SPEC-analysis.md) |
field-audio-monitor |
mid | Monitor chain Faust DSP, UI schema, lock-free params |
field-audio-playback |
mid | Realtime device I/O, transport, playhead |
field-ui-components |
mid | Reusable GPUI chrome; host-owned tab titles; data traits; Variables table; ${…} template completion |
field-composition |
high | .facomp I/O (v10), EDL, clip tree; re-exports CompositionId |
field-session |
high | .fasession I/O (v3) and membership; media|composition targets |
field-scripting |
high | Shared Lua 5.4 host (field.* + thin app); ScriptBackend / HeadlessWorld (README) |
field-batch |
app | Headless REPL / script runner / Unix shebang over field-scripting |
field-play |
app | Headless composition playback; init.lua + detect_layout for monitor chain |
FieldAssist |
app | Document editor, GPUI host bridge, docks, playback, Settings UI; embeds workflows |
field-scripting sits at the same layer as the app hosts: it may depend on
both field-session and field-composition. Its ScriptBackend trait lets
each host supply session/document/media storage. FieldAssist keeps GPUI-only
script bridges (access, theme, toolbar rendering) and binds host-only app
fields (name, theme, command, chrome flags). Settings schema lives in
field-settings; FieldAssist owns the Settings window only.
BlockSource(field-audio-model): pager asks for file ranges;field-audio-io::SymphoniaBlockSourceimplements it; composition wires the two.PlaybackDataProvider(field-audio-playback): engine pulls interleaved PCM; the app implements it forComposition/ buffers.MonitorProcess(field-audio-playback): engine runs listen DSP without depending on Faust;field-assistadaptsMonitorHost→MonitorProcess.WaveformDataProvider+WaveformEditor(field-ui-components): paint/read and selection/drag overlays;BufferDocumentimplements both. UI types useLaneScope/PaintRegion/u64edit ids; the app mapsChannelScope/Region/EditIdat the trait boundary.- List-panel data traits (
RegionsData,MarkersData,EditsData): snapshot + fingerprint for observe-and-skip; selection/navigation via callbacks so panels never nameWaveformDisplayor model id newtypes. - Monitor host surface (
MonitorSnapshot/ParamUiNode+ callbacks): Faust JSON andMonitorChainstay in the app (monitor_schemaadapter); the UI panel is Faust-free. FormatEncoder(field-audio-io): encode planar PCM; render orchestration stays above I/O.
FieldAssist imports field_ui_components at call sites. Do not re-export UI
crate types through the application.
- Tab titles are host-owned (
dock_titlesin FieldAssist). Pass title slices totool_dock_min_sizeand into panel constructors. - Transport and SessionStatusBar take play state /
FileStatusDTOs and host-supplied actions or callbacks. - Widgets that remain app-shaped (explorer, workspace shell, render sheet,
workflow bar, Faust→
ParamUiNodeandEditOp→card mappers) stay in FieldAssist.
Shared sample type is f32 (dasp::sample::Sample).
- Planar storage in the model, pager, Faust
compute, and waveform reads - Interleaved frames at the device callback and
PlaybackDataProvider::read_interleaved
Do not force pull-based dasp::signal::Signal through random-access DAW paths.
dasp::ring_buffer::{Fixed, Bounded} are useful for single-owner DSP
(delays, etc.). They are not used for the playback prefetch↔callback
boundary: push/pop need &mut self, so sharing them across threads would
require a mutex. field-audio-playback uses an atomic SPSC
PrefetchRing instead.
The CPAL output callback must stay realtime-safe. Quality gates (also in
crates/field-audio-playback/AGENTS.md):
- Zero heap allocation on the callback
- Zero blocking lock contention on the callback
- No decode / filesystem I/O on the callback
PlaybackEngine runs a dedicated fa-prefetch thread that may allocate, lock
the composition pager, and decode FLAC/etc. It pushes pre-monitor
device-rate interleaved source frames into the SPSC ring, using bandlimited
FFT sample-rate conversion when the source rate differs from the device rate
(matched rates copy bit-exactly). The CPAL callback pops those frames, runs
monitor DSP (Faust) or Direct channel mapping, and writes the device buffer so
live parameters track the audible playhead (not ring depth). Composition
read_interleaved uses planar pager fills (one lock per request) on that
prefetch thread. Direct bypasses Faust only — rate conversion still applies
whenever source and device rates differ.
Linux uses CPAL’s ALSA host. Output buffer size is chosen at stream open from
settings.json audio.buffer_size_frames (preferred listed frame sizes; not
guaranteed), or by negotiating from the device default when unset — prefer
about twice that default within CPAL’s supported range, then other in-range
catalog sizes, then platform Default. Negotiated results are not written back
to settings. Thread priority is CPAL’s realtime-dbus feature on eligible
workers (direct ALSA hardware, WASAPI); CoreAudio already runs its callback as
real-time. Buffer negotiation and scheduling stay off the callback.
field-batch: headless Lua (field.*) — REPL with no args, script file +app.args, Unix shebang (#!/usr/bin/env field-batch). Loadssettings.json(scripting apply), then userinit.luaelse the shared embedded default. Does not auto-load Add/Replace/Review (those stay FieldAssist-embedded).field-play:field-composition+field-audio-playback+field-audio-monitor+field-scripting— plays a composition on the preferred / default device (no session). Loadssettings.json(scripting + preferred output), then userinit.luaelse the shared embedded default, runsdetect_layoutonce after open, then uses the composition's monitoring chain when set (otherwise Direct).FieldAssist: desktop app (crates/field-assist). Applies settings from Rust before init; loads embedded workflows plus userresolver_*.lua/workflow_*.luaalong the scripting Search Path (Settings → Scripting).
cargo run -p field-batch -- --eval 'return app.name'
cargo run -p field-batch -- script.lua arg1
cargo run -p field-play -- path/to/project.facomp
cargo run -p field-play -- path/to/take.wavEvery library crate uses #![deny(missing_docs)], a crate-level overview with a
short example, and docs on public items. Generate with:
cargo doc --workspace --no-deps --open