Description
gSpeak is a module for gmod that lets you use Microsoft Speech from Lua. You can use it both on the server and the client, but it makes more sense on the client. If you use it on the server, gSpeak will not broadcast voice output to clients.
gspeak.Say makes your system default voice (XP: Sam, Vista: Anna) speak the provided message, optionally also at the provided volume and rate of speech. The volume is a value between 0 and 100, where 100 is the default. The rate is a value between -10 and 10, where 0 is typically the default. You can also use the SAPI's XML markup within the message to mutate the pitch, volume and rate of speech.Code:gspeak.Say(string message [, ushort volume, long rate]) gspeak.IsSpeaking() gspeak.QueueSize() gspeak.Pause() gspeak.Resume()
gspeak.IsSpeaking returns a boolean value whether or not gspeak is currently saying anything.
gspeak.QueueSize returns the amount of messages currently waiting to be spoken, including the one currently being spoken.
gspeak.Pause pauses the voice temporarily before the next word. IsSpeaking returns false while the voice is paused; even if the voice is currently finishing up on a word before pausing.
gspeak.Resume resumes a paused voice. You can use Pause and Resume even if the voice is already paused or is already speaking; they'll just return immediately, so there's no need to use IsSpeaking/QueueSize to check if pausing/resuming is viable.
More on XML markup
The XML markup can be used to modify the pronounciation of entire text or just portions of it. You can change attributes such as pitch, volume and rate using the embedded XML. You can also insert pockets of silence, or tell the voice how to pronounce something.
More advanced features include making the current voice be chosen based on gender, age and language!
I have not tested all of these features, but there's a detailed tutorial on the XML markup here.
Example: Spoken chat
Clientside script for speaking out chat (and notifications, leave messages):
require("speak") local function speak(index, nick, msg, msgtype) gspeak.Say(msg) end hook.Add("ChatText", "gspeak_saychat", speak)
Example: Console command
Usage (in console):concommand.Add("tts", function(ply, cmd, args) if #args == 0 then print("Usage: speak <message>") return end gspeak.Say(table.concat(args, " ")) end)
TodoCode:tts SamuraiMushroom is a faggot!
Add a mechanism for choosing/getting the default voice and language.
Temporary method of changing voice
You have to select your system default voice in Control Panel->(Text To) Speech, the default voice is the one used by gspeak.
Download v1.6.2
Put gm_speak.dll in your lua/includes/modules/ folder to use.
#luahelp download mirror
filesmelt download mirror
Credits
Foss - came up with the idea

Register
Events
Popular
More
Post #1


Funny x 8




Agree x 2
Disagree x 2






