File size: 751 Bytes
7cbe545
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once
#include <string>
#include <vector>
#include <cstdint>

class TTSEngine {
public:
    TTSEngine(const std::string& encoder_model,
              const std::string& decoder_model);
    ~TTSEngine();

    // Synthesize: returns PCM float32 samples at 24kHz
    std::vector<float> synthesize(const std::string& text,
                                   float speed = 1.0f,
                                   float variation = 0.667f);

private:
    void* enc_engine_ = nullptr;
    void* enc_context_ = nullptr;
    void* dec_engine_ = nullptr;
    void* dec_context_ = nullptr;

    // NPU inference helpers
    std::vector<float> encode(const int64_t* tokens, int token_len);
    std::vector<float> decode(const float* z_p, int mel_len);
};