Learn R Programming

seewave (version 1.4.3)

diffwave: Difference between two time waves

Description

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

Usage

diffwave(wave1, wave2, f, wl = 512, smooth = NULL)

Arguments

wave1
data or a Sample object generated loading a wav file with loadSample (package Sound) describing a first time wave.
wave2
data or a Sample object generated loading a wav file with loadSample (package Sound) describing a second time wave.
f
sampling frequency of wave1 and wave1 (in Hz). Does not need to be specified if wave1 and/or wave2 are/is (a) Sample object(s).
wl
window length for spectral analysis (even number of points).
smooth
envelope smoothing by floating average.

Value

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

Details

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 and smooth arguments respectively. See examples below and examples in diffspec and diffenv for implications on the results.

References

Sueur, J., Pavoine, S., Hamerlynck, O. & Duvail, S., in preparation.

See Also

diffspec, diffenv

Examples

Run this code
data(tico)
data(orni)
# selection in tico to have two waves of similar duration (length)
tico<-as.matrix(tico[1:15842,1])
diffwave(tico,orni,f=22050)
# [1] 0.4027229
# changing the frequency parameter (wl)
diffwave(tico,orni,f=22050,wl=1024)
# [1] 0.4335703
# changing the temporal parameter (smooth)
diffwave(tico,orni,f=22050,smooth=20)
# [1] 0.3758508

Run the code above in your browser using DataLab