This package is meant to lighten the work around TTS in browsers. It's compatible for every browser because it calls Google Translate API as backup speech.
🟧 Warning The package works, but expect further updates with API changes.
npm i easy-tts
import { speak, listWords } from "easy-tts"
await speak({
lng: "en",
text: "Hey, hear my beautiful voice!",
voiceName: listWords("EN").filteredVoiceNames[0],
volume: 75,
});
import { speak, GoogleVoiceName } from "easy-tts"
await speak({
lng: "en",
text: "Hey, hear my beautiful voice!",
voiceName: GoogleVoiceName, // sets the voice of Google Translate
volume: 75,
stopCurrentSpeech: false,
pitch: 1.5,
rate: 2, // 2x speed of voice
forceGoogleMinRate: 0.5,
forceGoogleMaxRate: 5
});
import { speak, listWords, GoogleVoiceName } from "easy-tts"
await speak({
lng: "en",
text: "Hey, hear my beautiful voice!",
voiceName: GoogleVoiceName,
volume: 75,
});
Check whether or not the user's browser is capable of using built in TTS.
import { checkSpeechSynthesisCompatibility } from "easy-tts"
checkSpeechSynthesisCompatibility()
checkSpeechSynthesisCompatibility("en")
import { cancelSpeech, resumeSpeech, pauseSpeech, speak } from "easy-tts";
speak({...})
pauseSpeech()
resumeSpeech()
speak({...})
cancelSpeech()
- Appending hidden audio element
- Provide an example of user's choice of TTS voice
- Fn stop
- Fn pause
- Fn resume
- Fn isSpeaking
- Pitch option
- Async