Commit
·
319ec2b
1
Parent(s):
c41f3f0
small fixes
Browse files- main.py +11 -1
- piper/templates/c-api-example.c.in +3 -1
main.py
CHANGED
@@ -131,7 +131,10 @@ gcc \
|
|
131 |
|
132 |
Now you can run
|
133 |
```bash
|
134 |
-
/tmp
|
|
|
|
|
|
|
135 |
```
|
136 |
|
137 |
> You probably need to run
|
@@ -230,6 +233,13 @@ This model is converted from <{m.url}>
|
|
230 |
| {m.ns} | {m.sr} |
|
231 |
|
232 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
s += get_android_apk(m)
|
235 |
s += get_c_api(m)
|
|
|
131 |
|
132 |
Now you can run
|
133 |
```bash
|
134 |
+
cd /tmp
|
135 |
+
|
136 |
+
# Assume you have downloaded the model and extracted it to /tmp
|
137 |
+
./test-piper
|
138 |
```
|
139 |
|
140 |
> You probably need to run
|
|
|
233 |
| {m.ns} | {m.sr} |
|
234 |
|
235 |
"""
|
236 |
+
s += f"""
|
237 |
+
|
238 |
+
Model download address
|
239 |
+
|
240 |
+
<https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/{d}.tar.bz2>
|
241 |
+
|
242 |
+
"""
|
243 |
|
244 |
s += get_android_apk(m)
|
245 |
s += get_c_api(m)
|
piper/templates/c-api-example.c.in
CHANGED
@@ -15,15 +15,17 @@ int main() {
|
|
15 |
|
16 |
int sid = 0; // speaker id
|
17 |
const char *text = "{{text}}";
|
|
|
18 |
const SherpaOnnxGeneratedAudio *audio =
|
19 |
SherpaOnnxOfflineTtsGenerate(tts, text, sid, 1.0);
|
20 |
|
21 |
SherpaOnnxWriteWave(audio->samples, audio->n, audio->sample_rate,
|
22 |
"./test.wav");
|
23 |
|
|
|
24 |
SherpaOnnxDestroyOfflineTtsGeneratedAudio(audio);
|
25 |
-
|
26 |
SherpaOnnxDestroyOfflineTts(tts);
|
|
|
27 |
printf("Saved to ./test.wav\n");
|
28 |
|
29 |
return 0;
|
|
|
15 |
|
16 |
int sid = 0; // speaker id
|
17 |
const char *text = "{{text}}";
|
18 |
+
|
19 |
const SherpaOnnxGeneratedAudio *audio =
|
20 |
SherpaOnnxOfflineTtsGenerate(tts, text, sid, 1.0);
|
21 |
|
22 |
SherpaOnnxWriteWave(audio->samples, audio->n, audio->sample_rate,
|
23 |
"./test.wav");
|
24 |
|
25 |
+
// You need to free the pointers to avoid memory leak in your app
|
26 |
SherpaOnnxDestroyOfflineTtsGeneratedAudio(audio);
|
|
|
27 |
SherpaOnnxDestroyOfflineTts(tts);
|
28 |
+
|
29 |
printf("Saved to ./test.wav\n");
|
30 |
|
31 |
return 0;
|