Skip to contents

Clip and copy a single wave files to a given length. See clip_wave() for processing multiple files.

Usage

clip_wave_single(
  path_in,
  path_out,
  clip_length,
  start_time = 0,
  wave_length = NULL,
  overwrite = FALSE
)

Arguments

path_in

Character. Path to the wave file to clip.

path_out

Character. Path to copy the new clipped wave file to.

clip_length

Numeric. Length of new clip in seconds.

start_time

Numeric. Time in seconds where new clip should start. Default 0.

wave_length

Numeric. Length of the clipped wave file in seconds (if NULL, default, will be the length of time from start_time to the end of the file).

overwrite

Logical. Whether to overwrite existing files when creating new clipped wave files. Default (FALSE) will error if the file already exists.

Value

TRUE if successful

Examples

# Create test wave file
f <- temp_wavs(1)

# Clip file and check it out
clip_wave_single(f, "new_file.wav", clip_length = 1)
#> [1] TRUE
tuneR::readWave("new_file.wav")
#> 
#> Wave Object
#> 	Number of Samples:      44100
#> 	Duration (seconds):     1
#> 	Samplingrate (Hertz):   44100
#> 	Channels (Mono/Stereo): Mono
#> 	PCM (integer format):   FALSE
#> 	Bit (8/16/24/32/64):    32 
#> 
unlink("new_file.wav")