a<-noise(f=8000,d=1)
b<-synth(f=8000,d=1,cf=2000)
c<-synth(f=8000,d=1,cf=1000)
d<-noise(f=8000,d=1)
speca<-spec(a,f=8000,wl=512,at=0.5,plot=FALSE)
specb<-spec(b,f=8000,wl=512,at=0.5,plot=FALSE)
specc<-spec(c,f=8000,wl=512,at=0.5,plot=FALSE)
specd<-spec(d,f=8000,wl=512,at=0.5,plot=FALSE)
simspec(speca,speca,f=8000)
#[1] 100 => similar spectra of course!
simspec(speca,specb,f=8000)
#[1] 0.3873278
simspec(speca,specc,f=8000,plot=TRUE)
#[1] 0.5920857
# two pure tone at different frequency are...
simspec(specb,specc,f=8000,plot=TRUE)
#[1] 12.05652
#... less similar than two noises
simspec(speca,specd,f=8000,plot=TRUE)
#[1] 57.40742
Run the code above in your browser using DataLab