Expand description
FFT-based frequency analysis for recorded signals
This module provides functions to analyze recorded audio signals and extract:
- Frequency spectrum (magnitude in dBFS)
- Phase spectrum (compensated for latency)
- Latency estimation via cross-correlation
- Microphone compensation for calibrated measurements
- Standalone WAV buffer analysis (wav2csv functionality)
Structs§
- Analysis
Result - Result of FFT analysis
- Cross
Correlation Envelope Result - Result of cross-correlation with analytic envelope detection.
- Microphone
Compensation - Microphone compensation data (frequency response correction)
- WavAnalysis
Config - Configuration for standalone WAV buffer analysis
- WavAnalysis
Output - Result of standalone WAV buffer analysis
- Windowed
Frequency Response - Frequency responses computed from different time windows of an impulse response.
Functions§
- analyze_
recording - Analyze a recorded WAV file against a reference signal
- analyze_
wav_ buffer - Analyze a buffer of audio samples and return frequency response
- analyze_
wav_ file - Analyze a WAV file and return frequency response
- compute_
average_ response - Compute a log-frequency weighted reference response level in dB.
- compute_
clarity_ broadband - Compute Clarity (C50, C80) from Impulse Response (Broadband) Returns (C50_dB, C80_dB)
- compute_
clarity_ spectrum - Compute Clarity spectrum (C50, C80) using octave band filtering Returns (C50_vec, C80_vec)
- compute_
coherence_ from_ realizations - Magnitude-squared coherence γ²(f) across N complex spectra that
should be measurements of the same deterministic transfer
function. Per
docs/gd_opt_v2_plan.md§2.2: - compute_
group_ delay - Compute group delay from phase data Group delay = -d(phase)/d(frequency) / (2*pi)
- compute_
impulse_ response_ from_ fr - Compute impulse response from frequency response via inverse FFT.
- compute_
rt60_ broadband - Compute RT60 from Impulse Response (Broadband) Uses T20 (-5dB to -25dB) extrapolation
- compute_
rt60_ spectrum - Compute RT60 spectrum using octave band filtering
- compute_
spectrogram - Compute Spectrogram from Impulse Response
Returns (spectrogram_matrix_db, frequency_bins, time_bins)
window_sizesamples (e.g. 512),hop_sizesamples (e.g. 128). - compute_
windowed_ fr - Compute frequency responses for different time windows of the impulse response.
- cross_
correlate_ envelope - Cross-correlate a probe with a recording and compute the analytic envelope.
- deconvolve_
sweep - Deconvolve a single recorded log sweep by dividing the recording’s
spectrum by the emitted sweep’s spectrum, producing a complex
frequency response on the FFT grid
[0, Nyquist]. - estimate_
noise_ floor_ db_ from_ silence - Estimate per-bin noise floor in dB from a silence window.
- find_
db_ point - Find a frequency point where the magnitude reaches a specific dB level
- plan_
fft_ forward - Get a cached forward FFT plan for the given size (f32).
- plan_
fft_ inverse - Get a cached inverse FFT plan for the given size (f32).
- read_
analysis_ csv - Read analysis results from CSV file
- smooth_
response_ f32 - Apply octave smoothing to frequency response data (f32 version)
- smooth_
response_ f64 - Apply octave smoothing to frequency response data (f64 version)
- write_
analysis_ csv - Write analysis results to CSV file with optional microphone compensation
- write_
wav_ analysis_ csv - Write WAV analysis result to CSV file