getClipData: Get Wav Clips of Data

View source: R/getClipData.R

getClipDataR Documentation

Get Wav Clips of Data

Description

Reads audio clips containing sounds from events or detections

Usage

getClipData(
  x,
  buffer = c(0, 0.1),
  mode = c("event", "detection"),
  channel = 1,
  useSample = FALSE,
  fixLength = FALSE,
  progress = TRUE,
  verbose = TRUE,
  FUN = NULL,
  ...
)

Arguments

x

AcousticStudy object containing data to read wav clips for

buffer

amount before and after each event to also include in the clip, in seconds. Can either be a vector of length two specifying how much to buffer before and after (first number should be negative), or a single value if the buffer amount should be identical.

mode

either 'event' or 'detection' specifying whether to create wav clips of entire events or individual detections

channel

channel(s) of clips to write

useSample

logical flag to use startSample information in binaries instead of UTC time for start of detections. This can be slightly more accurate (~1ms) but will take longer

fixLength

logical flag to fix the output clip length to a constant value. If TRUE, then output clip length is entirely determined by the buffer value, as if the detection or event had zero length. E.g. buffer=c(-2,1) will produce clips 3 seconds long, starting 2 seconds before the detection/event start time.

progress

logical flag to show progress bar

verbose

logical flag to show summary messages

FUN

optional function to apply to wav clips. This function takes default inputs wav, a Wave class object, name the name of the detection or event, time the start and end time of the clip, channel as above, mode as above, and additional args ...

...

optional arguments to pass to FUN

Value

A named list of wav clips

Author(s)

Taiki Sakai taiki.sakai@noaa.gov

Examples


data(exStudy)
recs <- system.file('extdata', 'Recordings', package='PAMpal')
exStudy <- addRecordings(exStudy, folder=recs, log=FALSE, progress=FALSE)
## Not run: 
# not running so that no wav clips are written to disk
wavs <- getClipData(exStudy, mode='event')

## End(Not run)


PAMpal documentation built on Aug. 12, 2023, 1:06 a.m.