Skip to main content

Module audio_spectral_sheet

Module audio_spectral_sheet 

Source
Expand description

Spectral-first audio truth layer — mmap sidecar headers + zero-heap hot views.

Cold path: STFT/CQT sheets under {storage}/spectral/audio/{hash}.bin. Hot path: fixed SPECTRAL_PREVIEW_BINS stack preview derived from Tensor10D.

Structs§

AudioSpectralSheetView
Zero-heap generative sheet view for U3 worklet / parametric DSP.
AudioSpectralSidecarHeader
Cold mmap header for STFT/CQT sidecars (frames follow as f32 raster).
SpectralV2SubHeader
Fixed 12-byte sub-header introducing the appended v2 planes. Sits immediately after plane-0 (header + frame_count × bin_count f32); followed by the mel plane (frame_count × n_mel f32) then the MFCC plane (frame_count × n_mfcc f32). All f32, row-major by frame.

Constants§

SIDECAR_KIND_CQT
SIDECAR_KIND_STFT
Sidecar transform kind stored in AudioSpectralSidecarHeader._pad.
SPECTRAL_PREVIEW_BINS
SPECTRAL_SIDECAR_MAGIC
SPECTRAL_V2_SUBHEADER_MAGIC
Magic for the v2 sub-header that precedes the mel/MFCC planes (“Q4M2”).

Functions§

bake_spectral_v2_from_samples
Bake a Q4AU-v2 sidecar from REAL audio samples.
copy_sidecar_frame_to_preview_bins
Copy one sidecar frame into a fixed preview bin array (hot U3 path, zero-heap).
parse_sidecar_header
Parse sidecar header from a byte slice (cold ingest / mmap pin).
parse_v2_subheader
Parse the v2 sub-header from a v2 sidecar (validates magic and counts).
preview_bins_from_tensor
Map 10D tensor channels to 64-bin spectral preview (stack only, no heap).
sidecar_frame_view
Frame column from mmap sidecar at frame_index (cold playback).
sidecar_mel_frame_view
Mel band vector for frame_index from a v2 sidecar (n_mel f32), or None if the file is not a valid v2 sidecar or the index/planes are out of range.
sidecar_mfcc_frame_view
MFCC coefficient vector for frame_index from a v2 sidecar (n_mfcc f32), or None if the file is not a valid v2 sidecar or the index/planes are out of range.
v2_sidecar_size
Total byte size of a Q4AU-v2 sidecar with the given geometry.