All pastes #923058 Raw Edit

Stuff

public text v1 · immutable
#923058 ·published 2008-02-29 06:27 UTC
rendered paste body
#!/bin/bash
set -e
[[ "$1" == *.talk ]] && exit 0 # no .talk.talk
[ "$1" = . -o "$1" = .. ] && exit 0
if [ -f "$1" ]; then
  OUTNAME="${1}.talk"
elif [ -d "$1" ]; then
  OUTNAME="${1}/_dirname.talk"
else
  echo "Usage $0 <file_or_dir>"
  exit 1
fi
[ -f "$OUTNAME" ] && exit 0 # don't recreate if .talk clip already exists

tmpf=~/tmp/x-$$.wav

SAY=$(basename "$1")

espeak -s 240 -z -w "$tmpf" "$SAY"
echo "Speaking $SAY"
rbspeexenc -q 8 -c 10 -v 0.6 "$tmpf" "${OUTNAME}"
rm "$tmpf"
echo "Removing $tmpf"