diffwave: Difference between two time waves

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/seewave.r

Description

This function estimates the difference between two waves by computing the product between envelope surface difference and frequency surface difference.

Usage

1
2
diffwave(wave1, wave2, f, channel = c(1,1), wl = 512, envt = "hil",
msmooth = NULL, ksmooth = NULL)

Arguments

wave1

a first R object.

wave2

a second R object.

f

sampling frequency of wave (in Hz). Does not need to be specified if embedded in wave.

channel

channel of the R objects, by default left channel (1) for each object.

wl

window length for spectral analysis (even number of points).

envt

the type of envelope to be used: either "abs" for absolute amplitude envelope or "hil" for Hilbert amplitude envelope. See env.

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

ksmooth

kernel smooth via kernel. See env.

Details

D is a Manhattan distance (l1 norm).
This function computes the product between the values obtained with diffspec and diffenv functions.
This then gives a global (time and frequency) estimation of dissimilarity.
The frequency mean spectrum and the amplitude envelope needed for computing respectively diffspec and diffenv are automatically generated. They can be controlled through wl, msmooth and ksmooth arguments respectively.
See examples below and examples in diffspec and diffenv for implications on the results.

Value

A single value varying between 0 and 1 is returned. The value has no unit.

Note

This method can be used as a relative distance estimation between different waves.

Author(s)

Jerome Sueur sueur@mnhn.fr

References

Sueur, J., Pavoine, S., Hamerlynck, O. & Duvail, S. (2008) - Rapid acoustic survey for biodiversity appraisal. PLoS ONE, 3(12): e4065.

See Also

diffspec, diffenv

Examples

1
2
3
4
5
6
7
8
9
data(tico) ; tico <- tico@left
data(orni) ; orni <- orni@left
# selection in tico to have two waves of similar duration (length)
tico <- tico[1:length(orni)]
diffwave(tico,orni,f=22050)
# changing the frequency parameter (wl)
diffwave(tico,orni,f=22050,wl=1024)
# changing the temporal parameter (msmooth)
diffwave(tico,orni,f=22050,msmooth=c(20,0))

Example output

[1] 0.3828392
[1] 0.4122155
[1] 0.3768617

seewave documentation built on July 14, 2021, 5:10 p.m.

Related to diffwave in seewave...