| 468 | return {}; |
| 469 | } |
| 470 | const int64_t count = std::min<int64_t>(tail, static_cast<int64_t>(wave.size())); |
| 471 | return std::vector<float>(wave.end() - static_cast<std::ptrdiff_t>(count), wave.end()); |
| 472 | } |
| 473 | |
| 474 | void append_wave(std::vector<float> & output, const std::vector<float> & chunk) { |
| 475 | output.insert(output.end(), chunk.begin(), chunk.end()); |
| 476 | } |
| 477 | |
| 478 | std::vector<float> synthesize_bigvgan_fixed_chunks( |
| 479 | const engine::modules::BigVganVocoderComponent & bigvgan, |
| 480 | const std::vector<float> & mel, |
| 481 | int64_t frames, |
| 482 | int64_t hop_size, |
| 483 | int64_t active_frames, |
| 484 | int64_t overlap_frames) { |
| 485 | const int64_t channels = bigvgan.num_mels(); |
| 486 | if (frames <= 0 || channels <= 0 || hop_size <= 0 || active_frames <= 0 || overlap_frames < 0 || |
| 487 | static_cast<int64_t>(mel.size()) != channels * frames) { |
| 488 | throw std::runtime_error("Seed-VC BigVGAN fixed chunk synthesis received invalid dimensions"); |
| 489 | } |
| 490 | const int64_t graph_frames = active_frames + 2 * overlap_frames; |
| 491 | if (graph_frames < active_frames) { |
no test coverage detected