Description Usage Arguments Value Note Author(s) See Also Examples
This function estimates one or more periodograms (spectral densities)
of the time series contained in an object of class Wave
or WaveMC
(or directly in a Wave file)
using a window running through the time series (possibly with overlapping).
It returns an object of class Wspec
.
1 2 3 4 5 6 7 8 9  periodogram(object, ...)
## S4 method for signature 'WaveGeneral'
periodogram(object, width = length(object), overlap = 0,
starts = NULL, ends = NULL, taper = 0, normalize = TRUE,
frqRange = c(Inf, Inf), ...)
## S4 method for signature 'character'
periodogram(object, width, overlap = 0, from = 1, to = Inf,
units = c("samples", "seconds", "minutes", "hours"),
downsample = NA, channel = c("left", "right"), pieces = 1, ...)

object 
An object of class 
width 
A window of width ‘ 
overlap 
The window can be applied by each overlapping 
starts 
Start number (in samples) for a window.
If not given, this value is derived from argument 
ends 
End number (in samples) for a window.
If not given, this value is derived from argument 
taper 
proportion of data to taper. See 
normalize 
Logical; if 
frqRange 
Numeric vector of two elements indicating minimum and maximum of the frequency range that is to be stored in the resulting object. This is useful to reduce memory consumption. 
from 
Where to start reading in the Wave file, in 
to 
Where to stop reading in the Wave file, in 
units 
Units in which 
downsample 
Sampling rate the object is to be downsampled to.
If 
channel 
Character, indicating whether the “left” or “right” channel should be extracted
(see 
pieces 
The Wave file will be read in in 
... 
Further arguments to be passed to the underlying function 
An object of class Wspec
is returned containing the following slots.
freq 
Vector of frequencies at which the spectral density is estimated.
See 
spec 
List of vectors or matrices of the 
kernel 
The kernel argument, or the kernel constructed from spans returned by 
df 
The distribution of the spectral density estimate can be approximated by a chi square distribution with

taper 
The value of the 
width 
The value of the 
overlap 
The value of the 
normalize 
The value of the 
starts 
If the argument 
stereo 
Always 
samp.rate 
Sampling rate of the underlying 
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:= 
Those slots marked with “(1)” contain the information once, because it is unique for all periodograms of estimated by the function call.
Support for processing more than one channel of Wave
or WaveMC
objects has not yet been implemented.
Uwe Ligges [email protected]
for the resulting objects' class: Wspec
,
for plotting: plotWspec
,
for the underlying periodogram calculations: spec.pgram
,
for the input data class: Waveclass, Wave
, WaveMCclass, WaveMC
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  # constructing a Wave object (1 sec.) containing sinus sound with 440Hz:
Wobj < sine(440)
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

Wave Object
Number of Samples: 44100
Duration (seconds): 1
Samplingrate (Hertz): 44100
Channels (Mono/Stereo): Mono
PCM (integer format): FALSE
Bit (8/16/24/32/64): 32
Wspec Object (use summary() for more details)
Number of Periodograms: 11
Estimated at 2048 Frequencies: 10.7666 ... 22050
Further parameters:
width: 4096
overlap: 0
normal.: TRUE
[1] 440.6120 440.5971 440.6010 440.6152 440.6085 440.5957 440.6049 440.6159
[9] 440.6045 440.5957 439.1563
[1] 0 0 0 0 0 0 0 0 0 0 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.