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

Function next_diffusion_noise

src/models/vibevoice/generator.cpp:185–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185std::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
211void append_audio(std::vector<float> & output, const runtime::AudioBuffer & chunk) {
212 if (chunk.sample_rate != 24000 || chunk.channels != 1) {

Callers 2

generate_vibevoiceFunction · 0.85
generate_vibevoice_batchFunction · 0.85

Calls 4

emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected