getMetrics: Get PSD and Signal-to-Noise Ratio for audio files

View source: R/getMetrics.r

getMetricsR Documentation

Get PSD and Signal-to-Noise Ratio for audio files

Description

This function does not generally need to be called directly. It is the workhorse function that reads wav files, extracts Power Spectrum Density (PSD) and Signal-to-Noise (s2n) for specified frequency bands using seewave function spectro(). This function is called by getThreshold() and classifyRain() which will generally be used directly.

Usage

getMetrics(
  wav,
  freqLo = c(0.6, 4.4),
  freqHi = c(1.2, 5.6),
  t.step = NULL,
  parallel = 0
)

Arguments

wav

A vector of wav filenames (including directories) or an object of class wav from the tuner package (see parallel, below)

freqLo

A numeric vector of Lower frequency cut offs for each band.

freqHi

A numeric vector of Higher frequency cut offs for each band.

t.step

NULL or a numeric vector giving time in seconds in which to divide longer files. If NULL, it is assumed that all files analysed are suitably short (e.g. 15 s each) and do not need to be subdivided (see details)

parallel

Numeric (or logical). Defaults to 0 - no parallel processing. If 'TRUE' will use multicore processing with the parallel package (Windows only; must be loaded), with number of cores - 2. Otherwise, a positive integer specifies number of cores to use. If wav is a single wav object it makes no sense to use parallel here (rather use hardRain functions within a larger parallelised loop).

Value

A numeric matrix with columns psd and s2n for each wav file in wav, filenames are conserved in the rownames

Examples

See examples in getThreshold() and classifyRain

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