| 183 | } |
| 184 | |
| 185 | std::vector<float> next_diffusion_noise( |
| 186 | const std::vector<float> & noise_file_values, |
| 187 | size_t & noise_file_offset, |
| 188 | size_t count, |
| 189 | uint32_t seed, |
| 190 | uint64_t & rng_index, |
| 191 | sampling::TorchRandnPrecision precision) { |
| 192 | if (!noise_file_values.empty()) { |
| 193 | if (noise_file_offset + count > noise_file_values.size()) { |
| 194 | throw std::runtime_error("VibeVoice diffusion noise file ran out of values"); |
| 195 | } |
| 196 | std::vector<float> out( |
| 197 | noise_file_values.begin() + static_cast<std::ptrdiff_t>(noise_file_offset), |
| 198 | noise_file_values.begin() + static_cast<std::ptrdiff_t>(noise_file_offset + count)); |
| 199 | noise_file_offset += count; |
| 200 | return out; |
| 201 | } |
| 202 | auto out = engine::sampling::generate_torch_cuda_randn( |
| 203 | count, |
| 204 | seed, |
| 205 | precision, |
| 206 | rng_index); |
| 207 | rng_index += static_cast<uint64_t>(count); |
| 208 | return out; |
| 209 | } |
| 210 | |
| 211 | void append_audio(std::vector<float> & output, const runtime::AudioBuffer & chunk) { |
| 212 | if (chunk.sample_rate != 24000 || chunk.channels != 1) { |
no test coverage detected