voice_audio_multi/include/engine/models/seed_vc/content_features.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

47 lines
1.3 KiB
C++

#pragma once
#include "engine/framework/modules/speech_encoders/wav2vec2_encoder.h"
#include "engine/models/seed_vc/astral_quantizer.h"
#include <cstdint>
#include <vector>
namespace engine::models::seed_vc {
enum class SeedVcContentFeatureKind {
Wide,
Narrow,
};
std::vector<float> seed_vc_wav2vec2_normalize_16k(const std::vector<float> & waveform);
struct SeedVcContentFeatureOutput {
std::vector<int32_t> indices;
int64_t batch = 0;
int64_t tokens = 0;
int64_t codebook_size = 0;
};
class SeedVcContentFeatureExtractor {
public:
SeedVcContentFeatureExtractor() = default;
SeedVcContentFeatureExtractor(
const engine::modules::Wav2Vec2EncoderRuntime * hubert,
const SeedVcAstralQuantizer * wide_quantizer,
const SeedVcAstralQuantizer * narrow_quantizer);
SeedVcContentFeatureOutput extract_16k_mono(
const std::vector<float> & waveform,
SeedVcContentFeatureKind kind) const;
private:
SeedVcContentFeatureOutput extract_chunk_16k_mono(
const std::vector<float> & waveform,
SeedVcContentFeatureKind kind) const;
const engine::modules::Wav2Vec2EncoderRuntime * hubert_ = nullptr;
const SeedVcAstralQuantizer * wide_quantizer_ = nullptr;
const SeedVcAstralQuantizer * narrow_quantizer_ = nullptr;
};
} // namespace engine::models::seed_vc