vibe code the initial impl

This commit is contained in:
2026-10-13 19:47:46 -05:00
parent 7da1c2119d
commit 7862a09858
39 changed files with 2867 additions and 157 deletions
+24
View File
@@ -0,0 +1,24 @@
// feature_params.h -- SINGLE SOURCE OF TRUTH for the audio feature pipeline.
//
// This file contains ONLY #define lines (plus comments and an include guard).
// tools/make_template.py parses it with a regex, so firmware and Python can
// never silently disagree. Keep every value a plain numeric literal.
//
// Band edges (implemented identically in fingerprint.c and make_template.py):
// f_b = F_MIN_HZ * (F_MAX_HZ / F_MIN_HZ) ^ (b / NUM_BANDS), b = 0..NUM_BANDS
// bin_b = floor(f_b * FRAME_LEN / FS_HZ + 0.5) (round half up, double math)
// if bin_b < bin_(b-1) + 1 then bin_b = bin_(b-1) + 1 (>= 1 bin per band)
// band b covers FFT bins [bin_b, bin_(b+1)). bin_NUM_BANDS must be <= FRAME_LEN/2.
#ifndef FEATURE_PARAMS_H
#define FEATURE_PARAMS_H
#define FS_HZ 16000 // sample rate of the whole pipeline
#define FRAME_LEN 1024 // samples per analysis frame (power of two)
#define HOP_LEN 512 // hop = 32 ms at 16 kHz
#define NUM_BANDS 32 // log-spaced bands in the fingerprint
#define F_MIN_HZ 100 // lower edge of band 0
#define F_MAX_HZ 7500 // nominal upper edge of the last band
#define LOG_EPS 1e-10f // added to band power before log (power is of samples scaled to +-1.0)
#define FP_DETREND 1 // 1: remove linear tilt across band index, 0: off
#endif