If you've not read through the Simp Dissection Tutorial, I highly recommend doing so before trying to construct the more complex instrument you will be building this week.

In this discussion, I will be referring to a simple three-partial additive synthesis instrument and using it to create a template for an instrument that will be able to synthesize the instrument tones based on their spectral data.   We have not yet covered many of the functions that we'll need to construct such an instrument, but I will include a description of those functions as we need them.

I will be using Lisp examples throughout these pages, so you will want to start xemacs and run Lisp, because  I will ask a number of questions without giving their answer.   All of these questions will be easy to answer using CLM.   You can save time by just copying and pasting the Lisp statements I write from Netscape into the Lisp interpreter.    Once you have opened xemacs and started Lisp, cut and paste  the following command into the interpreter to load all of the spectral data as variables.
T

The   T   here means that the file successfully loaded.  If you look at that web page containing the spectral data, you will see that the file consists of one setf statement for each chromatic pitch of each instrument, assigning each one a list of spectral data.   You can verify that the data loaded, by typing one of the instrument names, for example, the first one:
>  bc-c2
(1.0  0.037  1.98  0.0037  2.99  0.0862  3.98  0.0011  4.97  0.027  ...)

Just so I'm sure you understand what this data represents, the data consists of pairs of numbers, the first of which is the ratio of the partial frequency to the fundamental and the second is the amplitude of that partial.   So for bc-c2, the first pair  1.0  0.37    means that the frequency of that partial is the fundamental frequency and that its amplitude is 0.037.   The next pair of numbers,  1.98  0.0037, means that there is a partial at 1.98 times the fundamental frequency with an amplitude of 0.0037.    The three dots at the end of the printed list just mean that the list is longer than the interpreter is set up to print, so that if the list is longer than that, it only prints the first part of it.

Each of the following pages will contain a table in the form below.    We begin with an empty template, and start building this instrument from scratch.    If your web browser is too narrow, the code on the left will be squished together and run over the end of the lines.  Pull the right side of the screen to widen the browser until you can read the whole instrument on the left.

 Three-partial additive synthesis instrument  (nando, Oct 8 '96) Template for Week 2 instrument (definstrument doadd (start-time 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)))       (multiple-value-bind (beg end) (get-beg-end start-time duration)           (let* ((sine1 (make-oscil :frequency (* partial1 frequency)))                       (sine2 (make-oscil :frequency (* partial2 frequency)))                       (sine3 (make-oscil :frequency (* partial3 frequency)))                       (amp-env (make-env :envelope env                                                :scaler amplitude                                               :start-time start-time                                                :duration duration)))               (Run                   (loop for i from beg to end do                       (outa i (* (env amp-env)                                       (+ (* amp1 (oscil sine1))                                            (* amp2 (oscil sine2))                                            (* amp3 (oscil sine3)))))))))) Discussion:       Click the "next" button to begin creating our new instrument.