Learn R Programming

soundgen (version 1.7.0)

harmHeight: Height of harmonics

Description

Internal soundgen function

Usage

harmHeight(
  frame,
  pitch,
  bin,
  freqs,
  harmThres = 3,
  harmTol = 0.25,
  harmPerSel = 5
)

Arguments

frame

the abs spectrum of a frame, as returned by fft

pitch

the final pitch estimate for the current frame

harmThres

minimum height of spectral peak, dB

harmTol

maximum tolerated deviation of peak frequency from multiples of f0, proportion of f0

harmPerSel

the number of harmonics per sliding selection

Value

Returns the frequency (Hz) up to which we find harmonics

Details

Attempts to estimate how high harmonics reach in the spectrum - that is, at what frequency we can still discern peaks at multiples of f0 or, for low-pitched sounds, regularly spaced peaks separated by ~f0.

Examples

Run this code
# NOT RUN {
s = soundgen(sylLen = 400, addSilence = 0, pitch = 400, noise = -10,
  rolloff = -15, jitterDep = .1, shimmerDep = 5, temperature = .001)
sp = spectrogram(s, samplingRate = 16000)
hh = soundgen:::harmHeight(sp[, 5], pitch = 400,
  freqs = as.numeric(rownames(sp)) * 1000, bin = 16000 / 2 / nrow(sp))
# }

Run the code above in your browser using DataLab