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

Method run

src/framework/modules/hift_vocoder.cpp:710–737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

708 }
709
710 HiftVocoderOutput run(
711 const std::vector<float> & mel,
712 int64_t frames,
713 uint64_t seed,
714 uint64_t prior_noise_values,
715 const std::vector<float> * source_random_values) {
716 std::lock_guard<std::mutex> lock(mutex_);
717 const auto f0 = predict_f0_locked(mel, frames);
718 const int64_t scale = upsample_scale(weights_->config);
719 const auto f0_upsampled = nearest_upsample_f0(f0, frames, scale);
720 const auto source = make_sine_source(*weights_, f0_upsampled, seed, prior_noise_values, source_random_values);
721 std::vector<float> window;
722 int64_t stft_frames = 0;
723 const auto source_stft = source_stft_bct(*weights_, source, stft_frames, window);
724 if (backend_runner_ != nullptr && !backend_runner_->supports(*weights_, frames, stft_frames)) {
725 backend_runner_.reset();
726 }
727 if (backend_runner_ == nullptr) {
728 backend_runner_ = std::make_unique<BackendRunner>(*weights_, frames, stft_frames);
729 }
730 const auto post = backend_runner_->run(mel, frames, source_stft, stft_frames);
731 HiftVocoderOutput out;
732 out.waveform = waveform_from_post(*weights_, post, stft_frames, window);
733 out.batch = 1;
734 out.samples = static_cast<int64_t>(out.waveform.size());
735 out.sample_rate = weights_->config.sampling_rate;
736 return out;
737 }
738
739 void release_runtime_cache() {
740 std::lock_guard<std::mutex> lock(mutex_);

Callers

nothing calls this directly

Calls 9

upsample_scaleFunction · 0.85
nearest_upsample_f0Function · 0.85
make_sine_sourceFunction · 0.85
source_stft_bctFunction · 0.85
waveform_from_postFunction · 0.85
supportsMethod · 0.45
resetMethod · 0.45
runMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected