[function] Easy Text to speech

Post your working scripts, libraries and tools
User avatar
Learning one
Posts: 119
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

[function] Easy Text to speech

26 Dec 2015, 14:56

Continued from old [function] Easy Text to speech thread.
User avatar
evilC
Posts: 3590
Joined: 27 Feb 2014, 12:30

Re: [function] Easy Text to speech

24 Jul 2016, 09:05

Thanks Learning One for this, I needed something for a project of mine and this saved me having to work it all out for myself.

I took your code and re-packaged it as a class - I include it here in case it is useful to anyone else.
Changes:
Implemented as a class - all "commands" that you passed to TTS are now methods (functions) in the new class.
You no longer pass the oVoice object around. When you create a TTS class, it creates a voice object and stores it as a property of the class. All commands change that one voice.
GetVoices now returns an indexed array.
NextVoice added to switch to the next voice.

The code is largely unaltered in essence. Things like the available voices are calculated on startup and stored as class properties, so the code does not need to use COM to determine if a valid voice name is passed to SetVoice for example.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by evilC on 18 Jun 2017, 11:32, edited 1 time in total.
guest8

Re: [function] Easy Text to speech

18 Jun 2017, 03:12

Help.
Can`t write audioOut to file.
Without classes no such problem.
Can`t dig it why. newbie.
User avatar
evilC
Posts: 3590
Joined: 27 Feb 2014, 12:30

Re: [function] Easy Text to speech

18 Jun 2017, 07:30

I tried it myself, and yeah there appears to be something wrong. It writes a file, but it does not appear to be valid.
I cannot see what is wrong though, I see no obvious mistakes in my port of that method.

Old code:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



New code - should be identical, but the oVoice variable is this.oVoice and the syntax of the TTS method changed.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
evilC
Posts: 3590
Joined: 27 Feb 2014, 12:30

Re: [function] Easy Text to speech

18 Jun 2017, 07:37

Hmm, actually, this line is wrong:
this.TTS("SpeakWait", param1) should be this.SpeakWait(param1)

But that does not seem to fix it.
guest8

Re: [function] Easy Text to speech

18 Jun 2017, 09:56

evilC
wow! Its working now!
Thank you so much, evilC.
guest8

Re: [function] Easy Text to speech

18 Jun 2017, 12:08

With this apart works for me:
Spoiler

Return to “Scripts and Functions”

Who is online

Users browsing this forum: hoppfrosch and 17 guests