Skip to main content

Crate secs_engine

Crate secs_engine 

Source
Expand description

The correction design of SECS 2, translated function by function.

Upstream sources: correction_engine.py, the compute half of calibration.py, mimo.py, mimo_iir.py, scorecard.py.

The interface is one call: measurements, settings, tuning and a compute context in, an immutable result out. Internally the work is cut into deep modules (docs/ARCHITECTURE.md, “Engine”):

  • measurement: the one time-axis convention (earliest arrival at the main position is zero, lift, shift), windows, a proper low-rate projection for MIMO.
  • target: target curve and level reference, evaluated once per grid.
  • filters: RBJ/LR/BW/all-pass responses and the single PEQ fitter with named limit bundles (RC, sub bus, bundle, XO, MIMO path).
  • ba: bass alignment (auto, fixed, bundles, DBA and multi-sub layouts, infra sub, two-way level match, bus level, bus PEQ, bus delay/polarity).
  • xo: crossover groups, XO target PEQ, the recommendation.
  • rc: per-channel room correction (magnitude design, common excess phase, FIR realisation ladder, PEQ refit, touch-up), Schroeder range.
  • decay: late-energy windows, mode T60, late peaks, “do no harm” guards.
  • chain: the DSP topology as one value; the response simulator here and the CamillaDSP writer in secs-camilla read the same value.
  • mimo: support planning, regularised ideal supports (the λ search of the ideal FIR goes through the RidgeBackend seam: CPU RidgeSweep here, CUDA f64 in secs-gpu, ADR 0008), IIR or FIR realisation (IIR always runs on the CPU).
  • scorecard: typed metrics before and after.

Engine knobs that SECS 2 hid in environment variables are fields of an explicit tuning value. Defects fixed on the way are listed in docs/DEVIATIONS.md.

Re-exports§

pub use export_view::ExportView;
pub use export_view::export_view;
pub use input::EngineConfig;
pub use input::Measurement;
pub use input::MeasurementSet;
pub use input::Samples;
pub use input::Tuning;
pub use mimo::IirDerivatives;
pub use mimo::IirSolveOptions;
pub use mimo::IirSolver;
pub use mimo::IirSupport;
pub use mimo::MimoDesign;
pub use mimo::MimoIir;
pub use mimo::MimoKey;
pub use mimo::MimoRequest;
pub use mimo::MimoRoleLateEnergy;
pub use mimo::MimoRoleScore;
pub use mimo::MimoRun;
pub use mimo::design_mimo;
pub use mimo::design_mimo_iir;
pub use mimo::design_mimo_iir_with_options;

Modules§

display
Display-only transforms from step5_measure.magnitude_db and the pre-run SPL preview.
export_view
Narrow derived state used by response exports.
grid
The design grid every full-resolution spectrum lives on.
input
What the engine is given: measurements and the resolved design settings.
mimo
Low-rate MIMO ideal FIR support design and do-no-harm guards.
polarity
Relative main-speaker polarity check (ADR 0033).
preview
BA display curves replayed from an immutable design, without fitting.
xo
Crossover recommendation from immutable designs and measured responses.

Structs§

BaRow
One sub’s BA row: upstream’s (gain dB, delay ms, polarity, all-passes).
Calibration
CalibrationRequest
Design
DesignReplay
What a design was made from. Sample buffers and prepared spectra are shared, never copied. Long-window spectra are computed on request, never cached.
DesignRequest
DesignSpectra
EngineInputs
FitRequest
One fit_peq call’s arguments. The grid and correction must have equal, nonzero length; frequencies, bounds and residuals must be finite and valid.
GuardCause
What the MIMO guard rejected last: the support level of that trial (3 dB above GuardReduced::gain_db, or −12 dB before GuardDisabled) and the guard values there that broke their 1 dB limits.
LayoutInfo
MainDesign
ManualPlan
Metrics
The 17 scalars, named as upstream’s keys. Percentages are on a 0–100 scale.
ProjectView
RoleLateEnergy
RoleScores
Spectra
Ordered cells; cloning copies only the Arc handles, never a spectrum.
StageResponses
SubDesign
SubFilter

Enums§

EngineError
Why a design cannot be computed. Messages are for logs; the service maps variants to user-facing error codes.
ExportAxis
Time origin for a REW export item. Corrected responses retain SECS 2’s latency subtraction (D24 is deliberately not changed here).
FitStage
MimoNote
Semantic diagnostics in producer order; never translated presentation text.
Note
PeqDerivatives
How PEQ fits differentiate their bands.

Constants§

MAX_RESAMPLE_RATE
MIN_RESAMPLE_RATE

Functions§

calibrate
Resolve, normalize and design with the context’s cancellable production fitters.
calibrate_with
The calibration entry point with caller-supplied fitters (oracle replay).
design
engine_inputs
fit_peq_with
fit_peq_until with a chosen derivative; TwoPoint is the same arithmetic.
input_response
late_energy
Late energy on the same per-position responses used by the scorecard at the main position and by the mdat’s before/after items elsewhere: the 2 s export view, which MIMO also starts from. The fitting spectra (spectra.used) are not used; their late tail differs from those items by up to about 1 dB. Rows are position major, with main roles in chain order.
long_spectra
long_spectra_until without cancellation.
normalize_measurements
Convert non-48 kHz IRs only when explicitly selected.
production_fitters
production_fitters_with
stage_responses
Replays upstream’s internal axis without changing the design’s spectra. Supplied spectra already contain fixed and generated bundle sub filters, as do upstream’s long_spectra results.

Type Aliases§

C
Complex spectrum value.
Fitter
Production uses fit_peq; stage goldens inject recorded decisions here. Callers may reuse the result of an identical request across candidates.
FitterFactory