Skip to content

buzk: the unit's detector front end, its quadrature matrix read from the bundle - #138

Closed
RyanTheTide wants to merge 6 commits into
mainfrom
parity46/buzk-quadrature
Closed

RyanTheTide wants to merge 6 commits into
mainfrom
parity46/buzk-quadrature

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Brings the BuzzKill detector to the installed unit's law. It stacks on #136 (no FIR), so merge that first.

  • Front end. The analysis stream is 2·linked, then a 2nd-order Butterworth low-pass at the operation limit, then phase-zero 4:1 decimation, then the amplitude-record cascade. That cascade is the second output of the unit's two-output quadrature matrix.
  • Cell threshold. A cell's threshold is the Kill-shaped curve's minimum over the cell's span.
  • Cell record. Every over-threshold cell deepens the record: m in its own cell, sqrt(m) in its neighbours. Candidates are taken by released cell gain. A duplicate line (within 1/20 octave) moves no second track.

No values in this repository. The matrix is a table inside the Mac's own AudioDSP. The installer finds it by structure alone (aurora-installer#119) and writes it into the tuning bundle as buzzkill-quadrature.bin. Here, buzzmatrix.rs re-checks those bytes with the same structural rule and hands the compiler the cascade. A bundle without a valid matrix compiles no Buzz box. SGV2_BUZZKILL_MATRIX supplies a matrix to rigs and the parity gate when they run on raw tuning trees. All tests use synthetic sections.

Black-box against the installed 25G83 unit, using that Mac's own matrix:

  • AID19 at 125 Hz from silence: onset within 0.3 dB, steady state within 0.03 dB.
  • AID6 steady tones from 125 Hz to 2 kHz: within 0.08 dB.

gate2 against the no-FIR baseline: failing cells drop from 278 to 257, with no new regressions above macOS.

Parity. Re-attested for all four builds. Pass counts are unchanged: 25C56 42/48, 25G72 50/56, 25G83 56/63, 26A428 51/57.

Checks. fmt, clippy -D warnings, workspace tests and no_std lv2 all pass.

Merge order. #136, then this PR, then aurora-installer#119, then a vendored refresh here. This is held for the v2 law freeze until #130 merges, and v2 will be merged in before it lands.

Assisted-by: LLM (Claude:Opus 5.5)

Brings the BuzzKill detector to the installed unit's law (Daybreak
t-5952 behaviour facts, t-5993 structural rule; no values):

- the 12 kHz stream keeps the first of every four low-passed samples and
  passes through the amplitude-record cascade, the second output of the
  unit's two-output quadrature matrix;
- the compared threshold of a cell is the Kill-shaped curve's minimum
  over the cell's span;
- every over-threshold cell deepens the cell record (m in its cell,
  sqrt(m) in its neighbours); candidates are taken by released cell gain,
  and a duplicate line moves no second track (this replaces the earlier
  black-box merge rule).

