-2

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?

Miroslav Kuťák
  • 1,755
  • 1
  • 15
  • 24

1 Answers1

0

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:

#!/bin/bash


cd input
for i in * ; do

filename="${i%%.*}"
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

done

cd ..
Miroslav Kuťák
  • 1,755
  • 1
  • 15
  • 24