External code review on 2026-05-12 rated the codebase 4/10 across audio DSP, error typing, JS injection, env-var safety, ALSA parsing, and async logging. This commit lands the prognosis-level fixes plus three audit follow-ups. Audio/DSP: - StreamingResampler/rubato confirmed in the live capture path - regression test at 12 kHz (rms < 0.01, ~40 dB) catches naive decimation - near-Nyquist test at 9 kHz (rms < 0.05, ~26 dB) exercises transition band Core errors: - Other(String) removed; ProviderNotRegistered introduced - Io variant restructured as struct with kind/message/raw_os_error - FileNotFound display quotes paths - Configuration variant removed (unused) Core types: - ModelId, EngineName backed by Cow<'static, str>; const borrowed ctor - Megabytes::from_gb takes u64 (was f64) - AudioSamples::sample_rate is NonZeroU32; zero-rate defensive branch removed Capture: - /proc/asound/cards parsing rewritten as anchored regex (OnceLock) - regression test covers product names with embedded colons - monitor_pattern_detection test restored alongside the regex test - DEAD_SILENCE_FLOOR promoted to module-level with rationale - DEVICE_VALIDATION_MS, SILENCE_RMS_FLOOR documented with field-observation rationale - RMS validation loop made idiomatic - eprintln! migrated to tracing with structured fields and targets Tauri startup: - unsafe std::env::set_var removed; ensure_x11_on_wayland renamed to warn_if_x11_env_unset_on_wayland (launcher/wrapper owns env-var contract) - DB init + log prune + preferences load collapsed to one block_on - build_preferences_script rewrites JS injection from JSON.parse string to direct object literal plus malformed-JSON guard and unit tests - WebKitGTK microphone auto-grant logs warning at startup - tracing subscriber initialised at top of run() (warn,magnotia=info,... on stderr; honors RUST_LOG); previously eprintln→tracing migration was silent because no subscriber existed Filename counter: - RECORDING_COUNTER uses SeqCst Tests: cargo test --workspace --lib green (322 passed, 0 failed across 10 crates). Three independent audits (original cleanup → Wren → fresh Codex subagent) concur on no critical findings. Deferred to docs/superpowers/plans/2026-05-12-engine-slop-residuals.md: storage-layer typed errors, remaining eprintln→tracing sweep, capture actor-model refactor, property-based DSP testing, frontend/backend error boundary cleanup.
33 lines
975 B
TOML
33 lines
975 B
TOML
[package]
|
|
name = "magnotia-audio"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
description = "Audio capture (cpal), VAD, resampling (rubato), file decoding (symphonia), WAV I/O (hound) for Magnotia"
|
|
|
|
[dependencies]
|
|
magnotia-core = { path = "../core" }
|
|
|
|
# Microphone capture
|
|
cpal = "0.17"
|
|
|
|
# Voice activity detection — deferred until ort version conflict between
|
|
# VAD crates (ort rc.10) and transcribe-rs (ort rc.12) is resolved upstream.
|
|
# silero-vad-rust = { version = "6", default-features = false }
|
|
|
|
# High-quality resampling (sinc interpolation)
|
|
rubato = "0.15"
|
|
|
|
# WAV file I/O
|
|
hound = "3.5"
|
|
|
|
# Audio file decoding (mp3, aac, flac, wav, ogg, etc.)
|
|
symphonia = { version = "0.5", features = ["mp3", "aac", "flac", "pcm", "vorbis", "wav", "ogg", "isomp4"] }
|
|
|
|
# Async runtime for threading
|
|
tokio = { version = "1", features = ["rt", "sync"] }
|
|
|
|
# Serde for DeviceInfo (returned across the Tauri boundary)
|
|
serde = { version = "1", features = ["derive"] }
|
|
tracing = "0.1"
|
|
regex = "1"
|