? Chat JS Add-Ons (Page 5) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Migrating to a new website for SmileBASIC 4

This is the development website, where we test out new features. This isn't the place you're looking for! Go here

Chat JS Add-Ons

1 2 3 4 5
  • #81 ✎ 257 Y____ Head Admin Gardening I like to garden! Hobbies Reading I like to read books! Hobbies Drawing I like to draw! Hobbies var synth = window.speechSynthesis; var readIncoming = true; readOutgoing = true; var silent = true; var speakrate = 3; window.speakvoice = synth.getVoices()[0] //"Microsoft Zira Desktop - English (United States)"; commands.push(new Command("tts", function() { silent = !silent; var utterThis = new SpeechSynthesisUtterance("reader is now " + (silent ? "off" : "on") + ". use /TTS help for help"); utterThis.rate = speakrate; utterThis.voice = speakvoice; synth.speak(utterThis); })); commands.push(new Command("ttsread", function() { readIncoming = !readIncoming; var utterThis = new SpeechSynthesisUtterance("incoming message reading is now " + (readIncoming ? "on" : "off") + ". use /TTS help for help"); utterThis.rate = speakrate; utterThis.voice = speakvoice; synth.speak(utterThis); })); addMessageEvent(function(messageElement) { if (!silent){ var messageContent = messageElement.querySelector("message-part"); if(messageContent && readIncoming) { var utterThis = new SpeechSynthesisUtterance(messageElement.dataset.username + "said: " + messageContent.innerText); utterThis.rate = speakrate; utterThis.voice = speakvoice; synth.speak(utterThis); } } }); function ttsspeak(phrase) { if (!silent) { var utterThis = new SpeechSynthesisUtterance(phrase); utterThis.rate = speakrate; utterThis.voice = speakvoice; synth.speak(utterThis); } } commands.push(new Command("ttsvoice", function(param) { voices = window.speechSynthesis.getVoices(); var params = quickParamParse(param); if (params.length < 1) { ttsspeak("TTS voice list:"); for (i = 0; i < voices.length; i++){ var line = i + ") " + voices[i].name; ttsspeak(line); localModuleMessage(line); } } else { if (isNaN(params[0])) { warningMessage("bad voice argument: " + params[0]); } else { window.speakvoice = voices[params[0]].name; ttsspeak("TTS voice is now " + voices[params[0]]); } } })); Posted
1 2 3 4 5