cepstrum: Quefrency Cepstrum from Spectrogram

Description Usage Arguments Value Author(s) References Examples

View source: R/cepstrum.R

Description

uses algorithms from wikipedia and my rudimentary understanding of cepstra to convert a spectrogram into a cepstrum

Usage

1
cepstrum(spg)

Arguments

spg

a spectrogram object

Value

a cepstrum object, which can be plotted like a spectrogram

Author(s)

Benjamin N. Taft ben.taft@landmarkacoustics.com

References

http://en.wikipedia.org/wiki/Cepstrum

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (spg) 
{
    if (is(spg) == "spg") {
        sample.rate <- sample.rate.spg(spg)
        NR <- nrow(spg)
        ix <- (ncol(spg)/2):1
        cpg <- matrix(NA, NR, length(ix))
        H <- hamming(ncol(spg))
        for (i in 1:NR) {
            cpg[i, ] <- spk(scale(spg[i, ], scale = F) * H)
        }
        attributes(cpg) <- c(attributes(cpg), list(time = attr(spg, 
            "time"), quefrency = sample.rate/ix))
        class(cpg) <- c("cepstrum", class(cpg))
        invisible(cpg)
    }
  }

landmarkacoustics/SoundPoints-R documentation built on May 29, 2019, 9:14 a.m.