Installations
npm install tts-cli
Developer Guide
Typescript
No
Module System
N/A
Node Version
20.5.0
NPM Version
10.8.2
Score
41.5
Supply Chain
93.9
Quality
73.8
Maintenance
100
Vulnerability
97.6
License
Releases
tts-cli@5.3.0
Published on 15 Apr 2024
tts-cli@5.2.0
Published on 07 Nov 2023
tts-cli@5.1.0
Published on 05 Nov 2023
tts-cli@5.0.0
Published on 29 Oct 2023
tts-cli@4.0.0
Published on 29 Oct 2023
tts-cli@3.0.2
Published on 29 Oct 2023
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
eheikes
Download Statistics
Total Downloads
5,528
Last Day
3
Last Week
7
Last Month
26
Last Year
763
GitHub Statistics
94 Stars
392 Commits
17 Forks
6 Watching
5 Branches
2 Contributors
Package Meta Information
Latest Version
5.4.0
Package Id
tts-cli@5.4.0
Unpacked Size
31.13 kB
Size
10.77 kB
File Count
15
NPM Version
10.8.2
Node Version
20.5.0
Publised On
15 Sept 2024
Total Downloads
Cumulative downloads
Total Downloads
5,528
Last day
50%
3
Compared to previous day
Last week
40%
7
Compared to previous week
Last month
-54.4%
26
Compared to previous month
Last year
-62%
763
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Text-To-Speech CLI
Command-line tool to convert a text file of any size to speech using AWS Polly or Google Cloud Text-to-Speech.
Requirements / Installation
- Node.js/npm v18+
- ffmpeg
- An Amazon Web Services (AWS) or Google Cloud Platform (GCP) account
You can then install the package globally:
$ npm install tts-cli -g
You'll also need to set up your computer:
- AWS Polly: Get your AWS access keys and configure your machine with your credentials.
- Google Cloud Text-to-Speech: Create and set up a Cloud Platform account and download your credentials file.
Usage
$ tts [inputfile] outputfile [options]
Example:
# Using a text file as the input, changing the default voice, and specifying the AWS keys.
$ tts test.txt test.mp3 --voice Brian --access-key ABCDEFG --secret-key hwl500CZygitV91n
# Using Google Cloud Text-to-Speech.
$ tts test.txt test.mp3 --service gcp --language en-US
# Passing a string of text as the input.
$ echo "Hello world! How are you?" | tts test.mp3
Standard arguments:
inputfile
is the text file you want to convert to speech. It should be encoded as UTF-8. If excluded, tts-cli will read in the text fromstdin
.outfile
is the filename to save the audio to.
Service options:
--access-key KEY
-- AWS access key ID--email EMAIL
-- GCP client email address (required ifprivate-key
orprivate-key-file
is used)--private-key KEY
-- GCP private key--private-key-file FILE
-- GCP private key file (.pem
or.p12
file)--project-file FILE
-- GCP.json
file with project info--project-id ID
-- GCP project ID (e.g.grape-spaceship-123
)--secret-key KEY
-- AWS secret access key--service TYPE
-- Cloud service to use (aws
orgcp
) (defaultaws
)--throttle SIZE
-- Number of simultaneous requests allowed against the API (default5
)
Audio options:
--effect ID
-- Apply an audio effect profile. Can be specified multiple times.--ffmpeg BINARY
-- Path to the ffmpeg binary (defaults to the one in PATH)--format FORMAT
-- Target audio format (mp3
,ogg
, orpcm
) (defaultmp3
)--gain GAIN
-- Volume gain, where0.0
is normal gain--gender GENDER
-- Gender of the voice (male
,female
, orneutral
)--language LANG
-- Code for the desired language (defaulten-US
for GCP, no default for AWS)--lexicon NAME
-- Apply a stored pronunciation lexicon. Can be specified multiple times.--pitch PITCH
-- Change in speaking pich, in semitones--speed RATE
-- Speaking rate, where1.0
is normal speed--region REGION
-- AWS region to send requests to (defaultus-east-1
)--sample-rate RATE
-- Audio frequency, in hertz. See the API docs for valid values.--type TYPE
-- Type of input text (text
orssml
) (defaulttext
)--voice VOICE
-- Voice to use for the speech (defaultJoanna
for AWS).
Note that not all services support all options. For example, AWS Polly does not understand the speed
option. See the options documentation for more info.
What It Does
- Splits the text into the maximum size allowed by the API (1500 characters for AWS, 5000 characters for Google Cloud).
- Compresses the white space inside the text to minimize the cost.
- Uses your credentials in
~/.aws/credentials
(AWS) or theGOOGLE_APPLICATION_CREDENTIALS
(Google Cloud) file. - Calls the API (in a throttled manner) to get each text part converted to audio.
- Combines the audio together into a single file.
Troubleshooting
- Make sure Node.js is working. Running
node --version
on the command line should give a version of v10.0.0 or higher. - Make sure ffmpeg is installed. Running
ffmpeg -version
on the command line should give you the version information. - Make sure you can connect to AWS or Google Cloud normally.
- Going to https://polly.us-east-1.amazonaws.com/v1/speech (or whatever AWS region you're using) should give you a "Missing Authentication Token" message. You can use the AWS CLI tool to check your configuration -- installing that and running
aws sts get-caller-identity
should return your user info.
- Going to https://polly.us-east-1.amazonaws.com/v1/speech (or whatever AWS region you're using) should give you a "Missing Authentication Token" message. You can use the AWS CLI tool to check your configuration -- installing that and running
- Run
export DEBUG=*
first (Linux or Mac) to turn on debugging output. On Windows you'll need to useset DEBUG=*
(command prompt) or$env:DEBUG = "*"
(PowerShell).
Contributing
Pull requests and suggestions are welcome. Create a new issue to report a bug or suggest a new feature.
Please add tests and maintain the existing styling when adding and updating the code. Run npm run lint
to lint the code.
Small Print
Copyright 2017-2020 Eric Heikes.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This project is not affiliated with Amazon or Google.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE.txt:0
- Info: FSF or OSI recognized license: Apache License 2.0: LICENSE.txt:0
Reason
SAST tool is run on all commits
Details
- Info: all commits (23) are checked with a SAST tool
Reason
2 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-7v5v-9h63-cj86
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
Reason
Found 0/14 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yaml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/eheikes/tts/ci.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/eheikes/tts/ci.yaml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yaml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/eheikes/tts/ci.yaml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yaml:26
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3.9
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to tts-cli
aws-tts
CLI tool to convert text to speech using AWS Polly
tts-dev-helper
A simple CLI app to help make development, with version control, easier for Tabletop Simulator
extra-googletts
Generate speech audio from super long text through machine, via Google TTS, ffmpeg.
@tts-tools/cli
Command line interface for different TTS Tools.