The matrix is a table in the Mac's own AudioDSP. The installer reads it
by structure into the tuning bundle (aurora-installer#119), and this
repository carries none of its values: the manifest's optional
buzzkill_quadrature record is parsed and the bytes re-checked with the
same structural rule (buzzmatrix.rs), Tuning carries the matrix, and the
compiler refuses a Buzz box without one. SGV2_BUZZKILL_MATRIX gives rigs
and the parity gate a matrix for raw tuning trees.

Black-box against the installed 25G83 unit (with this Mac's own matrix):
AID19 state, 125 Hz from silence, 10 ms onset within 0.3 dB and steady
within 0.03 dB; AID6 state, steady tones 125 Hz-2 kHz, Kill points on
and off, within 0.08 dB.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Re-attested with the matrix each Mac's own AudioDSP yields; pass counts
unchanged (25C56 42/48, 25G72 50/56, 25G83 56/63, 26A428 51/57).

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Law eb547fe5, verdicts unchanged (25C56 42/48, 25G72 50/56, 25G83 57/63,
26A428 51/57). Worst louder cell against the FIR-free law: AID2/6/12
+2.51 -> +0.81 dB, AID4 +3.18 -> +0.51, AID26 +2.51 -> +0.61, AID19
+0.57 -> +0.68 (tone_400_-12).

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
The analyser no longer lets the first decision boundary after reset pass
without a decision; the first complete block now produces the first
bank. On the deep-onset probes (input 30 dB above Threshold) the rms
error against the reference renders drops from -13.4/-13.7 dB to
-27.4/-29.3 dB (AID19 400 Hz / AID26 160 Hz), and AID26 25 dB above
Threshold from -26.6 to -30.6 dB. All other probe rows are unchanged.

The 46-AID gate is unchanged cell for cell. parity.json regenerated at
law 4eb1785c, verdicts unchanged (25C56 42/48, 25G72 50/56, 25G83
57/63, 26A428 51/57).

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
@niteria

niteria commented Nov 15, 2026

Copy link
Copy Markdown

aurora-silicon/aurora-installer#119 (merged 2026-11-13) adds a buzzkill_quadrature record to manifest.json whenever it finds the BuzzKill table in macOS's AudioDSP, which it did on 25G83, 25C56 and 26A428. v2's InstallerJson is deny_unknown_fields and only this PR knows the field, so v2 at 04169c4 refuses those bundles. On a J713 (AID37), where route 3 is the only way to get the lsm2 fill:

aurora-speaker-upgrade: check: acquire: pass: route 3 (aurora-speaker-tuning-j713.tar.gz)
aurora-speaker-upgrade: check: compile: refused: speakerguardd-provision: FAILED on j713 (7.3.0-air-m4-6df75691a12b); speakerguardd will not start and the speakers stay at the kernel's floor:
speakerguardd-provision:   - no usable speaker tuning bundle: manifest.json: not a schema-2 manifest: unknown field `buzzkill_quadrature`, expected one of `schema`, `kind`, … at line 6 column 23

The installer's own bundles come from the same writer (asahi_firmware/audio_tuning.py), so route 0 is affected for installs made since then. Downstream we accept the record and ignore it until this lands, with #[serde(default, rename = "buzzkill_quadrature")] _buzzkill_quadrature: Option<serde::de::IgnoredAny> in InstallerJson. manifest.rs is under the voicing law, so even that stopgap needs a re-attestation.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

A note from the field, since this PR is where the manifest field gets read.

Since aurora-installer a252d0eb (11-09), a speaker-tuning collection made on macOS carries buzzkill_quadrature in audio-tuning/manifest.json whenever AudioDSP has the matrix. The released speakerguardd-v2 (1.0.0alpha.1-41, pin 04169c4) and today's v2 head reject that field in the schema-2 parser:

no usable speaker tuning bundle: manifest.json: not a schema-2 manifest: unknown field `buzzkill_quadrature`, expected one of `schema`, ..., `lsm2_param_fill`

So aurora-speaker-upgrade --collection refuses any Mac collected with a current installer until this lands. Seen on an M4 Mac mini (J773g, AID36). Removing the record from the collection lets it compile.

Landing a parser that accepts the record before the detector front end is wired would unblock route 3 in the meantime: carry it and verify its sha256/size, without using it yet. That could be a small separate PR, if you'd rather keep this one whole.

🤖 Generated with Claude Code

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Follow-up to the note above: here is the scope and two stopgaps, so this PR can land whole with its re-gate.

Affected

  • Every speakerguardd-v2 release up to 1.0.0alpha.1-42 (RC9 pin bbd9ed3), and today's v2 head. All of them refuse a manifest that carries buzzkill_quadrature.
  • The collector that writes the record is the installer's Python collector (tools/speaker-tuning/collect-macos.sh and collect-linux) on main, since aurora-installer#119 merged on 2026-11-13. The native installer releases (Alpha 20 to 22) don't collect the matrix, so the bundles they install are fine.
  • What users see on a dual or legacy kernel: aurora-speaker-upgrade --collection refuses the switch, and the legacy protection keeps the speakers.
  • What users see on a v2-only kernel: a bundle installed with install-linux.sh stops provisioning, and the speakers stay at the kernel's floor (silent).
  • Macs with short lsm2 presets can only get their fill through this route, so they can't get v2 at all today.

Stopgaps, chosen so that nothing the voicing law hashes changes

When this PR lands with its re-gate:

  • flip COLLECT_BUZZKILL in the installer;
  • empty UNREAD_RECORDS in the upgrade tool, with the vendored refresh you already planned.

🤖 Generated with Claude Code

@RyanTheTide
RyanTheTide changed the base branch from v2 to main November 19, 2026 17:59
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Early note on this draft (no full review yet):

  1. crates/aurora-speaker-tuning/src/buzzmatrix.rs:64-73, src/bin/aurora-speaker-tuning.rs:436, :521, :610: the shipped aurora-speaker-tuning binary reads SGV2_BUZZKILL_MATRIX from the environment and uses it in place of the bundle's matrix. A production tool should take this value only from the machine's tuning bundle. Keep the override in the examples/rig tooling (or behind an explicit --buzzkill-matrix PATH option on a developer subcommand), and have the installed compile path read the bundle only, refusing the Buzz box when the bundle has no valid matrix, as it already does.
  2. Commit "buzk: the unit's detector front end, its matrix read from the bundle": the message cites internal task ids as the source of the behaviour. Describe the detector by the black-box measurements already in the PR body (onset/steady-state comparisons against the installed unit) and drop the task references from the public history.

Assisted-by: LLM (Claude:Opus 5.5)

erikwb pushed a commit to erikwb/speakerguardd that referenced this pull request Nov 22, 2026
Since aurora-installer#119 (2026-11-13) the installer's collector writes a
`buzzkill_quadrature` record, and buzzkill-quadrature.bin, into every
bundle whose AudioDSP holds the BuzzKill matrix. The tuning reader parses a
schema-2 manifest with deny_unknown_fields and does not read that record
yet (aurora-silicon#138 adds it), so every such bundle is refused whole:

  manifest.json: not a schema-2 manifest: unknown field `buzzkill_quadrature`

aurora-speaker-upgrade --collection then refuses the switch on any Mac
collected with a current collector (seen on a J713, AID37, and an M4 Mac
mini, J773g, AID36). The vendored collector predates the record: it keeps
the manifest unchanged but leaves out the file, so even a reader that knew
the key would refuse the bundle as incomplete.

Drop the records this speakerguardd does not read (UNREAD_RECORDS) and the
files they name before a bundle from any route is checked and stored, and
say so. The manifest is written again as the collector writes it (sorted
keys, two-space indent), so the stored bundle is the one the collector
writes without those records. A bundle without them is stored as before.
Nothing here is hashed by the voicing law, so the parity attestations stay
valid. Remove the entry once the tuning reader reads the record.

Signed-off-by: Diljit Singh <hey@djdev.me>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

This now conflicts with main, and the base it stacked on (#136) has merged, so it needs a rebase onto main with the parity attestations re-gated. The replacement commits should carry only the author's Signed-off-by: 26a9d52, 4cabe34, 758fe1f, 84edfa9 and 54c911c have an Assisted-by trailer in the commit message. The two points from the earlier note (no SGV2_BUZZKILL_MATRIX override in the installed binary, and no task ids in the commit message) are still open.

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent source review at 54c911c7a709. The detector front end is selected from a validated per-machine bundle. Confirm the missing or malformed matrix path cannot grant an unsafe mono-desktop lease. The J473 wider voicing validation must pass the protected-path attestation before the speaker can be recorded as working. Reuse the board's own bundle and keep actual measurements and trips in the test record.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

I compared the committed attestations for the J473's AID12 and the J413's AID13. For AID12, main after #243 (7c01759a) reports worst +2.509 / −3.670 dB on each of its four builds. This draft's 54c911c7 improves those to +0.812 / −3.151 dB on all four, with the verdict still refused. AID13 stays passing 4/4.

When this is rebased, please regenerate the intermediate slider attestations alongside the full-scale rows. Main records all three sliders on three releases for these AIDs, while the current draft's records contain no slider rows. The J473's latest silent self-check used a 26B123 bundle and refused voicing against the available 25G83 reference after the mono sense-switch check passed.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Rebased onto main with the review points addressed in #244 (draft). It replaces this PR and includes this PR's change as one commit, authorship unchanged. Changes on top: the installed binary takes the matrix only from the bundle, or from an explicit --buzzkill-matrix with --tunings-root. The detector reads only the cells that end below the operation limit, which removes the -3.15/-5.77 dB 2500 Hz cell on AID2/6/12/26. All four builds were re-gated with slider rows; verdicts are unchanged. I'll leave this one open until #244 is decided.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Superseded by #244, now merged (80b0206). It carries this PR's detector rebased onto main, plus the review fix (the matrix comes only from the bundle or an explicit --buzzkill-matrix), the upper-edge cell fix and a same-line merge fix. Re-attested on all four builds.

@RyanTheTide
RyanTheTide deleted the parity46/buzk-quadrature branch November 27, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants