Generate synthetic FFT bin data with a peak at specified frequency. Uses linear bin spacing (for use with FrequencyBinMapper and raw FFT data). @param numBins Number of frequency bins @param peakFrequency Frequency where the peak should occur (Hz) @param sampleRate Sample rate in Hz @return Vector of float magnitudes (one per bin)
| 155 | /// @param sampleRate Sample rate in Hz |
| 156 | /// @return Vector of float magnitudes (one per bin) |
| 157 | inline vector<float> generateSyntheticFFT(size numBins, float peakFrequency, u32 sampleRate) { |
| 158 | vector<float> bins; |
| 159 | bins.reserve(numBins); |
| 160 | float binWidth = sampleRate / (2.0f * numBins); |
| 161 | for (size i = 0; i < numBins; ++i) { |
| 162 | float binFreq = i * binWidth; |
| 163 | // Gaussian-like peak centered at peakFrequency |
| 164 | float distance = fl::abs(binFreq - peakFrequency) / binWidth; |
| 165 | float magnitude = fl::exp(-distance * distance / 2.0f); |
| 166 | bins.push_back(magnitude); |
| 167 | } |
| 168 | return bins; |
| 169 | } |
| 170 | |
| 171 | /// Generate synthetic CQ-spaced FFT bin data with a peak at specified frequency. |
| 172 | /// Uses CQ log-spaced frequency layout matching the actual CQ kernel. |
no test coverage detected