this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

change gain to 2 to match FFT

alice aa6c946d a3d9a355

+18 -9
+16 -7
CLAUDE.md
··· 258 258 259 259 **Test Results**: Basic API working, visualization shows 10 octaves with test data mapping 260 260 261 - #### Phase 2: Real CQT Processing (DEBUGGING) 261 + #### Phase 2: Real CQT Processing (COMPLETE) 262 262 1. ✓ **Access raw audio buffer** from FFT capture system 263 263 2. ✓ **Implement 4096-point FFT** for CQT (separate from main FFT) 264 264 3. ✓ **Apply CQT kernels** to FFT output 265 265 4. ✓ **Fix kernel initialization** - kernels are properly generated on startup 266 - 5. **Add remaining API functions**: `cqts()`, `cqto()`, `cqtos()` (TODO) 267 - 6. **Create comparison demo** showing FFT vs CQT side-by-side (TODO) 266 + 5. ✓ **Debug and fix frequency mapping** - CQT now correctly detects frequencies 267 + 6. **Add remaining API functions**: `cqts()`, `cqto()`, `cqtos()` (TODO) 268 + 7. **Create comparison demo** showing FFT vs CQT side-by-side (TODO) 268 269 269 270 **TEMPORARY CHANGE**: FFT_SIZE has been changed from 1024 to 2048 in fftdata.h to support CQT's 4096-point FFT requirement. This temporarily breaks FFT resolution (now 2048 bins instead of 1024) but allows CQT to function properly. This should be reverted once a separate audio buffer is implemented for CQT. 270 271 ··· 363 364 - NO scaling factor after FFT 364 365 - Proper phase calculation: `2π * (f/fs) * (idx - N/2)` 365 366 366 - #### Phase 3: Optimization (If needed) 367 - 1. Profile and identify bottlenecks 368 - 2. Implement sparse kernel optimizations 369 - 3. Consider frame-skipping for lower-end hardware 367 + **Final Status**: 368 + - CQT correctly detects frequencies (440 Hz → bin 54) 369 + - Good frequency selectivity (minimal spreading) 370 + - Kernels properly bandpass filtered 371 + - 20 Hz start preserved for electronic music sub-bass 372 + - Created test_cqt_spectrum_v2.lua with correct note display 373 + 374 + #### Phase 3: Next Steps 375 + 1. Add remaining API functions: `cqts()`, `cqto()`, `cqtos()` 376 + 2. Create separate audio buffer for CQT (restore FFT_SIZE to 1024) 377 + 3. Create FFT vs CQT comparison demo 378 + 4. Performance optimization if needed 370 379 371 380 ### Test Script Example 372 381 ```lua
+1 -1
src/cqtdata.h
··· 7 7 #define CQT_FFT_SIZE 4096 // Larger FFT for better sub-bass resolution 8 8 9 9 // CQT frequency range 10 - #define CQT_MIN_FREQ 20.0f // Below piano's lowest A 10 + #define CQT_MIN_FREQ 20.0f // Sub-bass for electronic music 11 11 #define CQT_MAX_FREQ 20480.0f // Nearest note to 20kHz 12 12 13 13 // Smoothing parameters
+1 -1
src/ext/cqt.c
··· 119 119 } 120 120 121 121 // Calculate magnitude with gain boost 122 - cqtData[bin] = sqrt(real * real + imag * imag) * 4.0f; // Increased gain boost 122 + cqtData[bin] = sqrt(real * real + imag * imag) * 2.0f; // Match FFT gain factor 123 123 124 124 // Check for NaN or Inf 125 125 if (!isfinite(cqtData[bin]))