logspec.dist {seewave} | R Documentation |
Compare two distributions (e.g. two frequency spectra) by computing the log-spectral distance
logspec.dist(spec1, spec2, scale=FALSE)
spec1 |
any distribution, especially a spectrum obtained with |
spec2 |
any distribution, especially a spectrum obtained with
|
scale |
a logical, if |
The distance is computed according to:
D(spec1 || spec2) = D(spec2 || spec1) = sqrt(sum((10*log10(spec1/spec2))^2))
If scale = TRUE
the distance is divided by the length of spec1
(or spec2
).
A numeric vector of length 1 returning the D distance.
The function works for both Hz and (htk-)mel scales.
The distance is symmetric.
Jerome Sueur, improved by Laurent Lellouch
ks.dist
, kl.dist
,
itakura.dist
, simspec
, diffspec
# Comparison of two spectra data(tico) tico1 <- spec(tico, at=0.65, plot=FALSE) tico2 <- spec(tico, at=1.1, plot=FALSE) logspec.dist(tico1, tico2) logspec.dist(tico1, tico2, scale=TRUE)