Download cpp/src/inflect_tts.h from AXERA-TECH/inflect_micro_v2: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/AXERA-TECH/inflect_micro_v2/resolve/main/cpp/src/inflect_tts.h
- Command line
-
hf download hf://AXERA-TECH/inflect_micro_v2/cpp/src/inflect_tts.h
-
curl -L -o inflect_tts.h https://huggingface.co/AXERA-TECH/inflect_micro_v2/resolve/main/cpp/src/inflect_tts.h
1.36 kB
| // 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. | |
| 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<float> synthesize_tokens(const std::vector<int64_t>& 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<float> run_decoder_chunk(const std::vector<float>& z_chunk); | |
| }; | |