hadley wickham
2007-Apr-10 20:47 UTC
[R] Computing fundamental harmonics from a periodogram
Dear all, I'm trying to finding the fundamental harmonics (ie. peaks in a periodogram) from a time series (extracted from an mp3). For example, if I look at spectrum(fdeaths, spans = c(3,3)) I'd say the fundamental harmonics are about 1, 2, 3.5 and 4.5 - but how can I extract these automatically? (preferably with some heuristic for choosing the smoothing spans too) I'm aware of heuristic methods for finding peaks for general sequences (as found by searching for peaks on R-help) but I have a feeling there's something with some theoretical justification for the case of periodograms. Could anyone point me in the right direction in terms of theory or an R package that implements an approach? Thanks, Hadley
hadley wickham wrote:> Dear all, > > I'm trying to finding the fundamental harmonics (ie. peaks in a > periodogram) from a time series (extracted from an mp3). For example, > if I look at > > spectrum(fdeaths, spans = c(3,3))A heuristical procedure for finding fundamentals of a monophonic sound can be found in package tuneR. For a short example how to use it, type: install.packages("tuneR") library(tuneR) ?tuneR For polyphonic sound, I do not know any method that is both sufficiently fast (i.e. calculates results for a 1 minute sound in less than a day) and accurate. Uwe Ligges> I'd say the fundamental harmonics are about 1, 2, 3.5 and 4.5 - but > how can I extract these automatically? (preferably with some > heuristic for choosing the smoothing spans too) > > I'm aware of heuristic methods for finding peaks for general sequences > (as found by searching for peaks on R-help) but I have a feeling > there's something with some theoretical justification for the case of > periodograms. Could anyone point me in the right direction in terms > of theory or an R package that implements an approach? > > Thanks, > > Hadley > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.