#  generate 5 Hz sine wave

from math import *
from numpy import append,empty
from scipy.io.wavfile import read, write

freqSamp=44100

freqNote=5
sampInt=freqSamp//freqNote

sampSine=empty(sampInt).astype(float)

print(sampSine,sampSine.shape,type(sampSine))

twopi=2*pi
sampSine[0]=0.0
time=1
while time<sampInt:
    sampSine[time]=sin(twopi*time/sampInt)
    time=time+1

print(sampSine)


sineWav=sampSine
cnt=freqNote-1

while cnt>0:
    sineWav=append(sineWav,sampSine)
    cnt=cnt-1

write('sine.wav',freqSamp,sineWav)

amount=0.5

mod=sineWav*amount

# tremolo

(rate,trieng)=read('trieng.wav')

write('tritrem.wav',rate,trieng*(1+mod))