revSpeak and revListen

Thomas McGrath III 3mcgrath at adelphia.net
Wed Sep 22 16:27:52 EDT 2004


I would think Rev could store the scripts necessary for speech  
listening and "do script" these directly to the 'speech recognition  
server'.
When I have time I will play with these more and let you know. For now  
I have uploaded to my user space a simple stack to show the AS Say  
command and the AS Listen for command working from within Rev on Mac  
OS10.3

My user space is mcgrath3 on RevOnline.

Tom

Speech Recognition
The "Listen for" and companion "Listen continuously for" commands are  
part of the speech recognition server's terminology. The speech  
recognition server does not appear in the applications list in Script  
Editor when you try to open a dictionary. Instead, you must navigate to  
the application, whose path is:

/System/Library/Frameworks/Carbon.framework/Frameworks/ 
SpeechRecognition.framework/Resources/SpeechRecognitionServer.app


Speech Recognition Suite: Providing access to speech recognition via  
AppleScript

listen continuously for: Listen for spoken phrases.  Call stop  
listening when done.
	listen continuously for  a list of string  -- list of possible phrases  
to listen for
		[with prompt  string]  -- text computer will speak as a prompt
		[giving up after  integer]  -- how many seconds to wait before giving  
up
		[filtering  boolean]  -- whether to skip phrases with special  
characters
		[with identifier  string]  -- a unique identifier string for this  
recognizer
		[with section title  string]  -- a section title under which the  
commands will be listed
		[displaying  a list of string]  -- an optional list of commands to be  
displayed
		[attach to  'psn ']  -- only listen for commands when this  
application is frontmost
	Result:   string  -- the recognized phrase

listen for: Listen for a spoken phrase
	listen for  a list of string  -- list of possible phrases to listen for
		[with prompt  string]  -- text computer will speak as a prompt
		[giving up after  integer]  -- how many seconds to wait before giving  
up
		[filtering  boolean]  -- whether to skip phrases with special  
characters
		[displaying  a list of string]  -- an optional list of commands to be  
displayed
	Result:   string  -- the recognized phrase

stop listening for identifier: Stop listening when listening  
continuously
	stop listening for identifier  string  -- the unqiue identifier string  
for the recognizer to stop

The simplest command to use is "listen for". For example:

tell application "SpeechRecognitionServer"
  local theResultstring, helpLanguageModel, choicesLanguageModel
  set helpLanguageModel to {"help", "help me", "what can i say"}
  set choicesLanguageModel to {"iMac", "iBook", "PowerMac"}
  set thePrompt to "What is your [[emph +]] favorite Macintosh?"
  try
  set theResultstring to listen for choicesLanguageModel &  
helpLanguageModel with prompt thePrompt giving up after 30
    if theResultstring is "iMac" then
      say "I like that [[emph +]] too!"
    else if theResultstring is "iBook" then
      say "The iBook is [[emph +]] cool"
    else if theResultstring is "PowerMac" then
      say "[[emph +]]Wow. You must be a professional."
    else if theResultstring is in helpLanguageModel then
      tell me to doHelp()
    end if
  end try
end tell


on doHelp()
  say "I would really like to help you but I cannot."
end doHelp


The "listen continuously for" command is similar but instead of  
quitting when something is recognized, it waits for more input. It is  
your responsibility to stop listening when appropriate.


On Sep 21, 2004, at 5:53 PM, Roger.E.Eller at sealedair.com wrote:

> I am unsure if it would be possible, but just as runrev has created
> revSpeak I could see real uses for a revListen command. At least on
> Windows, the SAPI 5.1 TTS engine appears to also support speech  
> conversion
> to text. Could runrev tap into this so that a user could simply speak
> responses to a dialog for example? I would like to see this as a  
> 'feature'
> of Revolution instead of having to use a 3rd party solution like IBM
> Via-Voice.
>
> Roger Eller <roger.e.eller at sealedair.com>


More information about the use-livecode mailing list