Use piper-phonemize to convert text to token IDs (#453)

This commit is contained in:
Fangjun Kuang
2023-11-30 23:57:43 +08:00
committed by GitHub
parent db41778e99
commit 62dc3c3e46
55 changed files with 1048 additions and 192 deletions

View File

@@ -4,9 +4,9 @@ const sherpa_onnx = require('sherpa-onnx');
function createOfflineTts() {
const vits = new sherpa_onnx.OfflineTtsVitsModelConfig();
vits.model = './vits-vctk/vits-vctk.onnx';
vits.lexicon = './vits-vctk/lexicon.txt';
vits.tokens = './vits-vctk/tokens.txt';
vits.model = 'vits-piper-en_US-amy-low/en_US-amy-low.onnx'
vits.tokens = './vits-piper-en_US-amy-low/tokens.txt';
vits.dataDir = './vits-piper-en_US-amy-low/espeak-ng-data'
const modelConfig = new sherpa_onnx.OfflineTtsModelConfig();
modelConfig.vits = vits;
@@ -18,10 +18,11 @@ function createOfflineTts() {
}
const tts = createOfflineTts();
const speakerId = 99;
const speakerId = 0;
const speed = 1.0;
const audio =
tts.generate('Good morning. How are you doing?', speakerId, speed);
const audio = tts.generate(
'“Today as always, men fall into two groups: slaves and free men. Whoever does not have two-thirds of his day for himself, is a slave, whatever he may be: a statesman, a businessman, an official, or a scholar.”',
speakerId, speed);
audio.save('./test-en.wav');
console.log('Saved to test-en.wav successfully.');
tts.free();