voice_audio_multi/include/engine/community_models/inflect_v2/runtime.h
Fabio c36510c21e
Some checks failed
Linux Build / Linux cpu (push) Has been cancelled
Linux Build / Linux cpu-clang (push) Has been cancelled
Linux Build / Linux vulkan (push) Has been cancelled
mac-build / macOS CPU (push) Has been cancelled
Nix Build / Nix (cpu) (push) Has been cancelled
Nix Build / Nix (vulkan) (push) Has been cancelled
windows-build / Windows CPU (push) Has been cancelled
Initial import: audio.cpp with Orange Pi documentation
2026-11-04 19:05:22 +01:00

43 lines
1.2 KiB
C++

#pragma once
#include "engine/community_models/inflect_v2/assets.h"
#include "engine/framework/runtime/session.h"
#include <memory>
#include <string>
#include <vector>
namespace engine::models::inflect_v2 {
struct InflectV2GenerationOptions {
float speaking_rate = 1.0F;
float variation = 0.667F;
uint32_t seed = 0;
};
class InflectV2VitsRuntime {
public:
// `rknn_decoder_path` selects the Rockchip NPU decoder sidecar (see
// engine/community_models/inflect_v2/rknn_decoder.h): the latent is then voiced by that
// engine instead of the ggml decoder graph, which is never built.
InflectV2VitsRuntime(
std::shared_ptr<const InflectV2Assets> assets,
core::BackendConfig backend_config,
std::string rknn_decoder_path = {});
~InflectV2VitsRuntime();
runtime::AudioBuffer synthesize(
const std::vector<int32_t> & token_ids,
const InflectV2GenerationOptions & options);
private:
struct State;
std::unique_ptr<State> state_;
};
void apply_inflect_v2_edge_fade(
std::vector<float> & samples,
int sample_rate,
float milliseconds = 5.0F);
} // namespace engine::models::inflect_v2