pcm_to_wav {text2speech}R Documentation

Convert PCM to WAV

Description

Accepts PCM audio data as input and generates a corresponding WAV file

Usage

pcm_to_wav(
  input,
  output = tempfile(fileext = ".wav"),
  sample_rate = 16000,
  extensible = FALSE
)

Arguments

input

output from 'get_synthesis“ from aws.polly or PCM filename

output

output file for Wav file

sample_rate

Sampling rate for tuneR::Wave

extensible

passed to tuneR::writeWave

Value

A filename of the output

Examples

## Not run: 
fname = system.file("extdata", "pcm_file.wav", package = "text2speech")
res = pcm_to_wav(fname)
testthat::expect_error(tuneR::readWave(fname))
testthat::expect_is(tuneR::readWave(res), "Wave")

## End(Not run)
## Not run: 
if (requireNamespace("aws.polly", quietly = TRUE)) {
text = "hey, ho, let's go!"
if (tts_amazon_auth()) {
   res = tts_amazon(text, output_format = "wav")
}
}

## End(Not run)

[Package text2speech version 1.0.0 Index]