# NOT RUN {
sound = soundgen(sylLen = 300, pitch = c(900, 400, 2300),
noise = list(time = c(0, 300), value = c(-40, 00)),
temperature = 0.001, addSilence = 0)
# playme(sound, 16000)
a = analyze(sound, samplingRate = 16000, plot = TRUE)
# }
# NOT RUN {
sound1 = soundgen(sylLen = 900, pitch = list(
time = c(0, .3, .9, 1), value = c(300, 900, 400, 2300)),
noise = list(time = c(0, 300), value = c(-40, 00)),
temperature = 0.001, addSilence = 0)
# improve the quality of postprocessing:
a1 = analyze(sound1, samplingRate = 16000, plot = TRUE, pathfinding = 'slow')
median(a1$pitch, na.rm = TRUE)
# (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))
# the same pitch contour, but harder b/c of subharmonics and jitter
sound2 = soundgen(sylLen = 900, pitch = list(
time = c(0, .3, .8, 1), value = c(300, 900, 400, 2300)),
noise = list(time = c(0, 900), value = c(-40, 20)),
subDep = 100, jitterDep = 0.5, nonlinBalance = 100, temperature = 0.001)
# 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,
xlab = 'Time, ms', colorTheme = 'seewave',
contrast = .5, ylim = c(0, 4),
pitchMethods = c('dom', 'autocor', 'spec'),
candPlot = list(
col = c('gray70', 'yellow', 'purple'), # same order as pitchMethods
pch = c(1, 3, 5),
cex = 3),
pitchPlot = list(col = 'black', lty = 3, lwd = 3))
# Plot pitch candidates w/o a spectrogram
a = analyze(sound2, samplingRate = 16000, plot = TRUE, plotSpec = FALSE)
# Different formatting options for output
a = analyze(sound2, samplingRate = 16000, summary = FALSE) # frame-by-frame
a = analyze(sound2, samplingRate = 16000, summary = TRUE,
summaryStats = c('mean', 'range')) # one row per sound
# Save the plot
a = analyze(sound, samplingRate = 16000,
savePath = '~/Downloads/',
width = 20, height = 15, units = 'cm', res = 300)
# }
Run the code above in your browser using DataLab