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, ...)
A list of 15 values is returned
mean frequency (see mean
)
standard deviation of the mean (see sd
)
standard error of the mean
median frequency (see median
)
mode frequency, i.e. the dominant frequency
first quartile (see quantile
)
third quartile (see quantile
)
interquartile range (see IQR
)
centroid, see note
skewness, a measure of asymmetry, see note
kurtosis, a measure of peakedness, see note
spectral flatness measure (see sfm
)
spectral entropy (see sh
)
frequency precision of the spectrum
a data set resulting of a spectral analysis obtained
with spec
or meanspec
(not in dB).
sampling frequency of spec
(in Hz).
logical, if TRUE
returns the results in a structured table.
a vector of length 2 to specifgy the frequency limits of the analysis (in kHz)
a logical, if TRUE
the (htk-)mel scale is used.
if 1
returns the spectrum , if 2
returns
the cumulative spectrum, both of them with the first quartile, the third quartile,
the median and the mode plotted (by default FALSE
).
if plot
is TRUE
, type of plot that should be drawn.
See plot
for details (by default "l" for lines).
label of the x axis.
label of the y axis.
colour of the mode segments (by default blue).
colour of the quartiles segments (by default red).
other arguments to be passed to plot
Jerome Sueur and Caroline Simonis, and a patch by Jesse Ross (Dec. 2012)
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
.
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)
Run the code above in your browser using DataLab