timer {seewave} | R Documentation |
Time measurements of a time wave
Description
This function computes and shows the duration of signal periods, pause periods and their ratio.
Usage
timer(wave, f, channel = 1, threshold = 5, dmin = NULL, envt="abs",
power = 1, msmooth = NULL, ksmooth = NULL,
ssmooth = NULL, asmooth=NULL, tlim = NULL, plot = TRUE, plotthreshold = TRUE,
col = "black", colval = "red",
xlab = "Time (s)", ylab = "Amplitude", ...)
Arguments
wave |
an R object. |
f |
sampling frequency of |
channel |
channel of the R object, by default left channel (1). |
threshold |
amplitude threshold for signal detection (in %), or alternatively a function to be applied on the waveform scaled between 0 and 1. See examples. |
dmin |
time threshold (minimum duration) for signal detection (in s). |
envt |
the type of envelope to be used: either "abs" for absolute
amplitude envelope or "hil" for Hilbert amplitude envelope. See |
power |
a power factor applied to the amplitude
envelope. Increasing |
msmooth |
a vector of length 2 to smooth the amplitude envelope with a
mean sliding window. The first component is the window length
(in number of points). The second component is the overlap between
successive windows (in %). See |
ksmooth |
kernel smooth for the amplitude enveloppe via |
ssmooth |
sum smooth for the amplitude enveloppe. See |
asmooth |
autocorrelation smooth for the amplitude enveloppe. See |
tlim |
modifications of the time X-axis limits. |
plot |
logical, if |
plotthreshold |
logical, if |
col |
colour of the envelope. |
colval |
colour of plotted measurements. |
xlab |
title of the x-axis. |
ylab |
title of the y-axis. |
... |
other |
Value
A list containing seven items:
s |
duration of signal period(s) in seconds |
p |
duration of pause period(s) in seconds |
r |
ratio between the signal and silence periods(s) |
positions |
a list containing four elements: |
s.start |
start position(s) of signal period(s) |
s.end |
end position(s) of signal period(s) |
first |
whether the first event detected is a pause or a signal |
Warning
Setting to high values to msmooth
or
ssmooth
might return inaccurate results. Double check your
results if so.
Author(s)
Jerome Sueur