Skip to content

Instantly share code, notes, and snippets.

@ns-mkusper
Last active November 25, 2022 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ns-mkusper/bbdd73f5a678c8669a582cf4006150cc to your computer and use it in GitHub Desktop.
Save ns-mkusper/bbdd73f5a678c8669a582cf4006150cc to your computer and use it in GitHub Desktop.
#!/bin/bash
# requires flite, sox and ffmpeg
INPUT_TXT=$1
OUTPUT_WAV=${INPUT_TXT/txt/wav}
OUTPUT_MP3=${INPUT_TXT/txt/mp3}
OUTPUT_WAV_FAST=${INPUT_TXT/.txt/_fast.wav}
OUTPUT_MP3_FAST=${INPUT_TXT/.txt/_fast.mp3}
flite -f "${INPUT_TXT}" -o "$OUTPUT_WAV" 2>&1 > /dev/null
sox "${OUTPUT_WAV}" "${OUTPUT_WAV_FAST}" tempo 1.5
rm "$OUTPUT_WAV"
echo "OUTPUT: $OUTPUT_MP3_FAST"
ffmpeg -nostdin -loglevel quiet -i "$OUTPUT_WAV_FAST" -acodec libmp3lame -ar 44100 -ab 64000 -y "$OUTPUT_MP3_FAST"
rm "$OUTPUT_WAV_FAST"
echo DONE!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment