BREYDON’s

nevr

Noodly espeak voice-replacement.

Download

Entire Thing

2.5 KB shell script.

Technical Notes

Version 0.0.3-a.  All espeak, sed, cp and printf at heart, plus scruffy &&s and such.  A moment of sudoing, optional sleep.  Possibly POSIX-compliant.  Human language: wriggly English.

Source

A silly shell script --- nevr --- which goes like this:

nevr’s Source, for Posterity or the Webcrawlers
#!/usr/bin/env sh

# This is not that safe a script!  It TAKES MINIMAL PRECAUTION, so it
# can happily replace espeak's default voice with an unusable file,
# should nevr be wrongly deployed.

printf 'nevr (noodly espeak voice-replacement) version 0.0.3-a\n'

# Only sometimes nevr gives up...
bombed () {
  printf '\nIn this case, nevrfails.\n' # no typo; uninterrupted-flow pun
  espeak --ipa 'Sorry, still using the old voice.'
  exit 1
}
if [ "$1" = "" ]; then
  printf '\nNeeded a replacement voice tho innit.\n'
  bombed
fi

# Otherwise nevr shows no fear...
copied () {
  printf '\nFinally, it speaks using the (new) default voice.\n'
  espeak --ipa 'And what a result. Done!'
  exit 0
}

printf '
This script now does the following:

It writes out some text as we go along.\n
It speaks using the default voice for espeak:\n'
espeak --ipa 'Overwriter, go ahead now.' || bombed

# Preventing bumbling on into copying to plain /voices/default or
# anything, should there be nothin named espeak to run

printf "It tries to overwrite espeak's default voice
with the contents of, uh, how you say--?\n-- \"$1\".\n
Please DO NOT go ahead with this unless you know
 exactly what you (and the computer) are doing!
    (Instead, to bail: use Ctrl-C, Ctrl-D,
     or supply the WRONG password ~3 times).\n"
espeakdir="$(espeak --version | sed -E  's/.*Data at: //')"
if test "$espeakdir" != ""; then
# uncomment next 4 lines for a baffling stall-tactic
#  printf "I'm thinkin $espeakdir\nwhich is nuffin wrong, right? "
#  sleep 1
#  printf "Rhetorical question;\n";sleep 1;printf "I might stuff up.\n"
#  sleep 2
  sudo cp $1 $espeakdir/voices/default && copied || bombed
else
# When in error do as the errands (report back in lowercase).
  printf "see i got nuffin cos i'm thinkin $espeakdir ...nuffin\n"
  bombed
fi

# This software is in the public domain. It is free for use by anyone
# and for any purpose. The software is offered "as is", without
# warranty of any kind.

# Scribbled by Kermie BREYDON, on Kulin land, circa southern spring 2020.
# <https://www.breydon.id.au/puting/tcb/>
# ---------
# Changelog
# ---------
# version 0.0.3-a:
# = replaced own specific home of voices/default with whatever espeak reports
# = replaced a set filename with $1
# = split ending in two: copied() and bombed()
# = hadded more pun
# = scrounged up some convoluted checks re: destination dir
# version 0.0.2-a:
# = commented source
# = added midprocess dissuasion