Possibly added phonetic input to sam

master
guilevi 2021-07-04 01:06:42 +02:00
parent ee88a48fa5
commit 82d5cbc758
1 changed files with 6 additions and 1 deletions

View File

@ -12,7 +12,12 @@ module.exports = class extends BaseEngine {
} }
async getSpeechFile(text, filepath, voice = this.getDefaultVoice(), params = {}) { async getSpeechFile(text, filepath, voice = this.getDefaultVoice(), params = {}) {
let sam = new Sam(); let sam = new Sam();
const buf = sam.buf8(text); let phonetic = false;
if (text[0] == "$") {
text = text.slice(1);
phonetic = true;
}
const buf = sam.buf8(text, phonetic);
const file = new wavefile.WaveFile(); const file = new wavefile.WaveFile();
file.fromScratch(1, 22050, 8, buf); file.fromScratch(1, 22050, 8, buf);
fs.writeFileSync(filepath, file.toBuffer()); fs.writeFileSync(filepath, file.toBuffer());