Packageispeech
Classpublic class SpeechRecognizer
InheritanceSpeechRecognizer Inheritance flash.net.Socket

Contains important methods to recognize audio and convert free form speech into text. Most of the methods are event-driven, so to grab values, add a "DATAGET" event listener. See examples for more information.



Public Methods
 MethodDefined By
  
SpeechRecognizer(api:String, production:Boolean)
SpeechRecognizer
  
addAlias(aliasname:String, phrases:Array):void
Adds an alias to use inside of a command.
SpeechRecognizer
  
addCommand(commandPhrase:String):void
Adds a new command phrase.
SpeechRecognizer
  
addCommands(commandPhrase:Array):void
Adds multiple new command phrases.
SpeechRecognizer
  
Cancels a recording in progress and dismisses the current prompt if one is visible.
SpeechRecognizer
  
clear():void
Clears all commands and aliases from this {
SpeechRecognizer
  
getInstance(api:String, production:Boolean):SpeechRecognizer
[static] Gets an instance of the iSpeech SpeechRecognizer class.
SpeechRecognizer
  
setFreeForm(freeformtype:Number):void
Sets freeform.
SpeechRecognizer
  
setLanguage(localeCode:String):void
Set the speech recognition language.
SpeechRecognizer
  
setOptionalCommand(command:String, parameter:String):void
Specify additional parameters to send to the server.
SpeechRecognizer
  
startRecordAndNotify(recordBluetooth:Boolean, notifyInMillisec:Number, silencelevel:Number = 0):void
Begins recording from microphone.
SpeechRecognizer
  
stopRecord():void
Stops the recording process.
SpeechRecognizer
Public Constants
 ConstantDefined By
  FREEFORM_DICTATION : Number = 3
[static] Free form dictation, such as a written document
SpeechRecognizer
  FREEFORM_DISABLED : Number = 0
[static] Disable free form speech recognition.
SpeechRecognizer
  FREEFORM_INSTANT_MESSAGE : Number = 5
[static] A message for an instant message client
SpeechRecognizer
  FREEFORM_MEMO : Number = 7
[static] A memo or a list of items
SpeechRecognizer
  FREEFORM_MESSAGE : Number = 4
[static] A message addressed to another person.
SpeechRecognizer
  FREEFORM_SMS : Number = 1
[static] A SMS or TXT message.
SpeechRecognizer
  FREEFORM_TRANSCRIPT : Number = 6
[static] General transcription
SpeechRecognizer
  FREEFORM_VOICEMAIL : Number = 2
[static] A voice mail transcription
SpeechRecognizer
Constructor Detail
SpeechRecognizer()Constructor
public function SpeechRecognizer(api:String, production:Boolean)



Parameters
api:String
 
production:Boolean
Method Detail
addAlias()method
public function addAlias(aliasname:String, phrases:Array):void

Adds an alias to use inside of a command. You can reference the added alias using %ALIASNAME% from within a command. Alias names are automatically capitalized. Note: You can only a maximum of two aliases per command.

Example:

		 SpeechRecognizer rec = SpeechRecognizer.getInstance("APIKEY");
		 String[] names = new String[] { "jane", "bob", "john" };
		 rec.addAlias("NAMES", names);
		 rec.addCommand("call %NAMES%");
		 

The user can now speak "call john" and it will be recognized correctly.

Parameters

aliasname:String — The name of your alias for referencing inside of your commands.
 
phrases:Array — The list of phrases for this alias.

addCommand()method 
public function addCommand(commandPhrase:String):void

Adds a new command phrase. Note: You can only use two aliases per command.

Example:

		 SpeechRecognizer rec = SpeechRecognizer.getInstance("APIKEY");
		 String commands = new String(){"yes","no"};
		 rec.addCommand(commands);
		 
The user can now speak "Yes" or "No" and it will be recognized correctly.

Parameters

commandPhrase:String — An array containing your command phrases

addCommands()method 
public function addCommands(commandPhrase:Array):void

Adds multiple new command phrases.

Parameters

commandPhrase:Array

cancelRecord()method 
public function cancelRecord():void

Cancels a recording in progress and dismisses the current prompt if one is visible.

clear()method 
public function clear():void

Clears all commands and aliases from this {

See also

object.
getInstance()method 
public static function getInstance(api:String, production:Boolean):SpeechRecognizer

Gets an instance of the iSpeech SpeechRecognizer class. The ApiKey parameter is only required on initial call to this method.

Parameters

api:String — Your API key provided by iSpeech.
 
production:Boolean — Set to true if you are deploying your application. Set to false if you are using the sandbox environment.

Returns
SpeechRecognizer
setFreeForm()method 
public function setFreeForm(freeformtype:Number):void

Sets freeform. Default is SpeechRecongizer.FREEFORM_DISABLED.

Parameters

freeformtype:Number

setLanguage()method 
public function setLanguage(localeCode:String):void

Set the speech recognition language.

Parameters

localeCode:String — Visit the iSpeech Developers center at http://www.ispeech.org or contact sales

setOptionalCommand()method 
public function setOptionalCommand(command:String, parameter:String):void

Specify additional parameters to send to the server.

Parameters

command:String — A valid command
 
parameter:String — A valid setting for the command

startRecordAndNotify()method 
public function startRecordAndNotify(recordBluetooth:Boolean, notifyInMillisec:Number, silencelevel:Number = 0):void

Begins recording from microphone. This method controls the duration of a recording based on a time limit or a silence threshold or both.

Parameters

recordBluetooth:Boolean — Record from a connected bluetooth headset instead of the device
 
notifyInMillisec:Number — The amount of time in milliseconds to record audio. After this time expires, a RECORDING_COMPLETE event will be triggered within this object.
 
silencelevel:Number (default = 0) — The silence threshold of the microphone. Ranges from 0 to 100, where 0 records all data.

stopRecord()method 
public function stopRecord():void

Stops the recording process. A RECORDING_COMPLETE event is called.

Constant Detail
FREEFORM_DICTATIONConstant
public static const FREEFORM_DICTATION:Number = 3

Free form dictation, such as a written document

FREEFORM_DISABLEDConstant 
public static const FREEFORM_DISABLED:Number = 0

Disable free form speech recognition.

FREEFORM_INSTANT_MESSAGEConstant 
public static const FREEFORM_INSTANT_MESSAGE:Number = 5

A message for an instant message client

FREEFORM_MEMOConstant 
public static const FREEFORM_MEMO:Number = 7

A memo or a list of items

FREEFORM_MESSAGEConstant 
public static const FREEFORM_MESSAGE:Number = 4

A message addressed to another person.

FREEFORM_SMSConstant 
public static const FREEFORM_SMS:Number = 1

A SMS or TXT message.

FREEFORM_TRANSCRIPTConstant 
public static const FREEFORM_TRANSCRIPT:Number = 6

General transcription

FREEFORM_VOICEMAILConstant 
public static const FREEFORM_VOICEMAIL:Number = 2

A voice mail transcription