This npm package provides a simple and convenient way to perform text-to-speech (TTS) synthesis in your web applications. It utilizes either the Web Speech API or an external API to convert text into spoken language.
- Easy-to-use interface for integrating text-to-speech functionality into your web applications.
- Supports multiple languages.
- Allows customization of speech parameters such as language, rate, and pitch.
- Compatible with modern web browsers.
- Not allow multiple click
- Stop Speech
- Handle speech complete
You can install the package via npm:
npm i commontown-text-to-speech
import {getAudio} from 'commontown-text-to-speech';
const domain = 'example.com';
const text = "Hello, welcome to our website!";
const lang = 'en';
const rate = 1;
const pitch = 1;
const voice = '' (refer to ("https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=tts"))
getAudio({domain, text, lang, rate, pitch, voice});
- domain (mandatory): The domain name where the speech synthesis is being performed.
- text (mandatory): The text to be converted to speech.
- lang (optional, default: 'en'): The language code for the desired speech output.
- rate (optional, default: 1): The rate at which the speech is spoken.
- pitch (optional, default: 1): The pitch of the speech.
- voice (optional, default: ""): The voice of the speech.(refer to ("https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=tts")) Supported Browsers
This package is compatible with modern web browsers that support the Web Speech API. For maximum compatibility, please refer to the browser compatibility list provided by the Web Speech API documentation.
Contributions and feedback are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on our GitHub repository.
This package is licensed under the MIT License. See the LICENSE file for details.
This npm package is maintained by Commontown.
We would like to thank the creators and contributors of the Web Speech API and other TTS APIs for making this package possible.