Text to speech
SpeechSynthesis and SpeechSynthesisUtterance
Baseline widely available
Chrome33
Edge14
Firefox49
Safari7
Features it needs
- Speech synthesisWidely available
speak-tts is a queueing and promise layer over the browser's own SpeechSynthesis API. The browser already exposes every installed system voice and a speaking queue; the wrapper mostly makes calling it feel more like a promise.
When this applies
Reading text aloud with the browser's own text-to-speech engine.
The native approach
const utterance = new SpeechSynthesisUtterance("Hello there");
speechSynthesis.speak(utterance);When the dependency is still right
An answer that always says "the platform covers it" is worse than no answer. These are the cases where this one does not hold.
- You need the voice list on first paint. speechSynthesis.getVoices() returns an empty array until the voiceschanged event fires, so a voice picker has to wait for it, and that timing is most of what speak-tts wraps.
- You speak long passages in Chrome, which cuts an utterance off after roughly fifteen seconds unless something keeps resuming it.
- You need a specific voice bundled with your app rather than whatever the person's operating system happens to have installed. Voice availability and quality vary by device.
- You need the callback-based API wrapped in a promise, or queueing logic across multiple utterances. The library still saves real code there.