nx_audio_scene_quality.nx
buildroot/runtime/nx_audio_scene_quality.nx
about
nx_audio_scene_quality.nx -- audio-scene quality grader.
Per honest audit 2026-05-16: visual graders dominate; sound design
is graded only via the layer's FFT primitives, not composed. This
primitive grades a soundscape on 5 axes (Elder AI sound-grader
parallel).
Inputs: caller provides
- spectral_bins: caller-computed FFT magnitudes (8 octave bands;
bin[0] = sub-bass ... bin[7] = brilliance)
- rms_window: a per-time-frame RMS energy array (for dynamic range)
- n_sources: count of distinct sound sources playing
- n_frames: temporal frame count for the rms_window
AXES (Q14 [0, Q]; higher = better):
0. FREQUENCY_BALANCE: stddev of spectral bins; healthy mix has
moderate stddev (not flat, not extreme). Bell band [0.15Q, 0.4Q].
1. DYNAMIC_RANGE: max(rms) / mean(rms). Target [2x, 8x]. Squashed
audio (compression) scores low.
2. SPECTRAL_CENTROID_BALANCE: weighted average bin index / 8; target
band [0.3, 0.6] (not too dark, not too bright).
3. SOURCE_DIVERSITY: n_sources / target (8). Single-source scenes
are sparse; 4-8 sources score well.
4. TEMPORAL_SMOOTHNESS: penalise rms second-difference (catches
glitchy / clicky scenes); also penalise zero variance (catches
static drones).
EMITS LAYER_VERDICT (kind = NX_LAYER_KIND_AUDIO).
genealogy_id: theile_aes_1981_audio_dynamics + elder_ai_sound_grader_canon
lineage_id: nx_audio_scene_quality_5axis_v1
nx_safety_envelope:
intended_use: "Audio scene quality grader -- 5-axis verdict
(dynamics, balance, masking, intelligibility,
envelope) for substrate-emitted audio assets"
sil_target: SIL1 (quality grader, not deployed runtime)
asil_target: QM
dal_target: NONE
dependencies 3 imports · 1 importers
imports: nx_syscalls.nxnx_tier.nxnx_layer_verdict.nx
imported by: nx_actor_role_audio_grader.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 54 | const NX_AQ_Q: nx_int = 16384 |
| 56 | const NX_AQ_AXIS_FREQ_BALANCE: nx_int = 0 |
| 57 | const NX_AQ_AXIS_DYNAMIC_RANGE: nx_int = 1 |
| 58 | const NX_AQ_AXIS_SPECTRAL_CENTROID: nx_int = 2 |
| 59 | const NX_AQ_AXIS_SOURCE_DIVERSITY: nx_int = 3 |
| 60 | const NX_AQ_AXIS_TEMPORAL_SMOOTH: nx_int = 4 |
| 61 | const NX_AQ_AXIS_COUNT: nx_int = 5 |
functions
| 63 | func _aq_band_score(val: nx_int, lo_q: nx_int, hi_q: nx_int) -> nx_int |
| 81 | func _aq_freq_balance_q14(bins: *i64, n_bins: nx_int) -> nx_int |
| 113 | func _aq_dynamic_range_q14(rms: *i64, n_frames: nx_int) -> nx_int called by 1: nx_audio_scene_grade |
| 137 | func _aq_spectral_centroid_q14(bins: *i64, n_bins: nx_int) -> nx_int |
| 154 | func _aq_source_diversity_q14(n_sources: nx_int) -> nx_int |
| 163 | func _aq_temporal_smooth_q14(rms: *i64, n_frames: nx_int) -> nx_int |
| 206 | func nx_audio_scene_grade( |
| 228 | func main() -> i64 |