Lecture SlidesNOTE: By the way... some of the slides have NOT been updated and the code they have is for the clm1 version of the instrument. However anything you can cut and paste is (ahem, should be) clm2 code... Digital SoundTransducers change one type of energy into another...
A basic limitation on how things work is that we need to sample a given signal at least twice as fast as the highest frequency present in the signal. Otherwise we won't be able to reconstruct the signal from the samples.
DAC's and ADC'sADC: converts an analog signal to a stream of samples. We filter the signal to make sure that no frequencies past half the sampling rate go through (to satisfy the Nyquist criteria). Then we sample it and quantize it to the word length we are using.
DAC
Here we see how sampling at less than 1/2 the highest frequency gives rise to "aliasing", where frequencies "reflect" around zero and create components in the reconstructed output that were not there to begin with...
How do we express a sine wave in the discrete digital domain?
Fourier TransformWith these pair of formulas we can move back and forth between a time represetation of our signal and a frequency domain representation. Pure magic...
Same thing but in the discrete digital domain...
N samples in time give us N samples in frequency and viceversa.
And this is how we view both a time domain representation (waveform) and a frequency domain representation (fft) of a particular sound (a bell).
We can also view things tridimensionally, that is, show fft slices of the sound at different times in a waterfall representation. This gives us an idea on how the sound changes over time.
Additive SynthesisIn theory we add up a bunch of sine waves and get any complex arbitrary signal.
The simplest case is when all overtones are integer multiples of the fundamental frequency. In this simple case the waveform is periodic.
As the periodic waveform repeats over time we can implement additive synthesis by using a table to store the values of one cycle instead of adding the output of all the equivalent sine oscillators (it is a lot more efficient). Here's a simple clm instrument that implements additive synthesis by using the tablelookup unit generator
And the text version for it:
(definstrument dowave (startime duration frequency amplitude harmonics) (multiplevaluebind (beg end) (times>samples startime duration) (let* ((waveform (partials>wave harmonics)) (s (maketablelookup :frequency frequency :wave waveform)) (ampenv (makeenv :envelope '(0 0 0.5 1 1 0) :duration duration :scaler amplitude))) (run (loop for i from beg to end do (outa i (* (env ampenv) (tablelookup s))))))))In Partial Synthesis the overtones are not integer multiples of a fundamental frequency. Thus we cannot resort to the shortcut of a table and have to really implement all oscillators (and thus use a lot of resources).
Here's a very simple instrument that implements additive synthesis with three partials.
And the text version:
(definstrument doadd (starttime duration frequency amplitude &key (partial1 1.0)(amp1 0.3) (partial2 2.0)(amp2 0.3) (partial3 3.0)(amp3 0.3) (env '(0 0 0.5 1 1 0))) (multiplevaluebind (beg end) (times>samples starttime duration) (let* ((sine1 (makeoscil :frequency (* partial1 frequency))) (sine2 (makeoscil :frequency (* partial2 frequency))) (sine3 (makeoscil :frequency (* partial3 frequency))) (ampenv (makeenv :envelope env :scaler amplitude :duration duration))) (run (loop for i from beg to end do (outa i (* (env ampenv) (+ (* amp1 (oscil sine1)) (* amp2 (oscil sine2)) (* amp3 (oscil sine3))))))))))In the most general case all parameters of each sine wave are also a function of time (that is, they are controlled by envelopes). This is the most interesting case but also the most expensive computationally and the most difficult to control.
The problem is: "how do we create ot generate the enormous amount of data that we need to accurately represent hundreds of points in the envelopes or all partials?"
Modulation Synthesis
Ring Modulation
Amplitude Modulation
Frequency Modulation

©2000/2001 Fernando LopezLezcano. All Rights Reserved. nando@ccrma.stanford.edu
