File size: 1,213 Bytes
a37072b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

typedef struct ZipVoiceHandle ZipVoiceHandle;

typedef struct {
    const char *root_dir;
    const char *model_dir;
    const char *token_file;
    const char *vocoder_model;
    int max_tokens;
    int max_feat_len;
    int num_step;
    float default_speed;
    int seed;
} ZipVoiceConfig;

typedef struct {
    const char *text;
    const char *prompt;       // zh / en / custom
    float speed;
    const char *output_wav;
} ZipVoiceRequestC;

typedef struct {
    int ok;                   // 1 ok, 0 error
    const char *path;         // output wav path
    const char *error;        // error string, owned by library until next call
    double wall_sec;
    double model_sec;
    double rtf;
} ZipVoiceResponseC;

ZipVoiceHandle *zipvoice_create(const ZipVoiceConfig *cfg);
void zipvoice_destroy(ZipVoiceHandle *h);

int zipvoice_cache_prompt(ZipVoiceHandle *h,
                          const char *key,
                          const char *wav_path,
                          const char *prompt_text);

ZipVoiceResponseC zipvoice_infer(ZipVoiceHandle *h,
                                 const ZipVoiceRequestC *req);

#ifdef __cplusplus
}
#endif