| 134 | } |
| 135 | |
| 136 | float DropDetector::getTrebleEnergy(const fft::Bins& fft) const { |
| 137 | // Treble = top 25% of bins (high frequencies) |
| 138 | int startBin = static_cast<int>(fft.raw().size() * 3 / 4); |
| 139 | float energy = 0.0f; |
| 140 | int count = 0; |
| 141 | |
| 142 | for (fl::size i = startBin; i < fft.raw().size(); i++) { |
| 143 | energy += fft.raw()[i]; |
| 144 | count++; |
| 145 | } |
| 146 | |
| 147 | return (count > 0) ? energy / static_cast<float>(count) : 0.0f; |
| 148 | } |
| 149 | |
| 150 | float DropDetector::calculateSpectralNovelty(float bass, float mid, float treble) const { |
| 151 | // Calculate how much the spectrum changed from previous frame |
no test coverage detected