corenv(wave1, wave2, f, smooth = 20, plot = TRUE, plotval = TRUE,
method = "spearman", col = "black", colval = "red",
cexval = 1, fontval = 1, xlab = "Time (s)",
ylab = "Coefficient of correlation (r)", type = "l",...)
Sample
object generated loading a wav file
with loadSample
(package Sample
object generated loading a wav file
with loadSample
(package wave1
and wave1
(in Hz).
Does not need to be specified if wave1
and/or wave2
are/is (a)
Sample
object(s).wave1
and wave2
by floating average.TRUE
plots r values against frequency shift
(by default TRUE
).TRUE
adds to the plot maximum r value
and frequency offset (by default TRUE
).cor
).plot
is TRUE
, type of plot that should be drawn.
See plot
for details (by default "l" for lines).plot
graphical parameters.plot
is FALSE
, corenv
returns a list containing four
components:x
and y
.x
and y
.rmax
.rmax
.wave1
and wave2
are computed when regularly sliding forward and backward wave2
along
wave1
.
The maximal correlation is obtained at a particular shift (time offset).
This shift may be positive or negative.
The higher smooth
is set up,
the faster will be the computation but less precise the results will be.
The corresponding p value, obtained with cor.test
, is plotted.
Inverting wave1
and wave2
may give slight different results.spec
,covspectro
,
cor
, cor.test
.data(orni)
# cross-correlation between two echemes of a cicada song
wave1<-cutw(orni,f=22050,from=0.3,to=0.4,plot=FALSE)
wave2<-cutw(orni,f=22050,from=0.58,to=0.68,plot=FALSE)
corenv(wave1,wave2,f=22050,ylim=c(-0.7,1.1))
Run the code above in your browser using DataLab