View source: R/analyze_utilities.R
getPrior | R Documentation |
Prior for adjusting the estimated pitch certainties in analyze
.
For ex., if primarily working with speech, we could prioritize pitch
candidates in the expected pitch range (100-1000 Hz) and decrease our
confidence in candidates with very high or very low frequency as unlikely but
still remotely possible. You can think of this as a "soft" alternative to
setting absolute pitch floor and ceiling. Algorithm: the multiplier for each
pitch candidate is the density of prior distribution with mean = priorMean
(Hz) and sd = priorSD (semitones) normalized so max = 1 over [pitchFloor,
pitchCeiling]. Useful for previewing the prior given to
analyze
.
getPrior(
priorMean,
priorSD,
distribution = c("normal", "gamma")[1],
pitchFloor = 75,
pitchCeiling = 3000,
len = 100,
plot = TRUE,
pitchCands = NULL,
...
)
priorMean , priorSD |
specifies the mean (Hz) and standard deviation
(semitones) of gamma distribution describing our prior knowledge about the
most likely pitch values for this file. For ex., |
distribution |
the shape of prior distribution on the musical scale: 'normal' (mode = priorMean) or 'gamma' (skewed to lower frequencies) |
pitchFloor , pitchCeiling |
absolute bounds for pitch candidates (Hz) |
len |
the required length of output vector (resolution) |
plot |
if TRUE, plots the prior |
pitchCands |
a matrix of pitch candidate frequencies (for internal soundgen use) |
... |
additional graphical parameters passed on to plot() |
Returns a numeric vector of certainties of length len
if
pitchCands is NULL and a numeric matrix of the same dimensions as
pitchCands otherwise.
analyze
pitch_app
soundgen:::getPrior(priorMean = 150, # Hz
priorSD = 2) # semitones
soundgen:::getPrior(150, 6)
s = soundgen:::getPrior(450, 24, pitchCeiling = 6000)
plot(s, type = 'l')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.