pathfinding_fast: Path through pitch candidates: fast

View source: R/pitch_postprocessing.R

pathfinding_fastR Documentation

Path through pitch candidates: fast

Description

Internal soundgen function.

Usage

pathfinding_fast(
  pitchCands,
  pitchCert,
  pitchSource,
  step,
  pitchCenterGravity,
  certWeight,
  seed_ms = 250,
  plot = FALSE
)

Arguments

pitchCands

a matrix of multiple pitch candidates per fft frame. Each column is one fft frame, each row is one candidate (the last row is always "manual")

pitchCert

a matrix of the same dimensionality as pitchCands specifying our certainty in pitch candidates

step

you can override overlap by specifying FFT step, ms (NB: because digital audio is sampled at discrete time intervals of 1/samplingRate, the actual step and thus the time stamps of STFT frames may be slightly different, eg 24.98866 instead of 25.0 ms)

pitchCenterGravity

numeric vector giving the mean of all pitch candidates per fft frame weighted by our certainty in each of these candidates

certWeight

(0 to 1) in pitch postprocessing, specifies how much we prioritize the certainty of pitch candidates vs. pitch jumps / the internal tension of the resulting pitch curve

seed_ms

start a new seed roughly every ... ms

plot

if TRUE, plots pitch candidates and explored paths

Details

Uses a modified Viterbi algorithm to find a reasonable path though pitch candidates. The idea is to start at several random "seeds", each time exploring as many paths as there are candidates per seed. The path with the lowest global cost is returned. Transition costs are a weighted mean of two penalties: based on pitch certainties (corrected for distance from pitch center of gravity) and on pitch jumps.


soundgen documentation built on Sept. 12, 2024, 6:29 a.m.