SpeechRecognition: maxAlternatives property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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

The default value is 1.

Value

A number representing the maximum returned alternatives for each result.

Examples

This code is excerpted from our Speech color changer example.

js
const recognition = new SpeechRecognition();
recognition.lang = "en-US";
recognition.interimResults = false;
recognition.maxAlternatives = 1;

// …

Specifications

Specification
Web Speech API
# dom-speechrecognition-maxalternatives

Browser compatibility

See also