nodtts
Summary
A NodeJS package to generate sound file from text.
Basically a text-to-speech, and save it for you to a file. This tool works over Google Translate's API hence needing internet to actually work. This is designed to be a port of text-to-speech-file. Built over JS Promises.
Get Started
Installation
Install nodtts
using the npm package manager:
# install globally to use nodtts command $ npm install -g nodtts # install as package/library $ npm install nodtts
Usage
Using as Shell Command
If you installed nodtts as global package, you can use nodtts
to generate voice files from texts wherever, directly from your shell.
# install globally to use nodtts command $ npm install -g nodtts # BASIC ARGS: # run this command for the most basic usage # this will create 'Hello from Shrotavre.mpg' in your current directory $ nodtts text="Hello from Shrotavre!" # OTHER ARGS: # 'dir' and 'name' args to set where to save the files $ nodtts text="Hello!" dir="/Documents/voices" name="test.mpg" # 'lang' arg to set voice language/locale # see here for more information on available locales: $ nodtts text="Halo, apa kabar?" lang="id" # 'speed' arg to set voice talking speed. default value is 2.5 $ nodtts text="Hello!" speed=6
Using as NodeJS Package/Library
The basic usages of nodtts
are like this:
// Generate speech from text and save to a fileawait nodtts // Other available functions:// Generate file url only. This func also need internet to workconst url = await nodtts // Generate file stream you can pipeconst stream = await nodttsconst testfile = fs stream fwstream
All nodtts.file()
, nodtts.url()
, an nodtts.stream()
also support two additional parameters you can supply:
// You can change two parameters in the last 2 params of function:// - locales/lang: (string) like `en`/`id` default to `en`// - speech speed: (float) like 2.5 default to `2.5`await nodtts // also supported in url() and stream()const url = await nodttsconst stream = await nodtts
Contributing
Documentation is an OPEN Open Source Project. This means that:
This project is open for issues and suggestion.
Also, individuals making significant and valuable contributions are going to be given commit-access to the project to contribute as they see fit.