You can use a shell command like this:
for f in *.txt;do say -f "$f" -o "${f%txt}aif";done
Random English voice:
IFS=$'\n';a=($(say -v\?|sed -E $'s/ {2,}/\t/'|awk -F$'\t' '$2~/^en_/{print $1}'));for f in *.txt;do say -v "${a[$((RANDOM%${#a[@]}))]}" -f "$f" -o "${f%txt}aif";done
Random voice from a list:
IFS=, read -a a<<<'Daniel,Fiona,Moira,Emily,Serena,Tessa';for f in *.txt;do say -v "${a[$((RANDOM%${#a[@]}))]}" -f "$f" -o "${f%txt}aif";done
You can use ffmpeg to convert the files to mp3:
for f in *.aif;do ffmpeg -i "$f" -aq 2 "${f%aif}mp3";done
-aq 2
corresponds to -V2
in lame
. You can install ffmpeg with brew install ffmpeg
after installing Homebrew.
Wow. That looks like a neat, amazing solution. I will try it out. So far I have bought 3 apps from the appstore that cannot batch convert and rotate the voice! Thanks, thanks! – pommy – 2014-02-04T03:27:16.013
The first command works great. I just copied and pasted it into a command line after cd'ing into the relevant directory. Thank you.The second command to rotate the voices gives an error "Voice `Hysterical ' not found." but five lines of different voices not found as there are five txt files in the test folder. I only want to rotate among 6 specific voices (Daniel, Fiona, Moira, Emily, Serena and Tessa). Is there a way to specifiy those? Thanks again for your unbelievably simple solution that is much better than the paid apps that I have tried to use. – pommy – 2014-02-04T03:51:51.290
You're right, I got the same error. I edited the answer. – Lri – 2014-02-04T17:06:08.070