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

nodtts

v1.0.1

Published

NodeJS based CLI tool to generate speech file from text (tts/text-to-speech)

Downloads

2

Readme

Summary

NPM

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:

import nodtts from 'nodtts'

// Generate speech from text and save to a file
await nodtts.file("~/voices/hello.mpg", "Hello from Indonesia!")

// Other available functions:
// Generate file url only. This func also need internet to work
const url = await nodtts.url("Hello from Indonesia!")

// Generate file stream you can pipe
const stream = await nodtts.stream("Hello from Indonesia!")
const testfile = fs.createWriteStream("~/voices/test.mpg")

stream.pipe(testfile)

fwstream.on('finish', function () {
    fwstream.close(callbackfn)
})

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.file("~/voices/hello.mpg", "Hello from Indonesia!", "en", 2.5)

// also supported in url() and stream()
const url = await nodtts.url("Hola!", "sp", 2.5)
const stream = await nodtts.stream("Hello!", "en", 2.5)

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.