Marak / say.js

TTS (text to speech) for node.js. send text from node.js to your speakers.
MIT License
1.48k stars 214 forks source link

500-1000ms delay to start speaking? #92

Open Wizek opened 5 years ago

Wizek commented 5 years ago

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.

Wizek commented 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:

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?

chenvan commented 2 years ago

why not change to ActiveXObject. It does not delay the speaking

var winax = require('winax')

var voiceObj = new ActiveXObject("Sapi.SpVoice")
voiceObj.speak("你好")
Wizek commented 2 years ago

Thank you for that idea @chenvan, I shall try it!

Aida-Enna commented 2 years ago

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.