7  Text to Speech in R

Author

Chrissy h Roberts

7.1 Background

This is a simple bit of script that reaches in to the linux/OS-X system and runs a text to speech function.

It may have some practical benefits. I quite like to use it to tell me that a long running script has finished.

7.2 Define Functions

speakr <- function(message="hello, world")
{
  if(.Platform$OS.type == "unix"){system(paste("say ",message,sep=""))}
    else {system(paste("echo ",message,"|ptts",sep=""))}
}   

7.3 Example

# usage examples

speakr()
speakr("Who lives in a pineapple under the sea?")