Commit
•
4eefe1c
1
Parent(s):
2e992e7
update model
Browse files- sherpa-onnx-tts.js +10 -2
- sherpa-onnx-wasm-main-tts.js +0 -0
- sherpa-onnx-wasm-main-tts.wasm +2 -2
sherpa-onnx-tts.js
CHANGED
@@ -90,7 +90,7 @@ function initSherpaOnnxOfflineTtsModelConfig(config, Module) {
|
|
90 |
function initSherpaOnnxOfflineTtsConfig(config, Module) {
|
91 |
const modelConfig =
|
92 |
initSherpaOnnxOfflineTtsModelConfig(config.offlineTtsModelConfig, Module);
|
93 |
-
const len = modelConfig.len +
|
94 |
const ptr = Module._malloc(len);
|
95 |
|
96 |
let offset = 0;
|
@@ -98,12 +98,19 @@ function initSherpaOnnxOfflineTtsConfig(config, Module) {
|
|
98 |
offset += modelConfig.len;
|
99 |
|
100 |
const ruleFstsLen = Module.lengthBytesUTF8(config.ruleFsts) + 1;
|
101 |
-
const
|
|
|
|
|
102 |
Module.stringToUTF8(config.ruleFsts, buffer, ruleFstsLen);
|
|
|
|
|
103 |
Module.setValue(ptr + offset, buffer, 'i8*');
|
104 |
offset += 4;
|
105 |
|
106 |
Module.setValue(ptr + offset, config.maxNumSentences, 'i32');
|
|
|
|
|
|
|
107 |
|
108 |
return {
|
109 |
buffer: buffer, ptr: ptr, len: len, config: modelConfig,
|
@@ -190,6 +197,7 @@ function createOfflineTts(Module, myConfig) {
|
|
190 |
let offlineTtsConfig = {
|
191 |
offlineTtsModelConfig: offlineTtsModelConfig,
|
192 |
ruleFsts: '',
|
|
|
193 |
maxNumSentences: 1,
|
194 |
}
|
195 |
|
|
|
90 |
function initSherpaOnnxOfflineTtsConfig(config, Module) {
|
91 |
const modelConfig =
|
92 |
initSherpaOnnxOfflineTtsModelConfig(config.offlineTtsModelConfig, Module);
|
93 |
+
const len = modelConfig.len + 3 * 4;
|
94 |
const ptr = Module._malloc(len);
|
95 |
|
96 |
let offset = 0;
|
|
|
98 |
offset += modelConfig.len;
|
99 |
|
100 |
const ruleFstsLen = Module.lengthBytesUTF8(config.ruleFsts) + 1;
|
101 |
+
const ruleFarsLen = Module.lengthBytesUTF8(config.ruleFars) + 1;
|
102 |
+
|
103 |
+
const buffer = Module._malloc(ruleFstsLen + ruleFarsLen);
|
104 |
Module.stringToUTF8(config.ruleFsts, buffer, ruleFstsLen);
|
105 |
+
Module.stringToUTF8(config.ruleFars, buffer + ruleFstsLen, ruleFarsLen);
|
106 |
+
|
107 |
Module.setValue(ptr + offset, buffer, 'i8*');
|
108 |
offset += 4;
|
109 |
|
110 |
Module.setValue(ptr + offset, config.maxNumSentences, 'i32');
|
111 |
+
offset += 4;
|
112 |
+
|
113 |
+
Module.setValue(ptr + offset, buffer + ruleFstsLen, 'i8*');
|
114 |
|
115 |
return {
|
116 |
buffer: buffer, ptr: ptr, len: len, config: modelConfig,
|
|
|
197 |
let offlineTtsConfig = {
|
198 |
offlineTtsModelConfig: offlineTtsModelConfig,
|
199 |
ruleFsts: '',
|
200 |
+
ruleFars: '',
|
201 |
maxNumSentences: 1,
|
202 |
}
|
203 |
|
sherpa-onnx-wasm-main-tts.js
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
sherpa-onnx-wasm-main-tts.wasm
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:291646dd605548838733e50dffc073b706b8971e8eb4154f383e497ec66e736d
|
3 |
+
size 11051143
|