| 85 | if (frames <= 0) { |
| 86 | throw std::runtime_error("Vevo2 Coco tokenizer produced non-positive output frame count"); |
| 87 | } |
| 88 | return frames; |
| 89 | } |
| 90 | |
| 91 | double hz_to_octs(double frequency, double tuning, int64_t bins_per_octave) { |
| 92 | const double a440 = 440.0 * std::pow(2.0, tuning / static_cast<double>(bins_per_octave)); |
| 93 | return std::log2(frequency / (a440 / 16.0)); |
| 94 | } |
| 95 | |
| 96 | double parabolic_shift(const std::vector<float> & power, int64_t freq_bins, int64_t frames, int64_t freq, int64_t frame) { |
| 97 | if (freq <= 0 || freq >= freq_bins - 1) { |
| 98 | return 0.0; |
| 99 | } |
| 100 | const auto at = [&](int64_t f) { |
no test coverage detected