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)
diffspec(speca,speca,f=8000)
#[1] 0 => similar spectra of course !
diffspec(speca,specb,f=8000)
#[1] 0.965465
diffspec(speca,specc,f=8000,plot=TRUE)
#[1] 0.95498
# two pure tone at different frequency are...
diffspec(specb,specc,f=8000,plot=TRUE)
#[1] 0.9999166
#... more different than two noises
diffspec(speca,specd,f=8000,plot=TRUE)
#[1] 0.2810392
Run the code above in your browser using DataLab