I trying to make Cyrillic text-to-speech node js module.
I using node-powershell to run .NET TTS commands. And it works fine with Latin symbols but does not react on any Cyrillic symbols.
However if I input command directly to the Powershell console - it works fine with both cyrillic and latin symbols.
So I made a disition that problem point is node.js output encoding.
Node.js script:
var sayWin = (text) => {
var Shell = require('node-powershell');
var shell = new Shell({
inputEncoding: 'binary' //tried different endcoding
});
shell.addCommand('Add-Type -AssemblyName System.speech');
shell.addCommand('$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer');
shell.addCommand('$speak.Speak("' + text + '")');
shell.on('output', data => {
console.log("data", data);
});
return shell.invoke();
}
sayWin('latin'); //talk
sayWin('кирилица'); //silence
sayWin('\ufeffкирилица'); //silence trying with BOM
Please, pay attention that you may have to install windows TTS voice package and select it as default system voice to play Cyrillic text(I done it previously).
via betmakh
No comments:
Post a Comment