specprop | R Documentation |
This function returns a list of statistical properties of a frequency spectrum.
specprop(spec, f=NULL,
str = FALSE, flim=NULL, mel=FALSE,
plot = FALSE, type = "l", xlab=NULL, ylab = NULL,
col.mode = 2, col.quartiles = 4, ...)
spec |
a data set resulting of a spectral analysis obtained
with |
f |
sampling frequency of |
str |
logical, if |
flim |
a vector of length 2 to specifgy the frequency limits of the analysis (in kHz) |
mel |
a logical, if |
plot |
if |
type |
if |
xlab |
label of the x axis. |
ylab |
label of the y axis. |
col.mode |
colour of the mode segments (by default blue). |
col.quartiles |
colour of the quartiles segments (by default red). |
... |
other arguments to be passed to |
The spectrum is converted in a probability mass function (PMF).
If a selected value has to be selected with $,
the argument str
has to be set to FALSE
.
A list of 15 values is returned
mean |
mean frequency (see |
sd |
standard deviation of the mean (see |
sem |
standard error of the mean |
median |
median frequency (see |
mode |
mode frequency, i.e. the dominant frequency |
Q25 |
first quartile (see |
Q75 |
third quartile (see |
IQR |
interquartile range (see |
cent |
centroid, see |
skewness |
skewness, a measure of asymmetry, see |
kurtosis |
kurtosis, a measure of peakedness, see |
sfm |
spectral flatness measure (see |
sh |
spectral entropy (see |
prec |
frequency precision of the spectrum |
Centroid is computed according to:
C = \sum_{i = 1}^{N} x_i\times{y_i}
with:
x = frequencies,
y = relative amplitude of the i frequency,
N = number of frequencies.
Skewness is computed according to:
S = \frac{\sum_{i = 1}^{N}(x_i-\bar{x})^{3}}{N-1}\times{\frac{1}{\sigma^{3}}}
.
S < 0 when the spectrum is skewed to left,
S = 0 when the spectrum is symetric,
S > 0 when the spectrum is skewed to right.
Spectrum asymmetry increases with |S|.
Kurtosis is computed according to:
K = \frac{\sum_{i = 1}^{N}(x_i-\bar{x})^{4}}{N-1}\times{\frac{1}{\sigma^{4}}}
.
K < 3 when the spectrum is platikurtic, i.e. it has fewer items at the
center and at the tails than the normal curve but has more items in the shoulders,
K = 3 when the spectrum shows a normal shape,
K > 3 when the spectrum is leptokurtic, i.e. it has more items near
the center and at the tails, with fewer items in the shoulders
relative to normal distribution with the same mean and variance.
Jerome Sueur and Caroline Simonis, and a patch by Jesse Ross (Dec. 2012)
data(orni)
a<-meanspec(orni,f=22050,plot=FALSE)
specprop(a,f=22050)
# to get a single measure of the list
specprop(a,f=22050)$mode
# to get the results structured
specprop(a,f=22050,str=TRUE)
# to limit the analysis between 4 and 6 kHz
specprop(a,f=22050,flim=c(4,6),str=TRUE)
# plots
specprop(a,f=22050,plot=1)
specprop(a,f=22050,plot=2)
# (htk-)mel scale
require(tuneR)
mel <- melfcc(orni, nbands = 256, dcttype = "t3", fbtype = "htkmel", spec_out=TRUE)
melspec.mean <- apply(mel$aspectrum, MARGIN=2, FUN=mean)
specprop(melspec.mean, f=22050, mel=TRUE)
# be aware that flim is always given in kHz even if mel=TRUE
specprop(melspec.mean, f=22050, flim=c(4,6), mel=TRUE, plot=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.