# an example of pitch vibrato using ideas from class. observe what happens as
# the pitch excursions (df) become large and the vibrate rate (v) becomes large
# when df and v are large this synthesis technique is known as frequency modulation
library(tuneR) # need to like with the sound library
f = 440 # our base frequency
sr = 16000 # sampling rate
b = 16 # bit depth
T = 5 # length of note
v = 5 # rate of vibrato
df = 5 # vib width in Hz
t = seq(0,T,1/sr)
y = sin(2*pi*f*t + (df/v)*cos(2*pi*v*t))
u = Wave(round(2^(b-5)*y), samp.rate = sr, bit=b)
play(u,"play")