Returns the default Hann window function for the spectrogram.
| 28 | namespace { |
| 29 | // Returns the default Hann window function for the spectrogram. |
| 30 | void GetPeriodicHann(int window_length, std::vector<double>* window) { |
| 31 | // Some platforms don't have M_PI, so define a local constant here. |
| 32 | const double pi = std::atan(1.0) * 4.0; |
| 33 | window->resize(window_length); |
| 34 | for (int i = 0; i < window_length; ++i) { |
| 35 | (*window)[i] = 0.5 - 0.5 * cos((2.0 * pi * i) / window_length); |
| 36 | } |
| 37 | } |
| 38 | } // namespace |
| 39 | |
| 40 | bool Spectrogram::Initialize(int window_length, int step_length) { |
no test coverage detected