harmHeight: Height of harmonics

View source: R/spectralDescr.R

harmHeightR Documentation

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

bin

spectrogram bin width, Hz

freqs

frequency per bin of spectrogram

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

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.

Value

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

Examples

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))

soundgen documentation built on Aug. 14, 2022, 5:05 p.m.