#pragma once // InflectTTS: two-stage (encoder/decoder AXMODEL) VITS TTS pipeline. // // Scope note: the eSpeak text frontend is NOT part of the C++ SDK — the // caller supplies phoneme token ids (produced by the Python SDK frontend or // a board-side eSpeak-ng integration; see README). The full duration / // alignment / expansion / noise / chunking host chain IS implemented here. #include #include #include #include "ax_runner.h" class InflectTTS { public: InflectTTS(const std::string& encoder_path, const std::string& decoder_path); // token_ids: raw phoneme ids (NOT interspersed; blank 0 is inserted here, // mirroring commons.intersperse with add_blank=true). // speed in [0.5, 2.0], variation in [0.0, 1.0]. // Returns 24 kHz mono float32 samples in [-1, 1]. std::vector synthesize_tokens(const std::vector& token_ids, float speed = 1.0f, float variation = 0.667f, uint64_t seed = 0); private: AxRunner encoder_; AxRunner decoder_; // One Tp=512 decoder chunk: z_chunk channel-major [192 * kDecoderTp] // (zero right-padded) -> wav [kDecoderTp * 256]. std::vector run_decoder_chunk(const std::vector& z_chunk); };