Generate synthetic CQ-spaced FFT bin data with a peak at specified frequency. Uses CQ log-spaced frequency layout matching the actual CQ kernel. @param numBins Number of CQ bins @param peakFrequency Frequency where the peak should occur (Hz) @param fmin CQ minimum frequency @param fmax CQ maximum frequency @return Vector of float magnitudes (one per bin)
| 176 | /// @param fmax CQ maximum frequency |
| 177 | /// @return Vector of float magnitudes (one per bin) |
| 178 | inline vector<float> generateSyntheticCQFFT(size numBins, float peakFrequency, |
| 179 | float fmin = fft::Args::DefaultMinFrequency(), |
| 180 | float fmax = fft::Args::DefaultMaxFrequency()) { |
| 181 | vector<float> bins; |
| 182 | bins.reserve(numBins); |
| 183 | int bands = static_cast<int>(numBins); |
| 184 | float logRatio = fl::logf(fmax / fmin); |
| 185 | for (size i = 0; i < numBins; ++i) { |
| 186 | float binFreq = fmin * fl::expf(logRatio * static_cast<float>(i) / static_cast<float>(bands - 1)); |
| 187 | // Gaussian-like peak in log-frequency space |
| 188 | float logDistance = fl::logf(binFreq / peakFrequency) / logRatio * static_cast<float>(bands); |
| 189 | float magnitude = fl::exp(-logDistance * logDistance / 2.0f); |
| 190 | bins.push_back(magnitude); |
| 191 | } |
| 192 | return bins; |
| 193 | } |
| 194 | |
| 195 | /// Generate uniform magnitude bins (all same value) |
| 196 | /// @param count Number of bins |