library(tuneR) # need to like with the sound library f = 1200 # our base frequency sr = 16000 # sampling rate bits = 16 # bit depth T = 5 # length of octave drop t = seq(1/sr,T,length = T*sr) # the time points phi = 2*pi*f*T*2^(-t/T)/log(2) # the sin's "argument" or "phase" func a1 = seq(1,0,length=length(t)) # amplitude of fundamental a2 = seq(0,1,length=length(t)) # amp of 2nd harmonic # y = sin(phi) # constant pitch change #y = sin(phi) + sin(2*phi) # with different timbre c = 1.6 y = a1^c*sin(phi) + a2^c*sin(2*phi) # with changing timbre y = c(y,y) y = c(y,y) u = Wave(round(2^(bits-5)*y), samp.rate = sr, bit=16) # make wave struct play(u,"play") # play it