periodogram {tuneR}R Documentation

Periodogram (Spectral Density) Estimation on Wave objects

Description

This function estimates one or more periodograms (spectral densities) of the time series contained in an object of class Wave using a window running through the time series (possibly with overlapping). It returns an object of class Wspec.

Usage

periodogram(object, width = length(object@left), overlap = 0, 
    starts = NULL, ends = NULL, taper = 0, normalize = TRUE, ...)

Arguments

object An object of class Wave.
width A window of width ‘width’ running through the time series selects the samples from which the periodograms are to be calculated.
overlap The window can be applied by each overlapping overlap samples.
starts Start number (in samples) for a window. If not given, this value is derived from argument ends, or will be derived width and overlap.
ends End number (in samples) for a window. If not given, this value is derived from argument starts, or will be derived from width and overlap.
taper proportion of data to taper. See spec.pgram for details.
normalize Logical; if TRUE (default), two steps will be applied: (i) the input signal will be normalized to amplitude max(abs(amplitude)) == 1, (ii) the resulting spec values will be normalized to sum up to one for each periodogram.
... Further arguments to be passed to the underlying function spec.pgram.

Value

An object of class Wspec is returned containing the following slots.

freq Vector of frequencies at which the spectral density is estimated. See spectrum for details. (1)
spec List of vectors or matrices of the spec values returned by spec.pgram at frequencies corresponding to freq. Each element of the list corresponds to one periodogram estimated from samples of the window beginning at start of the Wave object.
kernel The kernel argument, or the kernel constructed from spans returned by spec.pgram. (1)
df The distribution of the spectral density estimate can be approximated by a chi square distribution with df degrees of freedom. (1)
taper The value of the taper argument. (1)
width The value of the width argument. (1)
overlap The value of the overlap argument. (1)
normalize The value of the normalize argument. (1)
starts If the argument starts was given in the call, its value. If the argument ends was given in the call, ‘ends - width’. If neither starts nor ends was given, the start points of all periodograms. In the latter case the start points are calculated from the arguments width and overlap.
stereo Whether the underlying Wave object was stereo ot not. (1)
samp.rate Sampling rate of the underlying Wave object. (1)
variance The variance of samples in each window, corresponding to amplitude / loudness of sound.
energy The “energy” E, also an indicator for the amplitude / loudness of sound:

E(x_I) := 20 * log_{10} sum_{j in I} |x_j|,

where I indicates the interval I:= start[i]:end[i] for all 1:=1,..., length(starts).

Those slots marked with “(1)” contain the information once, because it is unique for all periodograms of estimated by the function call.

Note

This function is still in development. Support for processing of stereo Wave objects has not yet been implemented.

Author(s)

Uwe Ligges, ligges@statistik.uni-dortmund.de

See Also

Examples

# constructing a Wave object (1 sec.) containing sinus sound with 440Hz:
x <- seq(0, 2*pi, length = 44100)
channel <- round(32000 * sin(440 * x))
Wobj <- Wave(left = channel)
Wobj

# Calculate periodograms in windows of 4096 samples each - without
#   any overlap - resulting in an Wspec object that is printed:
Wspecobj <- periodogram(Wobj, width = 4096)
Wspecobj

# Plot the first periodogram from Wspecobj:
plot(Wspecobj)
# Plot the third one and choose a reasonable xlim:
plot(Wspecobj, which = 3, xlim = c(0, 1000))
# Mark frequency that has been generated before:
abline(v = 440, col="red")

FF(Wspecobj)              # all ~ 440 Hertz
noteFromFF(FF(Wspecobj))  # all diapason a

[Package Contents]