# a simple program to demponstrate that any two frequencies that have # the same ratio (c in these experiments) will have the same interval. # c can be any positive constant library(tuneR) # need to like with the sound library f = 440 # our base frequency sr = 16000 # sampling rate bits = 16 # bit depth secs = 2. # length of each note notes = 2 # number notes we'll hear ratio = 5/4 # ratio of frequencies try: (n+1) / n for n = 1:5) t = seq(0,secs,by=1/sr) # the time points we create samples for z = rep(0,0) for (i in 1:notes) { # our loop y = round(2^(bits-3) * sin(2*pi*f*t)) # make sine at freq f (don't need round) z = c(z,y) f = f*ratio # new freq for next note } w = Wave(z, samp.rate = sr, bit=16) # make wave struct play(w) # play it