From: lucsky@... (Luc Heinrich) Date: 2005-04-05T15:04:41+09:00 Subject: Re: r43 -- First public release wrote: > Works as advertised, keep up the good work! Wouldn't it be slick if > there was some OSXtts system that would do (or a generalized > OSX-centric feature lib) > > require "/path/to/OSXtts.rb" > tts = OSXtts.new("Victoria") > r43.new("Your43ThingsNick").goals.each { | aToDo | tts.say(aToDo) } > > and have the sexy Victoria come on in the AM to do her thing, reminding > us of what we really need to be doing while alone coding during the > long morning hours of lonesomeness :) ----------------------------------------------------------------------- require 'dl/import' $fw = '/System/Library/Frameworks/ApplicationServices.framework' $fw += '/Frameworks/SpeechSynthesis.framework/SpeechSynthesis' module TTS extend DL::Importable dlload $fw typealias 'OSErr', 'short' extern 'short SpeechBusy()' extern 'OSErr SpeakString(void*)' def TTS.say( something ) pstring = [ something.length, something ].pack( "Ca*" ) TTS.speakString( pstring ) sleep( 0.1 ) while TTS.speechBusy > 0 end end TTS.say( "I sure like being inside this fancy computer" ) ----------------------------------------------------------------------- That should be enough to get you started ;) -- Luc Heinrich - lucsky@mac.com