R/say_something.R

Defines functions say_something

Documented in say_something

#' say_something
#'
#' This is a helper function.
#' @param 
#' message  The message to read.
#' @param 
#' voice  The voice to use.
#' @export


say_something = function(message , voice) {
        
  voice = paste0("\"$speak.SelectVoice('Microsoft ", voice, " Desktop');" )
  message = paste0("$speak.Speak('", message, "');\"")
      
  system2(command = "PowerShell", 
          args = c("-Command", 
                    "\"Add-Type -AssemblyName System.Speech;",
                    "$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer;",
                    voice,
                    message
          ))
}
ctross/DieTryin documentation built on Sept. 8, 2024, 8:07 p.m.