cutRain: Cut and save wav files according to rain classification

View source: R/cutRain.r

cutRainR Documentation

Cut and save wav files according to rain classification

Description

A follow on function to classifyRain for longer wav files. This function labels and cuts (removes) sections of hard rain in audio files, then saves contiguous periods without rainfall as new wav files.

Usage

cutRain(
  x,
  threshold = c("min", "Q2"),
  inF,
  label.only = F,
  outF,
  label.type = "audacity"
)

Arguments

x

A matrix of results from classifyRain

threshold

A character vector with the threshold type to use ("min" or "Q2"). Defaults to "min"

inF

Source folder for wav files. Defaults to home directory if missing.

label.only

Logical. If TRUE, only label file is written, wav files are not cut and saved.

outF

Destination folder for new wav files. Defaults to inF if missing.

label.type

A character vector, for the moment, just "audacity", to include a label file to be written in inF for the original wav, labelling all non-rain sections (ie those that will be exported). If NULL, no labels will be written

Details

This function is only designed to work with results from classifyRain where input audio files are subdivided into smaller time segments with t.step argument. If label.only is FALSE, then segments containing rain will be cut from original audio files, and remaining contiguous audio saved as new wav files. Optionally, a label file for the original wav can be written to the input folder, marking segments with rain/clear in the wav file (either for Audacity or Raven software).

If a vector of start times and dates (as POSIX* format) is given in start, then filenames will be suffixed with new start times. Otherwise, new wav files are suffixed with a numeric ID for each separate segment originating from the input wav file.

Value

A dataframe (invisibly) detailing the labels/new wav files created, with, filename and full path.


Cdevenish/hardRain documentation built on Jan. 10, 2025, 3:39 a.m.