Converts images & PDF files to text.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Converts images & PDF files to text. | |
# See http://ericheikes.com/converting-books-to-mp3-audio-text-to-speech | |
# | |
# Concatenate all the files. | |
cat "$@" > out.txt | |
# Combine words that are broken (with hyphens) across lines. | |
perl -0777 -i -pe 's/(\S+)-\n\s*(\S+)/$1$2/ig' out.txt | |
# Convert the text to speech. | |
text2wave out.txt -o out.wav -eval "(voice_us2_mbrola)" | |
# Encode as MP3. | |
lame -V5 out.wav out.mp3 | |
# Clean up. | |
rm out.wav |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment