MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / make_triangular_overlap_window

Function make_triangular_overlap_window

src/framework/audio/chunking.cpp:306–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304 split = (search_start + search_end) / 2;
305 } else {
306 float min_energy = std::numeric_limits<float>::infinity();
307 const int64_t upper = search_end - search_start - options.min_energy_window_samples;
308 for (int64_t i = 0; i < upper; i += options.min_energy_window_samples) {
309 double sum = 0.0;
310 for (int64_t j = 0; j < options.min_energy_window_samples; ++j) {
311 const float value = mono_samples[static_cast<size_t>(search_start + i + j)];
312 sum += static_cast<double>(value) * static_cast<double>(value);
313 }
314 const float energy =
315 std::sqrt(static_cast<float>(sum / static_cast<double>(options.min_energy_window_samples)));
316 if (energy < min_energy) {
317 min_energy = energy;
318 split = search_start + i;
319 }
320 }
321 }
322 }
323 split = std::max<int64_t>(index + 1, std::min<int64_t>(split, total));
324 chunks.push_back({index, split});
325 index = split;

Callers 1

HTDemucsSessionMethod · 0.85

Calls 3

require_positiveFunction · 0.70
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected