File spectral_core.h
FileList > inc > spectral > spectral_core.h
Go to the source code of this file
Spectral module — public C API.
#include "clib_common.h"
Public Functions
| Type | Name |
|---|---|
| void | hann_window (float * w, size_t w_len) Fill w with a Hann window of lengthw_len . |
| float | kaiser_enbw (const float * w, size_t w_len) |
| void | kaiser_window (float * w, size_t w_len, float beta) |
| void | magnitude_db_cf32 (const float _Complex * in, size_t n, float * out, float lin_floor, float offset_db) Convert a CF32 spectrum to F32 dB, bin by bin. |
| void | magnitude_db_cf64 (const double _Complex * in, size_t n, float * out, double lin_floor, float offset_db) Convert a CF64 spectrum to F32 dB, bin by bin. |
Public Functions Documentation
function hann_window
Fill w with a Hann window of lengthw_len .
void hann_window (
float * w,
size_t w_len
)
w[k] = 0.5 * (1 - cos(2π k / (N-1))), k = 0..N-1
Peak side-lobe −31.5 dB, ENBW = 1.5 bins. Zero-parameter alternative to Kaiser when moderate rejection is sufficient.
Parameters:
wOutput buffer, lengthw_len.w_lenWindow length ≥ 1.
function kaiser_enbw
float kaiser_enbw (
const float * w,
size_t w_len
)
function kaiser_window
void kaiser_window (
float * w,
size_t w_len,
float beta
)
function magnitude_db_cf32
Convert a CF32 spectrum to F32 dB, bin by bin.
void magnitude_db_cf32 (
const float _Complex * in,
size_t n,
float * out,
float lin_floor,
float offset_db
)
out[k] = 20*log10(max(|in[k]|, lin_floor)) + offset_db
Avoids per-call Python overhead on the hot FFT→display path.
Parameters:
inCF32 spectrum, lengthn.nNumber of bins.outF32 output, lengthn.lin_floorAmplitude floor before log10 (e.g. 1e-12f).offset_dbCalibration/level offset added to every bin.
function magnitude_db_cf64
Convert a CF64 spectrum to F32 dB, bin by bin.
void magnitude_db_cf64 (
const double _Complex * in,
size_t n,
float * out,
double lin_floor,
float offset_db
)
Same as magnitude_db_cf32() but accepts double-precision input. Output is F32 (sufficient for display).
Parameters:
inCF64 spectrum, lengthn.nNumber of bins.outF32 output, lengthn.lin_floorAmplitude floor before log10 (e.g. 1e-12).offset_dbCalibration/level offset added to every bin.
The documentation for this class was generated from the following file native/inc/spectral/spectral_core.h