# program to compare equal tempered tunings with simple ratio tunings. # the program plays an interval followed by both pitches together. # experiment with using both the simple ratio tunings and equal tempered tunings. library(tuneR) # need to like with the sound library f = 400 # our base frequency sr = 16000 # sampling rate bits = 16 # bit depth secs = 3. # length of each note c = 2 # a 2:1 octave #c = 3/2 # a 3:2 perfect fifth #c = 4/3 # a 3:2 perfect fifth #c = 5/4 # a 5/4 major third #c = 6/5 # a 6/5 minor third c = 2^(7/12) # an equal temp perfect fifth #c = 2^(5/12) # an equal temp perfect fourth #c = 2^(4/12) # an equal temp. major third t = seq(0,secs,1/sr) # the time points we create samples for y = sin(2*pi*i*f*t); f = f*c; # move frequency up by interval described by c x = sin(2*pi*i*f*t); z = c(y,x,y+x); # first y, then x, then both u = Wave(2^(bits-5)*z, samp.rate = sr, bit=16) # make wave struct play(u) # play it