Thursday, September 6, 2007

Ruby text to speech on windows

Using the win32-sapi ruby can speak!
Install the gem
gem install win32-sapi

Speak some words
require "win32/sapi5"
include Win32
v = SpVoice.new
v.Speak("Shall we play a game?")

*Remember ruby is case sensitive
Other cool features:
v = SpVoice.new
v.ole_get_methods
v.Status
v.Voice
v.Rate
v.Volume
v.Priority

More info: Microsoft Documentation on SpVoice

2 comments:

Jonas Elfström said...

Thanks!

asuka said...

Dear Justin

I want to chage voice character from your system.

for example " Microsoft Mike"

Please teach command.

Thank you.