# SonicFuss 0.1 processing and measurement notes

All runtime files are local. There are no external fetches, analytics, server
uploads, cookies, service workers, storage databases or paid AI APIs. Browser
and hosting software can have their own logging; audio is not transmitted by
the app. Loaded buffers are released on replacement or page closure.

## Processing

- Native Web Audio decoding to the chosen 44.1/48 kHz context rate. Original
  compressed/source metadata is not inferred. Mono/stereo only.
- Source spectral energy proportions from low/high first-order splits guide
  small bass/body corrections. This is a conservative heuristic, not a learned
  mastering system or genre classification.
- Original RBJ-style biquad implementation: low shelf at 130 Hz, broad mid
  peak at 400 Hz and high shelf at 6.5 kHz. Character and strength modify tone;
  manual controls are additive. No stereo widening or time effects.
- Stereo-linked peak-envelope compressor with configurable attack/release,
  threshold and ratio. Compression amount scales the ratio between 1:1 and
  the chosen maximum. No auto makeup inside the compressor.
- Approximate programme-loudness-directed gain, bounded to avoid unrestrained
  amplification of noise. Strength affects the amount of this adjustment.
  Very quiet material can remain quiet; amber review is deliberate.
- Stereo-linked 5 ms future-window peak limiter and 80 ms release. Output
  indices remain aligned to input: the lookahead is obtained from offline
  data rather than adding leading delay. No deliberate hard clipping.
- Internal ceiling margin of 0.4 dB, followed by estimated intersample analysis
  and further attenuation if needed. This is NOT a certified true-peak limiter.
- Full output sample buffers are scanned after processing and again after
  PCM quantization, before a download is allowed.
- No reverbs/delays are added. Output frame count matches decoded input;
  no silence trimming or fades are automatically introduced. A mix ending
  abruptly at its final sample retains that boundary; IIR filter decay beyond
  the file boundary is not appended in this prototype. Test endings carefully.

## Analysis

Integrated loudness ESTIMATE: K-weighting using approximate high-shelf and
high-pass biquads, 400 ms blocks with 75% overlap, −70 absolute gate, −10 LU
relative gate. Standard-method reference: ITU-R BS.1770-5 Annex 1. The weighting
coefficients and boundary treatment are not independently certified; the UI
therefore labels the reading as an estimate. No EBU LRA value is claimed.

Intersample peak ESTIMATE: four-times interpolation with three fractional
phases, 16-tap windowed-sinc kernel, plus the original sample peaks. Candidate
screening reduces cost on quiet passages. This does not implement the exact
ITU Annex 2 filter and is not a certified dBTP meter. High-frequency cases can
differ from reference meters; a safety margin does not create a guarantee.

Dynamics: peak-to-RMS crest factor in dB across the full file. This is not a
musical-quality grade or a measurement of EBU loudness range.

Source markers: sample amplitude >=0.999 gives a red possible-source warning;
>=0.89125 gives amber. These are heuristics. Previously clipped audio can be
attenuated and evade them. Legitimate high samples can also trigger warnings.
Timestamp buttons select up to the first 20 separated near-full-scale events;
up to 8 are drawn on the waveform. The waveform is a 600-bin peak overview,
not a sample editor. Mono input displays one waveform.

Live meters show post-listening-gain sample peaks from native browser analyser
nodes. Export metrics describe the actual rendered/quantized audio, unaffected
by listening gain or comparison matching. Comparison matching attenuates both
versions to the lower estimated integrated loudness, with sample-safe preview
gain limits. Perceived loudness can still vary within the song.

## Readiness

Red blocks export on nonfinite samples or output peak-limit failure. Silence
and unchanged processing also block a misleading master download. Amber allows
listening review for heavy limiting, low crest factor, DC offset or quietness.
Green means implemented checks passed, not professional approval or guaranteed
codec/streaming compliance. Source warnings remain separate from output checks.
All changes to processing controls invalidate export until a new full render.

## PCM export

RIFF/WAVE, uncompressed little-endian signed PCM, mono or stereo, 16/24-bit,
actual decoded sample rate. TPDF dither is applied to nonzero samples during
float-to-integer quantization; exact zero remains zero. Dither uses a fixed
pseudo-random seed for reproducible tests. There is no noise shaping. Final
analysis reads the quantized values used in the WAV, not only pre-export floats.

## Scope limits and next acceptance work

Desktop <=5 minutes/100 MB; mobile <=2 minutes/40 MB. Browser decoding can
allocate memory before duration is known. These limits reduce but cannot
eliminate out-of-memory risk on low-memory devices. Decode cannot be forcibly
interrupted by Web Audio; Cancel invalidates its result. DSP/analysis/export
cancellation terminates the worker. After cancellation, rerender before export.

No real-browser QA, subjective listening session, cPanel deployment, mobile QA,
MP3 interoperability matrix or independent full-song loudness certification was
completed in this environment. Those are private-test/public-release gates.

References (method descriptions, not bundled runtime dependencies):
- https://www.itu.int/rec/R-REC-BS.1770-5-202311-I/
- https://www.w3.org/TR/audio-eq-cookbook/
- https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/decodeAudioData
