Open Wizek opened 5 years ago
Ok, I think I've found the reason for this!
I've just came across that on Windows the invocation seems to be through powershell.
This can explain the delay. Here, open a powershell and contrast these two commands:
PowerShell -Command "Add-Type -AssemblyName System.Speech; `$x = New-Object System.Speech.Synthesis.SpeechSynthesizer; `$x.Rate = 10; `$x.Speak('Hello...')"
Add-Type -AssemblyName System.Speech; $x = New-Object System.Speech.Synthesis.SpeechSynthesizer; $x.Rate = 10; $x.Speak('Hello...')
For me, the latter runs & speaks & exits much more rapidly, and the former one does so with about a 0.5-1s delay, just as I observed with Say.js.
Where can we go from here?
why not change to ActiveXObject. It does not delay the speaking
var winax = require('winax')
var voiceObj = new ActiveXObject("Sapi.SpVoice")
voiceObj.speak("你好")
Thank you for that idea @chenvan, I shall try it!
Any updates on this?
EDIT: Oh wow, I got here from a different repo and didn't even notice I was on a different one. Sorry.
Is this normal and known current behavior of say.js? Or am I running into a buggy edgecase?
say.speak
function calls seem to have a 0.5-1 second delay between invocation and start of speech. Even when the speech rate is set to something high, e.g. 2.5. I'm on Windows 10 and using the David built in voice if that matters.Other ways of invoking the tts, e.g. TTSReader seem to have much less delay, around 100-200ms. And I've also seen even quicker response times through other means, but I currently don't recall exactly what they were.