This function returns statistics based on STFT time and frequency contours.
acoustat(wave, f, channel = 1, wl = 512, ovlp = 0, wn = "hanning",
tlim = NULL, flim = NULL,
aggregate = sum, fraction = 90,
plot = TRUE, type = "l", ...)
The function returns a list with 10 items:
the time contour as a two-column matrix, the first colum being time (s) and the second colum being the amplitude probability mass function (no scale).
the frequency contour as a two-column matrix, the first colum being frequency (kHz) and the second colum being the amplitude probability mass function (no scale).
the time initial percentile
the time median
the time terminal percentile
the time interpercentile range
the frequency initial percentile
the frequency median
the frequency terminal percentile
the frequency interpercentile range
an R object.
sampling frequency of wave
(in Hz). Does not need to
be specified if embedded in wave
.
channel of the R object, by default left channel (1).
window length for the analysis (even number of points) (by default = 512).
overlap between two successive windows (in %).
window name, see ftwindow
(by default
"hanning"
).
modifications of the time limits of the analysis (in s).
modifications of the frequency limits of the analysis (in kHz).
a character vector of length 1 specifying the function to be applied on the rows (time) and columns (frequency) of the STFT matrix. By default set to sum
.
a numeric vector of length 1, specifying a particular fraction of the contours amplitude to be captured by the initial and terminal percentile values (in %). See details.
a logical, if TRUE
a two-frame plot is returned
with the time and frequency contours and percentiles displayed.
if plot
is TRUE
, type of plot that should be drawn. See plot
for details (by default "l" for lines).
other plot
graphical parameters.
Jerome Sueur
The principle of acoustat
is as follows:
Compute the short-term Fourier transform (STFT) with usual
parameters (wl
for window length, ovlp
for overlap of
successive windows, and wn
for the name of window shape).
This results in a time * frequency matrix.
Compute an aggregation function (specified with the argument
aggregate
set by default to sum
) accross rows and
columns of time * frequency matrix.)
This results in two components: (i) the time contour, and (ii) the frequency contour.
Each contour is considered as a probability mass function (PMF) and transformed into a cumulated distribution function (CDF).
Measures are extracted from each CDF: median (M), initial
percentile (P1) value, terminal percentile (P2) value, interpercentile range (IPR). P1, P2 and IPR are defined using a fraction parameter
(fraction
) that sets the percent of the contour amplitude to be captured by the initial and terminal percentile values. A fraction of 50% would result in the familiar quartiles and interquartile range. An energy fraction of 80% would return the 10th and 90th percentile values, and the width of the range in between.
Fristrup, K. M. and Watkins, W. A. 1992. Characterizing acoustic features of marine animal sounds. Woods Hole Oceanographic Institution Technical Report WHOI-92-04.
meanspec
, specprop
data(tico)
note <- cutw(tico, from=0.5, to=0.9, output="Wave")
## default setting
acoustat(note)
## change the percentile fraction
acoustat(note, fraction=50)
## change the STFT parameters
acoustat(note, wl=1024, ovlp=80)
## change the function to compute the aggregate contours
## standard deviation instead of sum
acoustat(note, aggregate=sd)
## direct time and frequency selection
acoustat(tico, tlim=c(0.5,0.9), flim=c(3,6))
## some useless graphical changes
acoustat(note, type="o", col="blue")
Run the code above in your browser using DataLab