Table of Contents

Class SpeechRecognition

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The SpeechRecognition interface of the Web Speech API is the controller interface for the recognition service; this also handles the SpeechRecognitionEvent sent from the recognition service.

[Value("SpeechRecognition")]
public class SpeechRecognition : EventTarget
Inheritance
SpeechRecognition
Inherited Members

Remarks

NOTE

On some browsers, like Chrome, using Speech Recognition on a web page involves a server-based recognition engine. Your audio is sent to a web service for recognition processing, so it won't work offline.

-Web Speech API

See also on MDN

Constructors

SpeechRecognition()

The SpeechRecognition() constructor creates a new
SpeechRecognition object instance.

public SpeechRecognition()

Remarks

Properties

Continuous

The continuous property of the
SpeechRecognition interface controls whether continuous results are
returned for each recognition, or only a single result.

[Value("continuous")]
public bool Continuous { get; set; }

Property Value

bool

A boolean value representing the current SpeechRecognition's
continuous status. true means continuous, and false means not
continuous (single result each time.)

Remarks

It defaults to single results (false.)

-Web Speech API

See also on MDN

Grammars

The grammars property of the
SpeechRecognition interface returns and sets a collection of
SpeechGrammar objects that represent the grammars that will be understood
by the current SpeechRecognition.

[Value("grammars")]
public SpeechGrammarList Grammars { get; set; }

Property Value

SpeechGrammarList

A SpeechGrammarList containing the SpeechGrammar objects
that represent your grammar for your app.

Remarks

InterimResults

The interimResults property of the
SpeechRecognition interface controls whether interim results should be
returned (true) or not (false). Interim results are results
that are not yet final (e.g., the IsFinal property
is false).

[Value("interimResults")]
public bool InterimResults { get; set; }

Property Value

bool

A boolean value representing the state of the current
SpeechRecognition's interim results. true means interim
results are returned, and false means they aren't.

Remarks

The default value for interimResults is false.

-Web Speech API

See also on MDN

Lang

The lang property of the SpeechRecognition
interface returns and sets the language of the current SpeechRecognition.
If not specified, this defaults to the HTML lang attribute
value, or the user agent's language setting if that isn't set either.

[Value("lang")]
public string Lang { get; set; }

Property Value

string

A string representing the BCP 47 language tag for the current SpeechRecognition.

Remarks

MaxAlternatives

The maxAlternatives property of the
SpeechRecognition interface sets the maximum number of
SpeechRecognitionAlternatives provided per
SpeechRecognitionResult.

[Value("maxAlternatives")]
public ulong MaxAlternatives { get; set; }

Property Value

ulong

A number representing the maximum returned alternatives for each result.

Remarks

The default value is 1.

-Web Speech API

See also on MDN

Onaudioend

[Value("onaudioend")]
public EventHandlerNonNull Onaudioend { get; set; }

Property Value

EventHandlerNonNull

Onaudiostart

[Value("onaudiostart")]
public EventHandlerNonNull Onaudiostart { get; set; }

Property Value

EventHandlerNonNull

Onend

[Value("onend")]
public EventHandlerNonNull Onend { get; set; }

Property Value

EventHandlerNonNull

Onerror

[Value("onerror")]
public EventHandlerNonNull Onerror { get; set; }

Property Value

EventHandlerNonNull

Onnomatch

[Value("onnomatch")]
public EventHandlerNonNull Onnomatch { get; set; }

Property Value

EventHandlerNonNull

Onresult

[Value("onresult")]
public EventHandlerNonNull Onresult { get; set; }

Property Value

EventHandlerNonNull

Onsoundend

[Value("onsoundend")]
public EventHandlerNonNull Onsoundend { get; set; }

Property Value

EventHandlerNonNull

Onsoundstart

[Value("onsoundstart")]
public EventHandlerNonNull Onsoundstart { get; set; }

Property Value

EventHandlerNonNull

Onspeechend

[Value("onspeechend")]
public EventHandlerNonNull Onspeechend { get; set; }

Property Value

EventHandlerNonNull

Onspeechstart

[Value("onspeechstart")]
public EventHandlerNonNull Onspeechstart { get; set; }

Property Value

EventHandlerNonNull

Onstart

[Value("onstart")]
public EventHandlerNonNull Onstart { get; set; }

Property Value

EventHandlerNonNull

Methods

Abort()

The abort() method of the Web Speech API stops the speech
recognition service from listening to incoming audio, and doesn't attempt to return a
SpeechRecognitionResult.

[Value("abort")]
public GlobalObject.Undefined Abort()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

Start()

The start() method of the Web Speech API starts the speech
recognition service listening to incoming audio with intent to recognize grammars
associated with the current SpeechRecognition.

[Value("start")]
public GlobalObject.Undefined Start()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

Stop()

The stop() method of the Web Speech API stops the speech
recognition service from listening to incoming audio, and attempts to return a
SpeechRecognitionResult using the audio captured so far.

[Value("stop")]
public GlobalObject.Undefined Stop()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks