data(tico)
data(orni)
# selection in tico to have two waves of similar duration (length)
tico<-as.matrix(tico[1:15842,1])
diffenv(tico,orni,f=22050,plot=TRUE)
# [1] 0.7362514
# smoothing the envelope gives a better graph but changes the result
diffenv(tico,orni,f=22050,smooth=20,plot=TRUE)
# [1] 0.6871243
# smoothing can have actually dramatic effects
# so always use the same smooth settings for comparisons
a<-synth(d=0.5,f=8000,cf=1000,plot=FALSE)
b<-synth(d=0.5,f=8000,cf=1100,plot=FALSE)
diffenv(a,b,f=8000)
# [1] 0.2727784
diffenv(a,b,f=8000,smooth=50)
# [1] 0.01012826
Run the code above in your browser using DataLab