seewave (version 2.2.3)

specprop: Spectral properties

Description

This function returns a list of statistical properties of a frequency spectrum.

Usage

specprop(spec, f=NULL,
str = FALSE, flim=NULL, mel=FALSE,
plot = FALSE, type = "l", xlab=NULL, ylab = NULL,
col.mode = 2, col.quartiles = 4, ...)

Value

A list of 15 values is returned

mean

mean frequency (see mean)

sd

standard deviation of the mean (see sd)

sem

standard error of the mean

median

median frequency (see median)

mode

mode frequency, i.e. the dominant frequency

Q25

first quartile (see quantile)

Q75

third quartile (see quantile)

IQR

interquartile range (see IQR)

cent

centroid, see note

skewness

skewness, a measure of asymmetry, see note

kurtosis

kurtosis, a measure of peakedness, see note

sfm

spectral flatness measure (see sfm)

sh

spectral entropy (see sh)

prec

frequency precision of the spectrum

Arguments

spec

a data set resulting of a spectral analysis obtained with spec or meanspec (not in dB).

f

sampling frequency of spec (in Hz).

str

logical, if TRUE returns the results in a structured table.

flim

a vector of length 2 to specifgy the frequency limits of the analysis (in kHz)

mel

a logical, if TRUE the (htk-)mel scale is used.

plot

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).

type

if plot is TRUE, type of plot that should be drawn. See plot for details (by default "l" for lines).

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 plot

Author

Jerome Sueur and Caroline Simonis, and a patch by Jesse Ross (Dec. 2012)

Details

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.

Examples

Run this code
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