# NOT RUN {
sound = soundgen(sylLen = 300, pitchAnchors = list(
time = c(0, .5, 1), value = c(900, 400, 2300)),
noiseAnchors = list(time = c(0, 300), value = c(-40, 00)),
temperature = 0, addSilence = 0, overlap = 0)
# playme(sound, 16000)
a = analyze(sound, samplingRate = 16000, plot = TRUE)
# }
# NOT RUN {
sound1 = soundgen(sylLen = 900, pitchAnchors = list(
time = c(0, .3, .9, 1), value = c(300, 900, 400, 2300)),
noiseAnchors = list(time = c(0, 300), value = c(-40, 00)),
temperature = 0, addSilence = 0)
# improve the quality of postprocessing:
a1 = analyze(sound1, samplingRate = 16000, plot = TRUE, pathfinding = 'slow')
median(a1$pitch, na.rm = TRUE) # 583 Hz
# (can vary, since postprocessing is stochastic)
# compare to the true value:
median(getSmoothContour(anchors = list(time = c(0, .3, .8, 1),
value = c(300, 900, 400, 2300)), len = 1000)) # 611 Hz
# the same pitch contour, but harder b/c of subharmonics and jitter
sound2 = soundgen(sylLen = 900, temperature = 0,
pitchAnchors = list(time = c(0, .3, .8, 1),
value = c(300, 900, 400, 2300)),
noiseAnchors = list(time = c(0, 900), value = c(-40, 20)),
subDep = 100, jitterDep = 0.5, pitchEffectsAmount = 100)
sound2 = soundgen(sylLen = 900, pitchAnchors = list(
time = c(0, .3, .8, 1), value = c(300, 900, 400, 2300)),
noiseAnchors = list(time = c(0, 900), value = c(-40, 20)),
subDep = 100, jitterDep = 0.5, pitchEffects_amount = 100, temperature = 0)
# playme(sound2, 16000)
a2 = analyze(sound2, samplingRate = 16000, plot = TRUE, pathfinding = 'slow')
# many candidates are off, but the overall contour should be mostly accurate
# Fancy plotting options:
a = analyze(sound2, samplingRate = 16000, plot = TRUE,
specPlot = list(xlab = 'Time, ms', colorTheme = 'seewave', contrast = .8),
candPlot = list(cex = 3, col = c('gray70', 'yellow', 'purple', 'maroon')),
pitchPlot = list(col = 'black', lty = 3, lwd = 3))
# Plot pitch candidates w/o a spectrogram
a = analyze(sound2, samplingRate = 16000, plot = TRUE, specPlot = NA)
# }
Run the code above in your browser using DataLab