a3nm's blog

Imitating GLaDOS with espeak

— updated

If you've played Portal, you must be acquainted with GLaDOS and her very odd way of speaking, which sounds like TTS but was actually recorded by an actress (Ellen McLain) and digitally edited.

It turns out that there is a common free TTS program, espeak, packaged for Ubuntu and Debian, which is not a very convincing imitation of a human, but which sounds a bit like GLaDOS:

echo "Hello, and, again, welcome to the Aperture Science " \
  "Computer-aided Enrichment Center" |
  espeak -ven+f3 -m --stdout -p 60 -s 180 |
  oggenc -q1 - > espeak1.ogg

In my opinion, though, the most striking thing about GLaDOS's speech is its seemingly random pitch. My point is that we can approximate this by adding some SSML markup.

echo "Hello, and, again, welcome to the Aperture Science " \
  "Computer-aided Enrichment Center" |
  for a in `cat`; do
    V=$(((($RANDOM) % 100) - 50))
    echo -n "<prosody pitch=\"+$V\">$a</prosody> " |
      sed 's/+-/-/' 
  done |
  espeak -ven+f3 -m --stdout -p 60 -s 180 |
  oggenc -q1 - > espeak2.ogg

Approximating Still alive using this technique is left as an exercise to the reader. ;-)

comments welcome at a3nm<REMOVETHIS>@a3nm.net