File size: 390 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# `useSpeech`
React UI hook that synthesizes human voice that speaks a given string.
## Usage
```jsx
import {useSpeech} from 'react-use';
const voices = window.speechSynthesis.getVoices();
const Demo = () => {
const state = useSpeech('Hello world!', { rate: 0.8, pitch: 0.5, voice: voices[0] });
return (
<pre>
{JSON.stringify(state, null, 2)}
</pre>
);
};
```
|