Git Product home page Git Product logo

aws-tts's Introduction

AWS Text-To-Speech

Command-line tool to convert a text file of any size to speech using the AWS Polly API.

Animation of the tool in action

Requirements / Installation

You can then install the package globally:

$ npm install aws-tts -g

You'll also need to get your AWS access keys and configure your machine with your credentials.

Usage

$ aws-tts [inputfile] outputfile [options]

Example:

# Using a text file as the input, changing the default voice, and specifying the AWS keys.
$ aws-tts test.txt test.mp3 --voice Brian --access-key ABCDEFG --secret-key hwl500CZygitV91n

# Passing a string of text as the input.
$ echo "Hello world! How are you?" | aws-tts test.mp3

Standard arguments:

  • inputfile is the text file you want to convert to speech. If excluded, aws-tts will read in the text from stdin.
  • outfile is the filename to save the audio to.

Options:

  • --access-key KEY -- AWS access key ID
  • --ffmpeg BINARY -- Path to the ffmpeg binary (defaults to the one in PATH)
  • --format FORMAT -- Target audio format (mp3, ogg_vorbis, or pcm) (default mp3)
  • --lexicon NAME -- Apply a stored pronunciation lexicon. Can be specified multiple times.
  • --region REGION -- AWS region to send requests to (default us-east-1)
  • --sample-rate RATE -- Audio frequency, in hertz. See the API docs for valid values.
  • --secret-key KEY -- AWS secret access key
  • --throttle SIZE -- Number of simultaneous requests allowed against the AWS API (default 5)
  • --type TYPE -- Type of input text (text or ssml) (default text)
  • --voice VOICE -- Voice to use for the speech (default Joanna). See the API docs for the full list of voices. You can also test out the voices in the AWS console.

What It Does

  • Splits the text into the maximum size allowed by the AWS API (1500 characters).
  • Compresses the white space inside the text to minimize the AWS cost.
  • Uses your AWS credentials in ~/.aws/credentials.
  • Calls the AWS API (in a throttled manner) to get each text part converted to audio.
  • Combines the audio together into a single file.

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 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.

aws-tts's People

Contributors

eheikes avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.