From: Dale Martenson Date: 2006-07-07T02:23:00+09:00 Subject: Re: text to speech? Arun wrote: > Hi, I'm new to Ruby and to Linux, but not to programming. I teach blind > people how to program in New Delhi, and it saddens me that they all use > MS Windows. I teach them Visual Basic version 6, which is far more > accessible to the blind than later versions, but that is another story. > > Anyway, in looking for a programming environment well suited to Linux, > I examined Ruby, and loved it. Now, of course, for a blind person, > audio is as important as the screen is for the sighted, and even to do > your first "Hello World" program, you need text to speech to be > working. > > I'm running Ubunty Breezy, and have Gnopernicus installed, but in the > terminal window, it only reads out part of what is needed: program > output is ignored. I'm therefore wondering how I might access text to > speech in Ruby, preferably in a manner that works independent of what > kind of Linux is installed. I was unable to get Emacspeak to say > anything, and did not have much joy trying to get it to compile and > debug Ruby code. > > Ideas or thoughts related to any of the above would be highly > appreciated. > > Arun Sorry I am not familar with Text-to-Speech on Linux. On Windows, you can use Daniel Berger's Win32 Util library for Ruby (see http://rubyforge.org/projects/win32utils/). It has support for win-sapi. Example: require "win32/sapi5" include Win32 t = [ "Fourscore and seven years ago,", "our fathers brought forth, upon this continent,", "a new nation,", "conceived in liberty and dedicated to the proposition", "that all men are created equal.", "Now we are engaged in a great civil war, testing whether that nation,", "or any nation so conceived and so dedicated,", "can long endure.", "We are met on a great battlefield of that war.", "We have come to dedicate a portion of it,", "as a final resting place for those who died here,", "that the nation might live.", "This we may, in all propriety do.", "But in a larger sense,", "we cannot dedicate,", "we cannot consecrate,", "we cannot hallow, this ground.", "The brave men, living and dead, who struggled here,", "have hallowed it, far above our poor power to add or detract.", "The world will little note,", "nor long remember what we say here;", "while it can never forget what they did here.", "It is rather for us the living,", "we here be dedicated to the great task remaining before us--", "that from these honored dead we take increased devotion", "to that cause for which they here gave the last full measure of devotion--", "that we here highly resolve that these dead shall not have died in vain,", "that this nation shall have a new birth of freedom,", "and that government of the people, by the people, for the people shall not perish from the earth." ] v = SpVoice.new srand Time.now.to_i t.each do |s| v.Speak( s ) sleep 0.5 end -- Posted via http://www.ruby-forum.com/.