SpectrumAnalyzer
Causal, sample-timed audio analysis with per-channel power and one shared display gain.
Feed sanitised or borrowed interleaved samples from one analysis thread. Short spectra use a Hann window, per-channel power averaging and fractional ERB integration. Programme loudness uses an independently timed 400 ms K-weighted channel sum. All energy display drivers share its bounded causal or fixed-song reference and their fast/slow envelopes advance in media time. Mono mixing is only for the decorative scope; opposite channel polarities retain their energy.
Each analysis publishes new snapshot storage. Readers may retain an old frame while analysis continues. The recognition helpers are separate from the calibrated power and display paths.
Constructors
Properties
The newest analysis. Read it from the drawing thread as often as you like.
Called for every analysis, on the feeding thread, before latest changes.
Number of non-finite or beyond-headroom samples sanitised by direct PCM input.
Functions
PCM with explicit layout metadata. Its sample rate must match this analyser. Reset before changing channels or layout; a different sample rate needs a new analyser. Inputs are floats regardless of AudioFormat.sampleFormat. Non-finite values become zero and finite values are limited to amplitude +/-16, with each change counted in sanitizedSamples.
Drops carried values and advances local continuity. Pair with SpectrumTimeline.clear.
Resets into an explicitly supplied timeline identity. Call on the feeding thread, then publish into a timeline with matching SpectrumTimeline.generation and SpectrumTimeline.revision. This does not itself reset that timeline.
A complete-song reference in linear K-weighted programme power. Positive finite values transition the one shared gain over two media seconds. Null resumes the causal reference. Call on the feeding thread. Reset retains this value for seeks; clear it for another song.