info_sound_files: Get sound file parameter information

View source: R/info_sound_files.R

info_sound_filesR Documentation

Get sound file parameter information

Description

info_sound_files summariz sound file information

Usage

info_sound_files(
  path = NULL,
  files = NULL,
  parallel = 1,
  pb = TRUE,
  skip.error = FALSE,
  file.format = "\\.wav$|\\.wac$|\\.mp3$|\\.flac$"
)

Arguments

path

Character string containing the directory path where the sound files are located. If NULL (default) then the current working directory is used.

files

character vector indicating the set of files that will be consolidated. File names should not include the full file path. Optional.

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).

pb

Logical argument to control progress bar and messages. Default is TRUE.

skip.error

Logical to control if errors are omitted. If so, files that could not be read will be excluded and their name printed in the console. Default is FALSE, which will return an error if some files are problematic.

file.format

Character string with the format of sound files. By default all sound file formats supported by warbleR are included ("\\.wav$|\\.wac$|\\.mp3$|\\.flac$"). Note that several formats can be included using regular expression syntax as in grep. For instance "\\.wav$|\\.mp3$" will only include .wav and .mp3 files.

Details

This function is a wrapper for selection_table that returns a data frame with the following descriptive parameters for each sound file in the working directory (or 'path'):

  • duration: duration of selection in seconds

  • sample.rate: sampling rate in kHz

  • channels: number of channels

  • bits: bit depth

  • wav.size: sound file size in MB

  • samples: number of samples in the sound file

Value

A data frame with descriptive information about the sound files in the working directory (or 'path'). See "details".

Author(s)

Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)

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

fix_wavs, selection_table & check_sels

Examples

{
data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4", "lbh_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"))

#get info
info_sound_files(path = tempdir())
}


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