Categorygithub.com/kmulvey/text2speech
modulepackage
1.1.2
Repository: https://github.com/kmulvey/text2speech.git
Documentation: pkg.go.dev

# README

text2speech

Build Release Go Report Card Go Reference

Convert text to speech using AWS Polly.

Dependencies

This depends on oto which has some prerequisites.

Linux

ALSA is required. On Ubuntu or Debian, run this command:

apt install libasound2-dev

On RedHat-based linux distributions, run:

dnf install alsa-lib-devel

Examples

Pipe text:

echo "The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom." | ./text2speech -bucket your-s3-bucket

File Input

./text2speech -bucket your-s3-bucket -input text

MP3 output:

./text2speech -bucket your-s3-bucket -input text -output audio.mp3 # this will only write the file, it will not play it

Displaying a dashboard to monitor progress

./text2speech -bucket your-s3-bucket -input text -dashboard

Print help:

./text2speech -h

# Functions

EscapeFilePath escapes spaces in the filepath used for an exec() call.
NewDashboard is a constructor that builds the terminal dashboard as well as spins up two goroutines (below) that receive data from the two channels passed in.

# Constants

this can be overridden with cli flags.
this is a polly limit per job.

# Variables

Errorlog allows us to capture errors without getting trapped by the dashboard.

# Structs

Dashboard is our terminal visualization.
PlaybackProgress represents how far we have gotten in playing the audio.