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.
- 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.
- 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
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
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"
-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)
Optionally, you can set the following environment variable:
export AWS_SHARED_CREDENTIALS_PROFILE=default
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"