Size
0.58 kb
useSpeechSynthesis
Web Speech API synthesis, reactified.
Installation
Usage
Basic text-to-speech:
Configure speech options:
Cancel speaking and check the current state:
API Reference
UseSpeechSynthesisOptions
The options for the useSpeechSynthesis hook. See MDN docs for more details.
| Prop | Type | Default | 
|---|---|---|
volume? | number | - | 
pitch? | number | - | 
rate? | number | - | 
voice? | SpeechSynthesisVoice | null | - | 
lang? | string | - | 
UseSpeechSynthesisReturn
The return value of the useSpeechSynthesis hook.
| Prop | Type | Default | 
|---|---|---|
cancel | () => void | - | 
speak | (text: string) => void | - | 
error | SpeechSynthesisErrorEvent | null | - | 
state | "idle" | "speaking" | "error" | - | 
utterance | SpeechSynthesisUtterance | null | - |