simspec {seewave} | R Documentation |
This function estimates the similarity between two frequency spectra.
simspec(spec1, spec2, f = NULL, mel = FALSE, norm = FALSE, PMF = FALSE, plot = FALSE, type = "l", lty =c(1, 2, 3), col = c(2, 4, 1), flab = NULL, alab = "Amplitude (percentage)", flim = NULL, alim = NULL, title = TRUE, legend = TRUE, ...)
spec1 |
a first data set resulting of a spectral analysis obtained
with |
spec2 |
a first data set resulting of a spectral analysis obtained
with |
f |
sampling frequency of waves used to obtain |
mel |
a logical, if |
norm |
a logical, if |
PMF |
a logical, if |
plot |
logical, if |
type |
if |
lty |
a vector of length 3 for the line type of |
col |
a vector of length 3 for the colour of |
flab |
title of the frequency axis. |
alab |
title of the amplitude axis. |
flim |
the range of frequency values. |
alim |
range of amplitude axis. |
title |
logical, if |
legend |
logical, if |
... |
other |
Spectra similarity is assessed according to:
S = 100*sum(min(spec1,spec2)/max(spec1,spec2))/N, with \emph{S} in %.
with S in %.
The similarity index is returned. This value is in %.
When plot
is TRUE
, both spectra and the similarity function are
plotted on the same graph. The similarity index is the mean of this function.
Jerome Sueur, improved by Laurent Lellouch
Deecke, V. B. and Janik, V. M. 2006. Automated categorization of bioacoustic signals: avoiding perceptual pitfalls. Journal of the Acoustical Society of America, 119: 645-653.
spec
, meanspec
, corspec
,
diffspec
, diffenv
, kl.dist
,
ks.dist
, logspec.dist
, itakura.dist
a<-noisew(f=8000,d=1) b<-synth(f=8000,d=1,cf=2000) c<-synth(f=8000,d=1,cf=1000) d<-noisew(f=8000,d=1) speca<-spec(a,f=8000,at=0.5,plot=FALSE) specb<-spec(b,f=8000,at=0.5,plot=FALSE) specc<-spec(c,f=8000,at=0.5,plot=FALSE) specd<-spec(d,f=8000,at=0.5,plot=FALSE) simspec(speca,speca) simspec(speca,specb) simspec(speca,specc,plot=TRUE) simspec(specb,specc,plot=TRUE) #[1] 12.05652 simspec(speca,specd,plot=TRUE) ## mel scale require(tuneR) data(orni) data(tico) orni.mel <- melfcc(orni, nbands = 256, dcttype = "t3", fbtype = "htkmel", spec_out=TRUE) orni.mel.mean <- apply(orni.mel$aspectrum, MARGIN=2, FUN=mean) tico.mel <- melfcc(tico, nbands = 256, dcttype = "t3", fbtype = "htkmel", spec_out=TRUE) tico.mel.mean <- apply(tico.mel$aspectrum, MARGIN=2, FUN=mean) simspec(orni.mel.mean, tico.mel.mean, f=22050, mel=TRUE, plot=TRUE)