Skip to content

Instantly share code, notes, and snippets.

@kentbye
Created October 6, 2012 00:33
Show Gist options
  • Save kentbye/3843248 to your computer and use it in GitHub Desktop.
Save kentbye/3843248 to your computer and use it in GitHub Desktop.
Text-to-MP3 Bash script using Mac's say command
#!/bin/bash
FULLFILE=$1;
FILE="${FULLFILE%%.*}";
# Convert to an audio file at 310 words per minute. I personally select the UK's Serena as the Mac default voice
echo "converting $FILE.txt to $FILE.aiff";
`say -f $FILE.txt -r 310 -o $FILE.aiff --progress`;
echo "conververting $FILE.aiff to $FILE.mp3";
`ffmpeg -i $FILE.aiff $FILE.mp3`;
# Change the MP3 ID3 for the Album
id3tag -A$FILE $FILE.mp3;
`rm $FILE.aiff`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment