npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

voicemaker

v1.2.0

Published

Make your nodeJs speak

Downloads

38

Readme

Voicemaker

This Api make your nodeJS app or script speak. NPM Version

With this API you can use and compare available TTS APIs from Google, voicemaker.in, IBM Watson, more are comming.

Configure Environment

Google cloud

To make Google cloud TTS works, define a GOOGLE_APPLICATION_CREDENTIALS env variable:

  • Go to your google console
  • Create a project
  • Activate Google text-to-speech API for your project
  • Enable Billing
  • create a client
  • create and download a json certificate
  • set your GOOGLE_APPLICATION_CREDENTIALS environment variable to a path to your json certificate file.

Powershell:

$Env:GOOGLE_APPLICATION_CREDENTIALS = "c://pathtoyourCERT"

Unix:

export GOOGLE_APPLICATION_CREDENTIALS="/pathtoyourCERT"

Alternatively you can save your certificate in ~/.tts/googlecloud/key.json.

ElevenLabs

To make elevenlabs TTS works, define an ELEVENLABS_IO_TOKEN env variable, log on https://beta.elevenlabs.io/ and go to Profile Settings to get one.

Then put it onto your ELEVENLABS_IO_TOKEN valiable.

Powershell:

$Env:ELEVENLABS_IO_TOKEN = "123456781234567890abcdef12345678"

Unix:

export ELEVENLABS_IO_TOKEN="123456781234567890abcdef12345678"

Alternatively you can save your certificate in ~/.tts/elevenlabs/key.json (as text data).

Voicemaker

To make voicemaker TTS works, define an VOICEMAKER_IN_TOKEN env variable, to get this token, send an E-Mail to [email protected] asking for a developper token.

Then put it onto your VOICEMAKER_IN_TOKEN valiable.

Powershell:

$Env:VOICEMAKER_IN_TOKEN = "12345678-abcd-1234-1234-1234567890ab"

Unix:

export VOICEMAKER_IN_TOKEN="12345678-abcd-1234-1234-1234567890ab"

Alternatively you can save your certificate in ~/.tts/voiceMaker/key.json (as text data).

IBM Watson

To make IBM watson TTS works, define an TEXT_TO_SPEECH_APIKEY and TEXT_TO_SPEECH_URL env variable, you can get them from an ibm-credentials.env file from https://cloud.ibm.com/

Alternatively you can save your certificate in ~/.tts/watson/key.json (as text data or a json file).

Usage as a script

This package includes a binary that can use every voice from any script; this script is optimized to let you easily switch between engines, volume, speed, and pitch values, which are normalized to -100% to +100%.

npm install -g voicemaker
voicemaker --help

Help message

Usage: voicemaker [options] [command]

Options:
  -V, --version            output the version number
  -h, --help               display help for command

Commands:
  list <engine>            list available voices
  say [options] <text...>  use a TTS engin to make your computer speak
  help [command]           display help for command
Usage: voicemaker say [options] <text...>

use a TTS engine to make your computer speak

Options:
  -v, --voice <name>     select a voiceMaker, IBM watson, or a google cloud TTS voice.
  -s, --speed <speed>    customise talk speed
  -p, --pitch <pitch>    customise talk pitch
  -l, --lang <lang>      specify a lang code
  -V, --volume <volume>  increate or decrease speech volume
  -h, --help             display help for command

List available voices

For google voices

voicemaker list google

For voicemaker voices

voicemaker list voicemaker

Make it talk

Using google free voices

voicemaker say hello word
voicemaker say -l es-ES vamos a la playa

Using google cloud voices

voicemaker say -v fr-FR-Standard-C bienvenue chez nous

Using voicemaker voices

voicemaker say -v ai2-de-DE-Patrick Willkommen
voicemaker say -v ai2-ja-JP-Ayaka こんにちは

Useage as an API

npm install voicemaker

This package integrates 3 TTS API:

Engine translate.google.com

You do not need any configuration to use the legacy google TTS just use the GoogleTTS class.

import { GoogleTTS, GoogleTTSRequest } from 'voicemaker';

const engine = new GoogleTTS();
const request = new GoogleTTSRequest('hello');
const filename = await engine.getTts(request);
console.log(`your speech is available in ${filename}`);
// Let it speak using translate.google.com engine
await engine.say(request);

Engine google cloud TTS

import { GoogleTTS2, GoogleTTS2Request } from 'voicemaker';

const engine = new GoogleTTS2();
const request = new GoogleTTS2Request('hello');
const filename = await engine.getTts(request);
console.log(`your speech is available in ${filename}`);
// Let it speak using cloud.google.com engine
await engine.say(request);

Advanced usage:

import { GoogleTTS2, GoogleTTS2Request } from 'voicemaker';

const engine = new GoogleTTS2();
const request = new GoogleTT2SRequest('hello');
const filename = await engine.getTts(request);
// change the speaker to Ai1 Ivy
request.setVoice("en-GB-Wavenet-D");
// increate pitch by 4 (min value is -20, max is 20)
request.pitch = 2;
// increate volume by 10 (min value is -20, max is 20)
request.volume = 1;
// increate speed by -10 (min value is -96 Db, max is +16Db)
request.speed = -3;

console.log(`your speech is available in ${filename}`);
// Let it speak using cloud.google.com engine
await engine.say(request);

Engine voicemaker.in

To use voicemaker.in API you must define your developer token in the VOICEMAKER_IN_TOKEN environment variable.

import { VoiceMaker, VoiceMakerRequest } from 'voicemaker';


const engine = new VoiceMaker();
const request = new VoiceMakerRequest('hello');
// change the speaker, and this call will also change the language to es-ES
request.setVoice("ai4-es-ES-Matlab");
const filename = await engine.getTts(request);
console.log(`your speech is available in ${filename}`);
// Let it speak using voicemaker.in
await engine.say(request);

Advanced usage:

import { VoiceMaker, VoiceMakerRequest } from 'voicemaker';

const engine = new VoiceMaker();
const request = new VoiceMakerRequest('Your very secret password is 123456');
// change the speaker to Ai1 Ivy
request.setVoice("ai1-Ivy");
// increate pitch by 4 (min value is -100, max is 100)
request.pitch = 4;
// increate volume by 10 (min value is -20, max is 20)
request.volume = 10;
// increate speed by -10 (min value is -100, max is +100)
request.speed = -10;
// whisper the message
request.effect = "whispered";
// whisper you password
await engine.say(request);

Notes

Cache and log

By default, every generated speech will be cached in the ~/.tts directory; a log.txt will also be added and will contain all cached requests.