You are viewing our Forum Archives. To view or take place in current topics click here.
Client-side Text-to-Speech Shoutbox
Posted:

Client-side Text-to-Speech ShoutboxPosted:

tortuga
  • Blind Luck
Status: Offline
Joined: Dec 25, 200914Year Member
Posts: 2,314
Reputation Power: 1686
Status: Offline
Joined: Dec 25, 200914Year Member
Posts: 2,314
Reputation Power: 1686
Text-To-Speech ShoutBox

If you haven't seen my previous post, feel free to take a quick look at it just to get some background.

In that post, I'm running a Node server that uses the underlying system's text-to-speech engine to speak every shout. However, a server isn't even needed thanks to [ Register or Signin to view external links. ] from Google way back in 2014! I don't know how I missed it!

Now you can easily listen to our shoutbox speak with one line of code! Simply open up the console from the shoutbox window (F12 shortcut on Chrome) and execute the following.
$.getScript( 'https://rawgit.com/kinkyturtle/TTG-TTS-SB/master/client-app/speak-shouts.js', () => startShouts() );
However, you really should not go around executing random code you find off the internet, so open that link up and read through it! If you want to be able to change the voice, volume, rate, and pitch, you would be doing that anyways! The entire repo is [ Register or Signin to view external links. ] .

Since the speech might get annoying after a while, you can stop it with stopShouts(). However, you might've noticed the script logs each shout to the console when speaking it. So if you only want the logs, then you can include some options into startShouts() like so: startShouts( {speak: false, log: true} ).

But why would I only want the logs, dude? Because they include timestamps!!! (See suggestions: 1 2 3 4)

Okay, but it's not like I can chat through the console? Hah!
[ Register or Signin to view external links. ]

If you guys have any questions about the code, I'd be glad to answer them!

Bugs

Google's speech synthesis cuts out on longer texts, and does not work again until the browser is restarted, or until speechSynthesis.cancel() is executed in the console. See [ Register or Signin to view external links. ] StackOverflow question for a solution. I'll get around to implementing it whenever.

Thanks.


Last edited by tortuga ; edited 1 time in total

The following 6 users thanked tortuga for this useful post:

CriticaI (03-04-2017), Dusknoir (02-12-2017), C4 (01-31-2017), Skates (01-29-2017), Rick (01-28-2017), Fold (01-28-2017)
#2. Posted:
coolbunny1234
  • TTG Commander
Status: Offline
Joined: Aug 09, 200914Year Member
Posts: 6,491
Reputation Power: 8063
Motto: The Original Bunny
Motto: The Original Bunny
Status: Offline
Joined: Aug 09, 200914Year Member
Posts: 6,491
Reputation Power: 8063
Motto: The Original Bunny
I'm still using ipv4 boi
#3. Posted:
tortuga
  • TTG Addict
Status: Offline
Joined: Dec 25, 200914Year Member
Posts: 2,314
Reputation Power: 1686
Status: Offline
Joined: Dec 25, 200914Year Member
Posts: 2,314
Reputation Power: 1686
coolbunny1234 wrote I'm still using ipv4 boi

I don't understand. Can you elaborate? Networking isn't really my thing, but what does your IP have to do with anything?
#4. Posted:
tortuga
  • TTG Addict
Status: Offline
Joined: Dec 25, 200914Year Member
Posts: 2,314
Reputation Power: 1686
Status: Offline
Joined: Dec 25, 200914Year Member
Posts: 2,314
Reputation Power: 1686
Update: fixed the issue with Google's speech synthesis cutting out on longer strings thanks to the help of the referenced Stack Overflow question in the original post.

Should be able to work smoothly now!
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.