setwd('/home/allgoodguys/Documents/Studying/Lund_PhD/epistles/008_sova/demo') filename = 'sr_322' library(soundgen) # copy of the original s1 = soundgen(sylLen = 620, pitchAnchors = list( time = c(0, 90, 91, 360, 570, 620), value = c(1000, 1120, 1900, 2300, 2000, 1240)), rolloff = c(-10, -5, -5, -10), temperature = 0.001, nonlinRandomWalk = c(rep(0, 13), rep(2, 87)), subDep = 0, jitterDep = c(0.5, 2, 1), shimmerDep = 10, formants = c(900, 2100, 3500, 4500), mouthAnchors = c(.4, .6, .4), addSilence = 0, samplingRate = 22050, pitchSamplingRate = 22050, play = T, plot = T, osc = T) s2 = soundgen(sylLen = 55, pitchAnchors = c(620, 600), rolloff = -30, temperature = 0.001, formants = NULL, vocalTract = 13, addSilence = 0, samplingRate = 22050, pitchSamplingRate = 22050, play = T, plot = T, osc = T) s = addVectors(s1 * 2, s2, insertionPoint = length(s1) + 22050 * .04) playme(s, 22050) spectrogram(s, 22050) # seewave::meanspec(s, f = 22050, alim = c(-80, 0), flim = c(0, 8), dB = 'max0') seewave::savewav(s, f = 22050, filename = paste0('copy.wav')) # no nonlin s1 = soundgen(sylLen = 620, pitchAnchors = list( time = c(0, 60, 120, 360, 590, 620), value = c(1000, 1120, 1900, 2300, 2040, 1240)), rolloff = c(-10, -5, -5, -10), temperature = 0.001, # nonlinRandomWalk = c(rep(0, 13), rep(2, 87)), # subDep = 0, jitterDep = c(0.5, 2, 1), shimmerDep = 10, formants = c(900, 2100, 3500, 4500), mouthAnchors = c(.4, .6, .4), addSilence = 0, samplingRate = 22050, pitchSamplingRate = 22050, play = T, plot = T, osc = T) s = addVectors(s1 * 2, s2, insertionPoint = length(s1) + 22050 * .04) playme(s, 22050) seewave::savewav(s, f = 22050, filename = paste0('none.wav')) ## PITCH JUMPS s1 = soundgen(sylLen = 620, pitchAnchors = list( time = c(0, 90, 91, 360, 570, 620), value = c(1000, 1120, 1900, 2300, 2000, 1240)), rolloff = c(-10, -5, -5, -10), temperature = 0.001, # nonlinRandomWalk = c(rep(0, 13), rep(2, 87)), # subDep = 0, jitterDep = c(0.5, 2, 1), shimmerDep = 10, formants = c(900, 2100, 3500, 4500), mouthAnchors = c(.4, .6, .4), addSilence = 0, samplingRate = 22050, pitchSamplingRate = 22050, play = T, plot = T, osc = T) s = addVectors(s1 * 2, s2, insertionPoint = length(s1) + 22050 * .04) playme(s, 22050) seewave::savewav(s, f = 22050, filename = paste0('pitch_jumps.wav')) ## SUBHARMONICS s1 = soundgen(sylLen = 700, # compensate for changing epochs pitchAnchors = list( time = c(0, 60, 120, 360, 590, 620), value = c(1000, 1120, 1900, 2300, 2040, 1240)), rolloff = c(-10, -5, -5, -10), temperature = 0.001, nonlinRandomWalk = c(rep(0, 13), rep(1, 87)), shortestEpoch = 100, subFreq = 110, subDep = 75, jitterDep = 0, shimmerDep = 0, formants = c(900, 2100, 3500, 4500), mouthAnchors = c(.4, .6, .4), addSilence = 0, samplingRate = 22050, pitchSamplingRate = 22050, play = T, plot = T, osc = T) s = addVectors(s1 * 2, s2, insertionPoint = length(s1) + 22050 * .04) playme(s, 22050) seewave::savewav(s, f = 22050, filename = paste0('subh.wav')) ## CHAOS s1 = soundgen(sylLen = 620, pitchAnchors = list( time = c(0, 60, 120, 360, 590, 620), value = c(1000, 1120, 1900, 2300, 2040, 1240)), rolloff = c(-10, -5, -5, -10), temperature = 0.001, nonlinRandomWalk = c(rep(0, 13), rep(2, 87)), subDep = 0, jitterDep = c(0.5, 2, 1), shimmerDep = 10, formants = c(900, 2100, 3500, 4500), mouthAnchors = c(.4, .6, .4), addSilence = 0, samplingRate = 22050, pitchSamplingRate = 22050, play = T, plot = T, osc = T) s = addVectors(s1 * 2, s2, insertionPoint = length(s1) + 22050 * .04) playme(s, 22050) seewave::savewav(s, f = 22050, filename = paste0('chaos.wav')) ## MIXED s1 = soundgen(sylLen = 700, # compensate for changing epochs pitchAnchors = list( time = c(0, 90, 91, 360, 570, 620), value = c(1000, 1120, 1900, 2300, 2000, 1240)), rolloff = c(-10, -5, -5, -10), temperature = 0.001, nonlinRandomWalk = c(rep(0, 13), rep(2, 87)), shortestEpoch = 100, subFreq = 110, subDep = 75, jitterDep = c(0.5, 2, 1), shimmerDep = 10, formants = c(900, 2100, 3500, 4500), mouthAnchors = c(.4, .6, .4), addSilence = 0, samplingRate = 22050, pitchSamplingRate = 22050, play = T, plot = T, osc = T) s = addVectors(s1 * 2, s2, insertionPoint = length(s1) + 22050 * .04) playme(s, 22050) seewave::savewav(s, f = 22050, filename = paste0('mixed.wav')) ## extract spectrograms spectrogramFolder('/home/allgoodguys/Documents/Studying/Lund_PhD/epistles/008_sova/demo', htmlPlots = FALSE, ylim = c(0, 8), width = 400, height = 400, osc = T)