Support not using external buffers for node-addon (#925)

This commit is contained in:
Fangjun Kuang
2024-05-28 11:50:23 +08:00
committed by GitHub
parent cd65e7627d
commit b1c7d04ce2
11 changed files with 226 additions and 80 deletions

View File

@@ -1,5 +1,5 @@
{
"dependencies": {
"sherpa-onnx-node": "^1.0.25"
"sherpa-onnx-node": "^1.0.27"
}
}

View File

@@ -24,7 +24,12 @@ const tts = createOfflineTts();
const text = 'Alles hat ein Ende, nur die Wurst hat zwei.'
let start = Date.now();
const audio = tts.generate({text: text, sid: 0, speed: 1.0});
const audio = tts.generate({
text: text,
sid: 0,
speed: 1.0,
enableExternalBuffer: true,
});
let stop = Date.now();
const elapsed_seconds = (stop - start) / 1000;
const duration = audio.samples.length / audio.sampleRate;