Skip to contents

Convert PCM to Wav

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

if (FALSE) {
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")
}
if (FALSE) {
if (requireNamespace("aws.polly", quietly = TRUE)) {
text = "hey, ho, let's go!"
if (tts_amazon_auth()) {
   res = tts_amazon(text, output_format = "wav")
}
}
}