Skip to content

polly is a simple CLI tool to transform academic plain text files into audio using AWS Polly.

License

Notifications You must be signed in to change notification settings

andrewrech/polly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Polly Text-to-Speech Converter

This Go package provides a command-line tool to convert academic plain text files into audio using AWS Polly. It supports various output formats and voices, and can handle large text files by splitting them into manageable tasks.

Features

  • Convert text files to audio using AWS Polly.
  • Support for multiple output formats (mp3, ogg_vorbis, pcm).
  • Choice of voice from a variety of options including regional accents.
  • Ability to handle large files by splitting text into smaller tasks.
  • Dry-run mode for testing text transformations without processing.
  • Output audio files directly to an AWS S3 bucket.

Prerequisites

  • Go 1.22
  • AWS account and AWS CLI configured with access to Polly and S3
  • Set up AWS credentials and default region through environment variables or AWS CLI

Installation

Clone the repository to your local machine:

git clone https://github.com/yourusername/aws-polly-tts-converter.git
cd aws-polly-tts-converter

Build the application:

go build -o tts-converter

Usage

Run the application with the required flags:

./tts-converter -input="path/to/your/textfile.txt" -bucket="your-s3-bucket-name" -prefix="desired-prefix-for-output-file" -voice="Joanna"

Command Line Options

  • -input: Filename containing text to convert (default "input.txt")
  • -engine: TTS engine (standard or neural, default "neural")
  • -format: Output format (mp3, ogg_vorbis, or pcm, default "mp3")
  • -bucket: Output S3 bucket name
  • -prefix: Output S3 bucket prefix (default uses the filename)
  • -voice: Voice to use for synthesis (default "Joanna")
  • -dry-run: Print TTS to stdout and file without processing (default false)

Environmental Variables

Optionally, you can set the following environment variable:

export AWS_SHARED_CREDENTIALS_PROFILE=default

Example

Convert a text file to MP3 using the neural engine and Joanna's voice, and save the output to an S3 bucket:

./tts-converter -input="example.txt" -engine="neural" -format="mp3" -bucket="my-audio-files" -prefix="example" -voice="Joanna"

About

polly is a simple CLI tool to transform academic plain text files into audio using AWS Polly.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages