Speech

Simplicite.UI. Speech

new Speech(app, ui, view)

Description:
  • Web Speech API

Parameters:
Name Type Description
app Simplicite.Ajax

Ajax service

ui Simplicite.UI.Engine

Main UI controller

view Simplicite.UI.View.Main

View services

Methods

assist(options)

Description:
  • Simple assistant (experimental)

Parameters:
Name Type Description
options Object

Parameters

Properties
Name Type Description
hotword string

optional hotword to detect commands (supports translated TEXT)

commands Array.<Object>

optional commands { name, priority, phrase, callback, regexp }

continuous boolean

continuous speaking? (default true to accept sentences)

autoRestart boolean

auto restart the recognition? (default true to accept long silence)

maxAlternatives number

max recognition alternatives (default 10)

lang string

optional lang (default user's language)

debug boolean

optional console info

createSpeechRecognition()

Description:
  • New SpeechRecognition if exists

getVoice(voices, lang, use)

Description:
  • Find a voice matching language

Parameters:
Name Type Description
voices Array

supported voices

lang string

Language FRA, ENU...

use string

Try to use this voice if supported

getVoices(ss, cbk)

Description:
  • Get browser voices

Parameters:
Name Type Description
ss Object

speechSynthesis

cbk function

callback(voices)

langISO(l)

Description:
  • Get language ISO

Parameters:
Name Type Description
l string

language FRA, ENU...

Returns:

ISO code (ex fr-FR)

recognition(el, options)

Description:
  • Speech recognition

Parameters:
Name Type Description
el Object

Element input or textarea

options Object

Options

Properties
Name Type Description
lang string

Language (ex: FRA, ENU or fr-FR, en-GB...)

continuous boolean

Continuous speaking (sentence)?

autoRestart boolean

Continuous speaking (no timeout after long silence)?

interimResults boolean

Get interim results?

maxAlternatives number

Max alternatives search

firstCapital boolean

First character uppercase in a sentence?

newLine boolean

Accept new line symbol?

onStart function

Optional handler when started

onEnd function

Optional handler when ended

onError function

Optional handler on error

onChange function

Optional handler to override change event

debug boolean

Optional console info

speak(el, options)

Description:
  • Speech synthesis (experimental)

Parameters:
Name Type Description
el Object

Text or input or textarea

options Object

Options

Properties
Name Type Description
lang string

Preferred language FRA, ENU...

voice string

Optional voice name to force if exists

uri string

Service URI, default native

volume string

0 to 1, default 1

rate string

0.1 to 10, default 1

pitch string

0 to 2, default 1

onStart function

Optional handler when started

onEnd function

Optional handler when ended

debug boolean

Optional console info

speakStart(msg)

Description:
  • Start to speech

Parameters:
Name Type Description
msg SpeechSynthesisUtterance

Message to read

speakStop()

Description:
  • Stop current speech