Wave
(or directly in a Wave file)
using a window running through the time series (possibly with overlapping).
It returns an object of class Wspec
.periodogram(object, ...)
## S3 method for class 'Wave':
periodogram(object, width = length(object), overlap = 0,
starts = NULL, ends = NULL, taper = 0, normalize = TRUE,
frqRange = c(-Inf, Inf), ...)
## S3 method for class 'character':
periodogram(object, width, overlap = 0, from = 1, to = Inf,
units = c("samples", "seconds", "minutes", "hours"),
downsample = NA, channel = c("left", "right"), pieces = 1, ...)
Wave
or a character string pointing to a Wave file.width
overlap
samples.ends
,
or will be derived width
and overlap
.starts
,
or will be derived from width
and overlap
.spec.pgram
for details.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 eunits
.units
.from
and to
is given, the default is NA
, the default, no changes are applied. Otherwise downsample
must be in [2000, 192000]
;
typical values are 11025, 22050, and 44100 for CD qualimono
for details) - stereo processing is not yet implemented.pieces
steps in order to reduce the amount
of required memory.spec.pgram
.Wspec
is returned containing the following slots.spectrum
for details. (1)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.spec.pgram
. (1)df
degrees of freedom. (1)taper
argument. (1)width
argument. (1)overlap
argument. (1)normalize
argument. (1)starts
was given in the call, its value.
If the argument ends
was given in the call, ends - width
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
.Wave
object
was stereo ot not. (1)Wave
object
. (1)start[i]:end[i]
for all
$i:=1,\dots,$ length(starts)
.Wspec
,plot-Wspec
,spec.pgram
,Wave
.# constructing a Wave object (1 sec.) containing sinus sound with 440Hz:
Wobj <- sine(440, bit = 16)
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
Run the code above in your browser using DataLab