![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
A React component that synthesis text into speech using Web Speech API
A React component that synthesis text into speech using Web Speech API.
This project scaffold can be found at compulim/react-component-template
.
Try out the demo at https://compulim.github.io/react-say/.
First, run npm install react-say
for production build. Or run npm install react-say@master
for latest development build.
The following will speak the text immediately upon showing up. Some browsers may not speak the text until the user interacted with the page.
import Say from 'react-say';
export default props =>
<Say speak="A quick brown fox jumped over the lazy dogs." />
You may want to customize the speech by varying pitch, rate, and volume. You can use <Composer>
and <Say>
to say your text.
import Say from 'react-say';
export default props =>
<Say
pitch={ 1.1 }
rate={ 1.5 }
speak="A quick brown fox jumped over the lazy dogs."
volume={ .8 }
/>
Note: variation will take effect for new/modified
<Say>
You may want to say something after the user interacted with the page, for example, after clicking on a button. We have built <SayButton>
that speak immediately after clicking on it. Some browsers may requires "priming" with a button.
import { SayButton } from 'react-say';
export default props =>
<SayButton
onClick={ event => console.log(event) }
speak="A quick brown fox jumped over the lazy dogs."
>
Tell me a story
</SayButton>
Instead of passing a SpeechSynthesisVoice
object, you can pass a function (voices: SpeechSynthesisVoice[]) => SpeechSynthesisVoice
to select the voice just before the text is synthesized.
import Say from 'react-say';
export default props =>
<Say
speak="A quick brown fox jumped over the lazy dogs."
voice={ voices => [].find.call(voices, v => v.lang === 'zh-HK') }
/>
Note: it also works with
<SayButton>
.
SpeechSynthesis
You can bring your own window.speechSynthesis
and window.speechSynthesisUtterance
for custom speech synthesis. For example, you can bring Azure Cognitive Services thru web-speech-cognitive-services
package.
import Say from 'react-say';
import { speechSynthesis, SpeechSynthesisUtterance, SubscriptionKey } from 'web-speech-cognitive-services';
// You will need to wait until the speech token has been exchanged
// The part has been omitted for code clarity
speechSynthesis.speechToken = new SubscriptionKey('your subscription key');
export default props =>
<Say
speak="A quick brown fox jumped over the lazy dogs."
speechSynthesis={ speechSynthesis }
speechSynthesisUtterance={ SpeechSynthesisUtterance }
voice={ voices => [].find.call(voices, v => v.lang === 'zh-HK') }
/>
Note:
speechSynthesis
is camel-casing because it is an instance.
<Say>
or <SayButton>
is unmounted, the utterance will continue to speak
Like us? Star us.
Want to make it better? File us an issue.
Don't like something you see? Submit a pull request.
FAQs
[![npm version](https://badge.fury.io/js/react-say.svg)](https://badge.fury.io/js/react-say) [![Build Status](https://travis-ci.org/compulim/react-say.svg?branch=master)](https://travis-ci.org/compulim/react-say)
The npm package react-say receives a total of 0 weekly downloads. As such, react-say popularity was classified as not popular.
We found that react-say demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.