## Wavetable and Additive Synthesis (lab)

• Using the PeriodicWave demo, create a sawtooth wavetable and a triangular wavetable with the following Fourier series with the fundamental frequency, f:
• Square: 4/pisum_(k=0)^oo 1/k sin(2pifkt) text{ for } k=1,3,5,...
Sawtooth: 1/2 - 1/pisum_(k=0)^oo 1/k sin(2pifkt) text{ for } k=1,2,3,...
Triangle: 8/pi^2sum_(k=0)^oo (-1)^{(k-1)//2}/k^2 sin(2pifkt) text{ for } k=1,3,5,...

## Why we do not use table lookups for sine wave generation

### Speed test your CPU (lab)

• Speed test of your CPU
• If you don't have gcc on your machine, upload (sftp) to a subdirectory of your music.mcgill.ca account
• Uncompress speedtest.tar.gz (double-click on OSX or "tar -xf speedtest.tar.gz")
• make c_speedtest
• ./c_speedtest -nsize 1000000 -niters 1000
• Add a vectorCosine() test

## Amplitude Modulation (AM) Syntheis

### Amplitude Modulation (AM) Math

Carrier: c(t) = A*sin(omega_ct), omega_c = 2pif
Modualtor: m(t) = M*cos(omega_mt), omega_m = 2pif
Amplitude Modulation: y(t) = [1 + m(t)]*c(t)
= [1 + M*cos(omega_mt)]*A*sin(omega_ct)
= A*sin(omega_ct) + A*M*cos(omega_mt)*sin(omega_ct)
= A*sin(omega_ct) + A*M//2[sin(omega_ct+omega_mt)+sin(omega_ct-omega_mt)]

since: cos(b)sin(a) = 1//2[sin(a+b)+sin(a-b)]

### Ring Modulation

Carrier: c(t) = A*sin(omega_ct), omega_c = 2pif
Modualtor: m(t) = M*cos(omega_mt), omega_m = 2pif
Ring Modulation: y(t) = m(t)*c(t)
= M*cos(omega_mt)*A*sin(omega_ct)
= A*M*cos(omega_mt)*sin(omega_ct)
= A*M//2[sin(omega_ct+omega_mt)+sin(omega_ct-omega_mt)]

since: cos(b)sin(a) = 1//2[sin(a+b)+sin(a-b)]