View source: R/spectralDescr.R
subhToHarm | R Documentation |
Internal soundgen function
subhToHarm(
frame,
bin,
freqs,
pitch,
pitchCands = NULL,
samplingRate,
method = c("cep", "pitchCands", "harm")[1],
nSubh = 5,
tol = 0.05,
nHarm = 5,
harmThres = 12,
harmTol = 0.25,
amRange = c(10, 200)
)
frame |
the abs spectrum of a frame, as returned by
|
bin |
spectrogram bin width, Hz |
freqs |
frequency per bin of spectrogram |
pitch |
pitch per frame, Hz |
pitchCands |
a list of pitch candidates and certainties sent from analyze() |
samplingRate |
sampling rate (Hz) |
method |
'cep' = cepstrum, 'pitchCands' = existing pitch candidates below f0, 'harm' = look for harmonic peaks. Only 'cep' is really working at the moment. |
nSubh |
the maximum ratio of f0 / g0 to consider |
tol |
target frequency (eg f0 / 2) has to be within |
nHarm |
for method 'harm' only |
harmThres |
minimum height of spectral peak, dB |
harmTol |
maximum tolerated deviation of peak frequency from multiples of f0, proportion of f0 |
Looks for pitch candidates (among the ones already found if method = 'pitchCands', or using some other pitch-tracking-like techniques such as cepstrum) at integer ratios of f0. If such candidates are found, they are treated as subharmonics. Note that this depends critically on accurate pitch tracking.
## Not run:
s400 = soundgen(
sylLen = 300, pitch = c(280, 370, 330),
subDep = list(
time = c(0, .5, .51, 1),
value = c(0, 0, 10, 10)
), subRatio = 3,
smoothing = list(interpol = 'approx'), formants = 'a',
rolloff = -12, addSilence = 50, temperature = .001,
plot = TRUE, ylim = c(0, 2)
)
s = analyze(s400, samplingRate = 16000,
windowLength = 50, step = 10,
pitchMethods = c('dom', 'autocor', 'hps'), priorMean = NA,
plot = TRUE, ylim = c(0, 3),
extraContour = list('subDep', type = 'b', col = 'brown'))
s$detailed[, c('subRatio', 'subDep')]
s2 = analyze(s400, samplingRate = 16000,
windowLength = 50, step = 10,
pitchMethods = c('dom', 'autocor', 'hps'), priorMean = NA,
subh = list(method = 'harm'),
plot = TRUE, ylim = c(0, 3),
extraContour = list('subDep', type = 'b', col = 'brown'))
s$detailed[, c('subRatio', 'subDep')]
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.