mkdir -p words
n=($(cat msg.txt | grep -v '^$' | sed 's/./\l&/g' | sed 's/ /_/g'))
#echo ${n[*]}
for wo in "${n[@]}"; do
  echo $wo
  if [ ! -f words/$wo.mp3 ]; then
    #echo $wo | grep -o . | while read ch; do echo "file 'mp3/$ch.mp3'"; done >word.txt
    m=($(echo $wo | grep -o .))
    for ch in "${m[@]}"; do echo "file 'mp3/$ch.mp3'"; done >word.txt
    ffmpeg -f concat -safe 0 -i word.txt -c copy -y words/$wo.mp3 &>/dev/null
  fi
done

for wo in "${n[@]}"; do echo "file 'words/$wo.mp3'"; echo "file 'mp3/~.mp3'"; done >list.txt
ffmpeg -f concat -safe 0 -i list.txt -c copy -y msg.mp3

rm -f word.txt
rm -f list.txt

