resample_est: Resample wave objects in a extended selection table

View source: R/resample_est.R

resample_estR Documentation

Resample wave objects in a extended selection table

Description

resample_est changes sampling rate and bit depth of wave objects in a extended selection table.

Usage

resample_est(
  X,
  samp.rate = 44.1,
  bit.depth = 16,
  avoid.clip = TRUE,
  pb = FALSE,
  parallel = 1
)

Arguments

X

object of class 'extended_selection_table' (see selection_table).

samp.rate

Numeric vector of length 1 with the sampling rate (in kHz) for output files. Default is NULL.

bit.depth

Numeric vector of length 1 with the dynamic interval (i.e. bit depth) for output files.

avoid.clip

Logical to control whether the volume is automatically adjusted to avoid clipping high amplitude samples when resampling. Ignored if 'sox = FALSE. Default is TRUE.

pb

Logical argument to control progress bar. Default is FALSE.

parallel

Numeric. Controls whether parallel computing is applied. It specifies the number of cores to be used. Default is 1 (i.e. no parallel computing).

Details

This function aims to simplify the process of homogenizing sound files (sampling rate and bit depth). This is a necessary step before running any further (bio)acoustic analysis. SOX must be installed.

Value

An extended selection table with the modified wave objects.

Author(s)

Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr) #last modification on oct-15-2018 (MAS)

References

Araya-Salas, M., & Smith-Vidaurre, G. (2017). warbleR: An R package to streamline analysis of animal acoustic signals. Methods in Ecology and Evolution, 8(2), 184-191.

See Also

mp32wav, fix_wavs

Other extended selection table manipulation: by_element_est(), rename_est_waves()

Examples

## Not run: 
data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4", "selec_table"))
writeWave(Phae.long1, file.path(tempdir(), "Phae.long1.wav"))
writeWave(Phae.long2, file.path(tempdir(), "Phae.long2.wav"))
writeWave(Phae.long3, file.path(tempdir(), "Phae.long3.wav"))
writeWave(Phae.long4, file.path(tempdir(), "Phae.long4.wav"))

# create extended selection table
X <- selection_table(
  X = lbh_selec_table, extended = TRUE, pb = FALSE,
  path = tempdir()
)

# resample
Y <- resample_est(X)

## End(Not run)

warbleR documentation built on Sept. 11, 2024, 7:13 p.m.