3 # Description: Read a text or PDF file in British English
5 # Shell: POSIX compliant
6 # Author: Arun Prakash Jana
9 tmpf="$(basename "$1")"
10 tmpf="${TMPDIR:-/tmp}"/"${tmpf%.*}"
12 if [ "$(head -c 4 "$1")" = "%PDF" ]; then
13 # Convert using pdftotext
14 pdftotext -nopgbrk -layout "$1" - | sed 's/\xe2\x80\x8b//g' > "$tmpf".txt
16 pico2wave -w "$tmpf".wav -l en-GB "$(tr '\n' ' ' < "$tmpf".txt)"
20 pico2wave -w "$tmpf".wav -l en-GB "$(tr '\n' ' ' < "$1")"
23 # to jump around and note the time
26 # flat read but better quality
27 # play -qV0 "$tmpf".wav treble 2 gain -l 2