Hi Codeans,
I’m writing a narrative engine for creating adventure games for the visually impaired and am protoyping this using the voice (text-to-speech) API…
It’s not quite working as I expected, I have tested with the code below and have added the outcomes as comments (note that my default language is ‘en-GB’):
speech.language = "en-US"
speech.say("Hello Simon")
-- Fast american female voice CORRECT
local a = speech("Hello Simon")
speech.say(a)
-- Normal English male voice, INCORRECT? 'en-US' value should be the inherited default?
a = speech("Hello Simon")
a.language = "en-US"
speech.say(a)
-- Normal English male voice, INCORRECT? Expected 'en-US' explicit value
speech.voice = speech.voices[1]
a = speech("Hello Simon")
speech.say(a)
-- Normal English male voice, INCORRECT? Expected default voice to be inherited?
a = speech("Hello Simon")
a.voice = speech.voices[1]
speech.say(a)
-- Voice changed, CORRECT
So what I expected to be able to do was set the voice ‘per utterance’, as you can see from the last test I can set the utterance voice property, but I don’t really want to work with the voice table, I’d rather set the language explicitly…
I am guessing that certain parts of the underlying speech API are reset post-utterance, e.g. you cannot re-use an utterance (local var ‘a’ above) that has already been spoken…
Another question is the rate of speech, the en-US voice seems far too fast for sensible usage by default, are there default rates per voice?
Any enlightenment gratefully received…
Cheers,
Brookesi