fix(decode): the mic dB offset is 81.938216, fitted on every count Blastware printed
The 81.9384 offset came from a window fitted on histogram intervals, [81.9383, 81.9385], which was too high. Every count Blastware printed in DL2 -- 1,704 in waveform sample tables, 520 in histogram intervals, 494 histogram peaks -- leaves [81.9382058, 81.9382266]: count 129 (124.2) bounds it from below, 463 (135.2; 81.9384 prints 135.3) and 677 (138.5) from above. One offset serves all three printing paths; no count prints two ways once range-1 mics and psi-formatted tables are set aside. Fixes the mic samples and peaks that sat one digit off at a rounding edge. The old window's comment is kept, retracted in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
This commit is contained in:
1 parent
e25784d9db
commit
e21d23a3f2
2 files changed
+21
-3
No files matched your search
@@ -640,16 +640,21 @@ MIC_PA_PER_COUNT = 0.25
|
||||
# 124.2, and the 81.94 first fitted to a handful of values misses counts 119
|
||||
# and 132. Its display chain presumably carries rounded constants; the
|
||||
# window, not the physics, is what is measured.
|
||||
_MIC_DB_REF = 81.9384
|
||||
# ⚠ CORRECTED 2026-11-09: that window was too high. Every count Blastware
|
||||
# printed in DL2 -- 1,704 in waveform sample tables, 520 in histogram
|
||||
# intervals, 494 histogram peaks -- leaves [81.9382058, 81.9382266]: count
|
||||
# 129 (124.2) bounds it from below, 463 (135.2, which 81.9384 prints 135.3)
|
||||
# and 677 (138.5) from above. One offset serves all three.
|
||||
_MIC_DB_REF = 81.938216
|
||||
|
||||
|
||||
def mic_count_to_db(count: int) -> float:
|
||||
"""Convert a MicL ADC count to dB(L) for BW-display-compatible output.
|
||||
|
||||
dB = sign(count) × (81.9384 + 20 × log10(|count|)) for |count| ≥ 1
|
||||
dB = sign(count) × (81.938216 + 20 × log10(|count|)) for |count| ≥ 1
|
||||
dB = 0.0 for count == 0
|
||||
|
||||
81.9384 ≈ 20 log10(0.25 Pa / 20 µPa); see _MIC_DB_REF.
|
||||
81.938216 ≈ 20 log10(0.25 Pa / 20 µPa); see _MIC_DB_REF.
|
||||
count=±1 → ±81.94 dB; count=813 → 140.14 dB (the V70 fixture).
|
||||
"""
|
||||
if count == 0:
|
||||
|
||||
@@ -512,6 +512,19 @@ def test_mic_count_to_db_v70_peak():
|
||||
assert abs(mic_count_to_db(-813) - (-140.14)) < 0.1
|
||||
|
||||
|
||||
@pytest.mark.parametrize("count,printed", [
|
||||
# Blastware's dB offset is pinned to [81.9382058, 81.9382266] by every DL2
|
||||
# count it printed -- 1,704 in sample tables, 520 in histogram intervals,
|
||||
# 494 histogram peaks (2026-11-09). These three counts bound it:
|
||||
(129, "124.2"), # from below: the physical 81.93820 prints 124.1
|
||||
(463, "135.2"), # from above in intervals and peaks: 81.9384 prints 135.3
|
||||
(677, "138.5"), # from above in the sample tables
|
||||
])
|
||||
def test_mic_db_prints_as_blastware_at_its_rounding_edges(count, printed):
|
||||
from minimateplus.decode_check import matches_printed
|
||||
assert matches_printed(mic_count_to_db(count), printed), mic_count_to_db(count)
|
||||
|
||||
|
||||
# ── End-to-end: decode_a5_frames (production entry point) ───────────────────
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user