KutakMir KutakMir - 9 months ago 38
Bash Question

How to generate mp3 audiobook out of text files in mac

I have a folder with text files, each text file being a chapter of a book I want to turn into a mp3 audiobook. How do I do this on Mac?


You create two folders "input" and "output", input is a folder with txt files and output is a folder with mp3s. Now you just run this script:


cd input
for i in * ; do

echo "$filename"
cat "$i" | say -o "../output/$filename.aiff" --progress
cd ../output
lame -m m "$filename.aiff" "$filename.mp3"
rm -f "$filename.aiff"
cd ../input


cd ..