Back

CreateSpeechRec

Returns a SpeechRec object.

For more information in the detailed docs see CreateSpeechRec

  spr = app.CreateSpeechRec( options ) → app object - SpeechRec

Example - Example



function OnStart()
{
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );

    btn = app.CreateButton( "Talk To Me", 0.3, 0.1 );
    btn.SetOnTouch( btn_OnTouch );
    lay.AddChild( btn );

    app.AddLayout( lay );

    speech = app.CreateSpeechRec();
    speech.SetOnReady( speech_OnReady );
    speech.SetOnResult( speech_OnResult );
    speech.SetOnError( speech_OnError );
}

function btn_OnTouch()
{
    speech.Recognize();
}

function speech_OnReady()
{
    app.ShowPopup( "Listening...", "Short" );
}

function speech_OnResult( results )
{
    app.ShowPopup( results[0] );
}

function speech_OnError()
{
    app.ShowPopup( "Please speak more clearly!" );
}
    Copy     Copy All       Run      

The following methods are available on the SpeechRec object:

  Cancel()
  GetRMS() → number: float
  GetType() → string: "SpeechRec"
  IsListening() → boolean
  Method( name, types, p1, p2, p3, p4 )
  Recognize()
  Stop()

string: "NoBeep"
stop recognision
?
Returns the control class name.
returns whether speechRec is listening
string
string: comma separated: "boolean", "char", "byte", "short", "int", "long", "float", "double"
Allows access to other functions defined on the object in Java via reflection.
start speech recognizion
function(error)
function()
function(result)
Stop speech recognizion