text-to-speech-converter
v1.2.0
Published
"play around converter"
Downloads
3
Readme
Text-to-speech-converter
text-to-speech-converter is a Node.js package that provides a simple API for converting text to speech using the festival
text-to-speech synthesis tool.
Github
git clone https://github.com/Francis-Mwaniki/TextToSpeechApi
Installation
Before you can use this package, you need to ensure that the festival
text-to-speech synthesis tool is installed on your system. Follow the instructions below based on your operating system:
Linux (Debian-based systems, including Ubuntu):
sudo apt-get update
sudo apt-get install festival
Mac OS X:
brew install festival
Windows:
Running Festival on Windows
Using Windows Subsystem for Linux (WSL):
Windows Subsystem for Linux (WSL) allows you to run a Linux distribution alongside your Windows installation. This method enables you to use Festival within a Linux environment on your Windows system.
Enable WSL:
Enable WSL: Follow the instructions from Microsoft's official documentation to enable WSL on your Windows version. You can find detailed steps here.
Install a Linux Distribution:
- Open Microsoft Store and search for a Linux distribution like Ubuntu.
- Install the Linux distribution of your choice.
Run Festival in Linux Environment:
Open the Installed Linux Distribution:
- After installation, open the installed Linux distribution from the Start menu. It will open a Linux terminal window.
Install and Run Festival:
- Inside the Linux terminal, you can use standard Linux commands, including installing and running Festival. For example:
sudo apt-get update sudo apt-get install festival festival
- Inside the Linux terminal, you can use standard Linux commands, including installing and running Festival. For example:
Usage
const TextToSpeech = require('text-to-speech-converter')
async function testSpeechGeneration() {
try {
const outputFilePath = 'output';
const text = 'Hello francis, this is a test';
const result = await TextToSpeech(text, outputFilePath);
console.log(result);
} catch (error) {
console.error('Error:', error);
}
}
testSpeechGeneration();
How it works
The TextToSpeech
function takes in two parameters:
text
: The text to be converted to speech.outputFilePath
: The path to the output file where the speech will be saved.
The function returns a promise that resolves to the path of the output file.
Test Demo
node test.js