pwelch: Welch's Power Spectral Density Estimate

Description Usage Arguments Details Value Author(s) Examples

View source: R/pwelch.R

Description

Calculates a power spectral density estimate using Welch's method.

Usage

1
2
3
pwelch (sound, points = 0, overlap = 0, padding = 0, 
window = 'hamming', show = TRUE, fs = 1, preemphasisf = 0, 
zeromax = TRUE, type,...)

Arguments

sound

A vector representing a sound wave, or a 'sound' object.

points

The number of points to be included in each window. If not specified, the sound is divided into 10 equally-sized windows.

overlap

The amount of overlap between adjacent segments, in points.

padding

The amount of zero padding to be applied to each window.

window

The window to be applied to each segment of the signal. See windowfunc() for available options.

show

If FALSE, no plot is created.

fs

The sampling frequency of the sound. If a 'sound' object is passed this does not need to be specified.

preemphasisf

Preemphasis of 3 dB per octave is added to frequencies above the specified frequency.

zeromax

If TRUE, the maximum dB is set to 0.

type

The line type to be used for plotting, passes its value to the 'lty' parameter.

...

any additional arguments will be passed to the internal calls of 'plot'.

Details

This function divides the signal into a number of equally-sized windows, finds the power spectrum of each one, and then finds the average across all windowed sections.

Value

The following columns:

hz

The center frequency of the analysis bins.

dB

The dB magnitude/power for the analysis bin.

Author(s)

Santiago Barreda <[email protected]>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## make a sine wave
sinewave = sinusoid (f = 300, fs = 1000, dur = 2000, sum = FALSE)

## add noise
sinewave = sinewave[,2] + rnorm (length (sinewave[,2]), 0, 3)

## compare the results of pwelch() and spectralslice()
par (mfrow = c(2,1), mar = c(4,4,1,1))
spectralslice (sinewave, fs = 1000)
pwelch (sinewave, points = 400, fs = 1000)

phonTools documentation built on May 29, 2017, 9 a.m.