trimWav: Trim leading and trailing noise in a recording containing a...

View source: R/trimWav.R

trimWavR Documentation

Trim leading and trailing noise in a recording containing a single utterance

Description

Trim leading and trailing noise in a recording containing a single utterance

Usage

trimWav(
  wave,
  outfile = NULL,
  begin = NULL,
  end = NULL,
  beginPad = 50,
  endPad = 50
)

Arguments

wave

Required. Either a tuneR::Wave object or a valid file path to an existing wav file.

outfile

If not NULL (the default), a filename ending in .wav where the trimmed recording will be stored. If NULL, the function will return a tuneR::Wave object.

begin

Integer. The first sample in the wave to be considered part of the speech signal. If NULL (the default), will use the automatically detected value output by findSpeech(wave).

end

Integer. The last sample in the wave to be considered part of the speech signal. If NULL (the default), will use the automatically detected value output by findSpeech(wave).

beginPad

Integer. How many milliseconds of silence (zeros) should we add to the beginning of the of the detected speech signal?

endPad

Integer. How many milliseconds of silence (zeros) should we add to the end of the detected speech signal?

Value

A wav file (or tuneR::Wave object if outfile=NULL) trimmed from the original object denoted by argument wave.

Examples

data("samp_wav")
head(samp_wav@left)
trimmed <- trimWav(samp_wav)
head(trimmed@left)

abbey-thomas/speechcollectr documentation built on Nov. 19, 2024, 7:09 p.m.