Skip to content

Simplifying the Speech Synthesis and Speech Recognition engines for Javascript. Listen for commands and perform callback actions, make the browser speak and transcribe your speech!

License

Notifications You must be signed in to change notification settings

mastashake08/speech-kit

Speech Kit

GPL license Version PRs Welcome Maintenance Website jyroneparker.com Patreon Twitter CodeLife Discord online members

Simplifying the Speech Synthesis and Speech Recognition engines for Javascript. Listen for commands and perform callback actions, make the browser speak and transcribe your speech!

Features

  • Speak Commands
  • Listen for voice commands
  • Add your own grammar
  • Transcribe words and output as file.
  • Generate SSML from text for fine tune editing.

Functions

listen()

Start listening for speech recognition.

stopListen()

Stop listening for speech recognition.

speak(text, [voice])

Use Speech Synthesis to speak text.

getResultList()SpeechRecognitionResultList

Get current SpeechRecognition resultsList.

getText()string

Return text

getTextAsFile()Blob

Return text file with results.

getTextAsJson()object

Return text as JSON.

addGrammarFromUri()

Add grammar to the SpeechGrammarList from a URI.

addGrammarFromString()

Add grammar to the SpeechGrammarList from a Grammar String.

getGrammarList()SpeechGrammarList

Return current SpeechGrammarList.

getRecognition()SpeechRecognition

Return the urrent SpeechRecognition object.

getSynth()SpeechSynthesis

Return the current Speech Synthesis object.

getVoices()Array.<SpeechSynthesisVoice>

Return the current voices available to the user.

setSpeechText()

Set the SpeechSynthesisUtterance object with the text that is meant to be spoken.

setSpeechVoice()

Set the SpeechSynthesisVoice object with the desired voice.

getCurrentVoice()SpeechSynthesisVoice

Return the current voice being used in the utterance.

share()null

Share the text using the Web Share API or copy to Clipboard if not available

createSSML()string

Takes text and returns SSML encoded XML object

parseSentenceSSML()string

Takes sentence and returns SSML paragraph object with sentences.

parseSSML()object | string

Takes text and returns SSML object

listen()

Start listening for speech recognition.

Kind: global function

stopListen()

Stop listening for speech recognition.

Kind: global function

speak(text, [voice])

Use Speech Synthesis to speak text.

Kind: global function

Param Type Default Description
text string Text to be spoken
[voice] SpeechSynthesisVoice Optional parameter to change the voice that speaks

getResultList() ⇒ SpeechRecognitionResultList

Get current SpeechRecognition resultsList.

Kind: global function
Returns: SpeechRecognitionResultList - - List of Speech Recognition results

getText() ⇒ string

Return text

Kind: global function
Returns: string - resultList as text string

getTextAsFile() ⇒ Blob

Return text file with results.

Kind: global function
Returns: Blob - transcript

getTextAsJson() ⇒ object

Return text as JSON.

Kind: global function
Returns: object - transcript

addGrammarFromUri()

Add grammar to the SpeechGrammarList from a URI.

Kind: global function
Params: string uri - URI that contains grammar

addGrammarFromString()

Add grammar to the SpeechGrammarList from a Grammar String.

Kind: global function
Params: string grammar - String containing grammar

getGrammarList() ⇒ SpeechGrammarList

Return current SpeechGrammarList.

Kind: global function
Returns: SpeechGrammarList - current SpeechGrammarList object

getRecognition() ⇒ SpeechRecognition

Return the urrent SpeechRecognition object.

Kind: global function
Returns: SpeechRecognition - current SpeechRecognition object

getSynth() ⇒ SpeechSynthesis

Return the current Speech Synthesis object.

Kind: global function
Returns: SpeechSynthesis - current instance of Speech Synthesis object

getVoices() ⇒ Array.<SpeechSynthesisVoice>

Return the current voices available to the user.

Kind: global function
Returns: Array.<SpeechSynthesisVoice> - Array of available Speech Synthesis Voices

setSpeechText()

Set the SpeechSynthesisUtterance object with the text that is meant to be spoken.

Kind: global function
Params: string text - Text to be spoken

setSpeechVoice()

Set the SpeechSynthesisVoice object with the desired voice.

Kind: global function
Params: SpeechSynthesisVoice voice - Voice to be spoken

getCurrentVoice() ⇒ SpeechSynthesisVoice

Return the current voice being used in the utterance.

Kind: global function
Returns: SpeechSynthesisVoice - current voice

share() ⇒ null

Share the text using the Web Share API or copy to Clipboard if not available

Kind: global function

createSSML() ⇒ string

Takes text and returns SSML encoded XML object

Kind: global function
Returns: string - - XML DOM object in SSML format serialized to a string
Params: string - Text to convert

parseSentenceSSML() ⇒ string

Takes sentence and returns SSML paragraph object with sentences.

Kind: global function
Returns: string - xmlString - XML DOM object in SSML format
Params: string xmlString - Text to convert

parseSSML() ⇒ object | string

Takes text and returns SSML object

Kind: global function
Returns: object | string - xmlDoc - XML DOM object in SSML format or XML object serialized to string
Params: string xmlString - Text to convert

Contributing

If you want to add functionality or fix a bug please provide a PR!

Sponsorships

This project is free for public use and will always be in perpetuity. That being said a brotha got bills to pay and ish! If you would like to sponsor this and all of my open source projects, then please consider becoming a patron on Patreon or a one time donation via Cash App

About

Simplifying the Speech Synthesis and Speech Recognition engines for Javascript. Listen for commands and perform callback actions, make the browser speak and transcribe your speech!

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published