writeEventClips {PAMpal} | R Documentation |
Create Wav Clips of Data
Description
Creates audio clips containing sounds from events or detections
Usage
writeEventClips(
x,
buffer = c(0, 0.1),
outDir = ".",
mode = c("event", "detection"),
channel = 1,
filter = 0,
useSample = FALSE,
progress = TRUE,
verbose = TRUE,
fixLength = FALSE
)
parseEventClipName(file, part = c("event", "time", "UID", "channel", "UTC"))
Arguments
x |
AcousticStudy object containing data to make 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. |
outDir |
directory to write clips to, defaults to current directory |
mode |
either |
channel |
channel(s) of clips to write |
filter |
filter to apply to wav clips before writing, values in kHz. A value of |
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 |
progress |
logical flag to show progress bar |
verbose |
logical flag to show summary messages |
fixLength |
logical flag to fix the output clip length to a constant value. If
|
file |
file name to parse |
part |
part of file name to return |
Details
parseEventClipName
parses the file names created to pull out
event names or file start times
Value
A vector of file names for the wav clips that were successfully
created, any that were not able to be written will be NA
. Note
that currently this can only write clips with up to 2 channels. File names
will be formatted as
[Event or Detection]_[Id]CH[ChannelNumber(s)]_[YYYYMMDD]_[HHMMSS]_[mmm].wav
The last numbers are the start time of the file in UTC, accurate to milliseconds.
The Id is either the event ID or the detection UID.
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 <- writeEventClips(exStudy, outDir='WavFolder', mode='event')
## End(Not run)