text-to-voice-converter
v1.0.1
Published
The text-to-voice-converter npm package is a versatile, TypeScript-first library designed to simplify the process of converting text into downloadable audio files, seamlessly integrating into both your frontend and backend JavaScript/TypeScript applicatio
Maintainers
Readme
text-to-voice-converter - Text-to-Voice Converter & Downloader (Frontend)
A TypeScript-first npm package designed for converting text into downloadable audio files, seamlessly integrating into your frontend (browser) applications.
✨ Features
- Customizable Voice & Audio: audio output format (MP3, WAV, OGG, etc.).
- Direct Browser Download: Simple utility for triggering audio file downloads directly in the user's browser.
- TypeScript Ready: Fully type-safe with comprehensive type definitions for a robust development experience.
🚀 Installation
Install the package using npm or yarn:
npm install text-to-voice-converter
# or
yarn add text-to-voice-converter
🛠️ Usage
This package provides functions to convert text to audio and initiate downloads directly in the browser.
Core Functions for Frontend Use
textToVoice(text: string, audioType?: 'audio/webm' | 'audio/wav' | 'audio/ogg'): Promise<Blob>
This is the primary function responsible for converting your text into a downloadable audio Blob using the browser's native Text-to-Speech capabilities.
text: The string of text you want to convert to speech.audioType: (Optional) The desired MIME type for the audio file. Supported types are'audio/webm','audio/wav', or'audio/ogg'. Defaults to'audio/webm'.- Returns: A
Promisethat resolves with anBlobobject. This Blob can then be used to create a downloadable link or played directly in the browser.
🤝 Contributing
Contributions are welcome! If you have suggestions for improvements, new features, or bug fixes, please open an issue or submit a pull request.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/Production). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/Production). - Open a Pull Request.
📄 License
Distributed under the MIT License. See LICENSE for more information.
