csukuangfj commited on
Commit
6cfa0e7
·
1 Parent(s): c9f4552

update model

Browse files
sherpa-onnx-tts.js CHANGED
@@ -141,12 +141,15 @@ function initSherpaOnnxOfflineTtsKokoroModelConfig(config, Module) {
141
  const voicesLen = Module.lengthBytesUTF8(config.voices) + 1;
142
  const tokensLen = Module.lengthBytesUTF8(config.tokens || '') + 1;
143
  const dataDirLen = Module.lengthBytesUTF8(config.dataDir || '') + 1;
 
 
144
 
145
- const n = modelLen + voicesLen + tokensLen + dataDirLen;
 
146
 
147
  const buffer = Module._malloc(n);
148
 
149
- const len = 5 * 4;
150
  const ptr = Module._malloc(len);
151
 
152
  let offset = 0;
@@ -162,6 +165,12 @@ function initSherpaOnnxOfflineTtsKokoroModelConfig(config, Module) {
162
  Module.stringToUTF8(config.dataDir || '', buffer + offset, dataDirLen);
163
  offset += dataDirLen;
164
 
 
 
 
 
 
 
165
  offset = 0;
166
  Module.setValue(ptr, buffer + offset, 'i8*');
167
  offset += modelLen;
@@ -177,6 +186,12 @@ function initSherpaOnnxOfflineTtsKokoroModelConfig(config, Module) {
177
 
178
  Module.setValue(ptr + 16, config.lengthScale || 1.0, 'float');
179
 
 
 
 
 
 
 
180
  return {
181
  buffer: buffer, ptr: ptr, len: len,
182
  }
@@ -216,6 +231,8 @@ function initSherpaOnnxOfflineTtsModelConfig(config, Module) {
216
  tokens: '',
217
  lengthScale: 1.0,
218
  dataDir: '',
 
 
219
  };
220
  }
221
 
@@ -382,6 +399,8 @@ function createOfflineTts(Module, myConfig) {
382
  tokens: '',
383
  dataDir: '',
384
  lengthScale: 1.0,
 
 
385
  };
386
 
387
  const offlineTtsModelConfig = {
 
141
  const voicesLen = Module.lengthBytesUTF8(config.voices) + 1;
142
  const tokensLen = Module.lengthBytesUTF8(config.tokens || '') + 1;
143
  const dataDirLen = Module.lengthBytesUTF8(config.dataDir || '') + 1;
144
+ const dictDirLen = Module.lengthBytesUTF8(config.dictDir || '') + 1;
145
+ const lexiconLen = Module.lengthBytesUTF8(config.lexicon || '') + 1;
146
 
147
+ const n =
148
+ modelLen + voicesLen + tokensLen + dataDirLen + dictDirLen + lexiconLen;
149
 
150
  const buffer = Module._malloc(n);
151
 
152
+ const len = 7 * 4;
153
  const ptr = Module._malloc(len);
154
 
155
  let offset = 0;
 
165
  Module.stringToUTF8(config.dataDir || '', buffer + offset, dataDirLen);
166
  offset += dataDirLen;
167
 
168
+ Module.stringToUTF8(config.dictDir || '', buffer + offset, dictDirLen);
169
+ offset += dictDirLen;
170
+
171
+ Module.stringToUTF8(config.lexicon || '', buffer + offset, lexiconLen);
172
+ offset += lexiconLen;
173
+
174
  offset = 0;
175
  Module.setValue(ptr, buffer + offset, 'i8*');
176
  offset += modelLen;
 
186
 
187
  Module.setValue(ptr + 16, config.lengthScale || 1.0, 'float');
188
 
189
+ Module.setValue(ptr + 20, buffer + offset, 'i8*');
190
+ offset += dictDirLen;
191
+
192
+ Module.setValue(ptr + 24, buffer + offset, 'i8*');
193
+ offset += lexiconLen;
194
+
195
  return {
196
  buffer: buffer, ptr: ptr, len: len,
197
  }
 
231
  tokens: '',
232
  lengthScale: 1.0,
233
  dataDir: '',
234
+ dictDir: '',
235
+ lexicon: '',
236
  };
237
  }
238
 
 
399
  tokens: '',
400
  dataDir: '',
401
  lengthScale: 1.0,
402
+ dictDir: '',
403
+ lexicon: '',
404
  };
405
 
406
  const offlineTtsModelConfig = {
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:1350ae9bae83002b058772c4941af0f6f85623b8d6126306bcb1e8bbece13406
3
- size 11630594
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a8fb857daf021b7ce809b1ad4996ffb3c6d11b4f06914976fbf7253d425726a
3
+ size 11723010