languageCode: The language of the voice as a BCP-47 language code
gender: The gender of the voice, if available
name: Name of the voice, see list via gl_talk_languages for supported voices. Set to NULL to make the service choose a voice based on languageCode and gender.
audioEncoding: Format of the requested audio stream
speakingRate: Speaking rate/speed between 0.25 and 4.0
pitch: Speaking pitch between -20.0 and 20.0 in semitones.
volumeGainDb: Volumne gain in dB
sampleRateHertz: Sample rate for returned audio
inputType: Choose between text (the default) or SSML markup. The input text must be SSML markup if you choose ssml
effectsProfileIds: Optional. An identifier which selects 'audio effects' profiles that are applied on (post synthesized) text to speech. Effects are applied on top of each other in the order they are given
Returns
The file output name you supplied as output
Details
Requires the Cloud Text-To-Speech API to be activated for your Google Cloud project.
To play the audio in code via a browser see gl_talk_player
To use Speech Synthesis Markup Language (SSML) select inputType=ssml - more details on using this to insert pauses, sounds and breaks in your audio can be found here: https://cloud.google.com/text-to-speech/docs/ssml
To use audio profiles, supply a character vector of the available audio profiles listed here: https://cloud.google.com/text-to-speech/docs/audio-profiles - the audio profiles are applied in the order given. For instance effectsProfileIds="wearable-class-device" will optimise output for smart watches, effectsProfileIds=c("wearable-class-device","telephony-class-application") will apply sound filters optimised for smart watches, then telephonic devices.
Examples
## Not run:library(magrittr)gl_talk("The rain in spain falls mainly in the plain", output ="output.wav")gl_talk("Testing my new audio player")%>% gl_talk_player()# using SSMLgl_talk('<speak>The <say-as interpret-as=\"characters\">SSML</say-as> standard <break time=\"1s\"/>is defined by the
<sub alias=\"World Wide Web Consortium\">W3C</sub>.</speak>', inputType ="ssml")# using effects profilesgl_talk("This sounds great on headphones", effectsProfileIds ="headphone-class-device")## End(Not run)