New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sherpa-onnx

Package Overview
Dependencies
Maintainers
0
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sherpa-onnx - npm Package Compare versions

Comparing version 1.10.37 to 1.10.38

2

package.json
{
"name": "sherpa-onnx",
"version": "1.10.37",
"version": "1.10.38",
"description": "Speech-to-text and text-to-speech using Next-gen Kaldi without internet connection",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,2 +11,6 @@

if ('config2' in config) {
freeConfig(config.config2, Module)
}
Module._free(config.ptr);

@@ -70,7 +74,99 @@ }

function initSherpaOnnxOfflineTtsMatchaModelConfig(config, Module) {
const acousticModelLen = Module.lengthBytesUTF8(config.acousticModel) + 1;
const vocoderLen = Module.lengthBytesUTF8(config.vocoder) + 1;
const lexiconLen = Module.lengthBytesUTF8(config.lexicon || '') + 1;
const tokensLen = Module.lengthBytesUTF8(config.tokens || '') + 1;
const dataDirLen = Module.lengthBytesUTF8(config.dataDir || '') + 1;
const dictDirLen = Module.lengthBytesUTF8(config.dictDir || '') + 1;
const n = acousticModelLen + vocoderLen + lexiconLen + tokensLen +
dataDirLen + dictDirLen;
const buffer = Module._malloc(n);
const len = 8 * 4;
const ptr = Module._malloc(len);
let offset = 0;
Module.stringToUTF8(
config.acousticModel || '', buffer + offset, acousticModelLen);
offset += acousticModelLen;
Module.stringToUTF8(config.vocoder || '', buffer + offset, vocoderLen);
offset += vocoderLen;
Module.stringToUTF8(config.lexicon || '', buffer + offset, lexiconLen);
offset += lexiconLen;
Module.stringToUTF8(config.tokens || '', buffer + offset, tokensLen);
offset += tokensLen;
Module.stringToUTF8(config.dataDir || '', buffer + offset, dataDirLen);
offset += dataDirLen;
Module.stringToUTF8(config.dictDir || '', buffer + offset, dictDirLen);
offset += dictDirLen;
offset = 0;
Module.setValue(ptr, buffer + offset, 'i8*');
offset += acousticModelLen;
Module.setValue(ptr + 4, buffer + offset, 'i8*');
offset += vocoderLen;
Module.setValue(ptr + 8, buffer + offset, 'i8*');
offset += lexiconLen;
Module.setValue(ptr + 12, buffer + offset, 'i8*');
offset += tokensLen;
Module.setValue(ptr + 16, buffer + offset, 'i8*');
offset += dataDirLen;
Module.setValue(ptr + 20, config.noiseScale || 0.667, 'float');
Module.setValue(ptr + 24, config.lengthScale || 1.0, 'float');
Module.setValue(ptr + 28, buffer + offset, 'i8*');
offset += dictDirLen;
return {
buffer: buffer, ptr: ptr, len: len,
}
}
function initSherpaOnnxOfflineTtsModelConfig(config, Module) {
if (!('offlineTtsVitsModelConfig' in config)) {
config.offlineTtsVitsModelConfig = {
model: '',
lexicon: '',
tokens: '',
noiseScale: 0.667,
noiseScaleW: 0.8,
lengthScale: 1.0,
dataDir: '',
dictDir: '',
};
}
if (!('offlineTtsMatchaModelConfig' in config)) {
config.offlineTtsMatchaModelConfig = {
acousticModel: '',
vocoder: '',
lexicon: '',
tokens: '',
noiseScale: 0.667,
lengthScale: 1.0,
dataDir: '',
dictDir: '',
};
}
const vitsModelConfig = initSherpaOnnxOfflineTtsVitsModelConfig(
config.offlineTtsVitsModelConfig, Module);
const len = vitsModelConfig.len + 3 * 4;
const matchaModelConfig = initSherpaOnnxOfflineTtsMatchaModelConfig(
config.offlineTtsMatchaModelConfig, Module);
const len = vitsModelConfig.len + matchaModelConfig.len + 3 * 4;
const ptr = Module._malloc(len);

@@ -92,5 +188,10 @@

Module.setValue(ptr + offset, buffer, 'i8*');
offset += 4;
Module._CopyHeap(matchaModelConfig.ptr, matchaModelConfig.len, ptr + offset);
offset += matchaModelConfig.len;
return {
buffer: buffer, ptr: ptr, len: len, config: vitsModelConfig,
config2: matchaModelConfig
}

@@ -201,4 +302,17 @@ }

};
const offlineTtsMatchaModelConfig = {
acousticModel: '',
vocoder: '',
lexicon: '',
tokens: '',
dataDir: '',
dictDir: '',
noiseScale: 0.667,
lengthScale: 1.0,
};
const offlineTtsModelConfig = {
offlineTtsVitsModelConfig: offlineTtsVitsModelConfig,
offlineTtsMatchaModelConfig: offlineTtsMatchaModelConfig,
numThreads: 1,

@@ -208,2 +322,3 @@ debug: 1,

};
let offlineTtsConfig = {

@@ -210,0 +325,0 @@ offlineTtsModelConfig: offlineTtsModelConfig,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc