# The Scholar

## Work in Progress

### Digital Sound Modeling

#### Outline

I am working on a text for a course in low-level digital sound modeling.

#### Latest Draft

In order to reformat from the LaTeX source, or to view the DVI output, you need to download the Encapsulated PostScript figures: I suggest that you take the Gzipped tarball.

I used these notes to teach Com Sci 295.

#### Extra Figures

• A chart of rational pitches.
• Each dot in the display shows a pitch with frequency given as a rational multiple above the lowest pitch. But for most purposes it's better to think of each pitch as representing an interval with the lowest pitch, from unison up to one octave.

• The horizontal scale is log frequency, spanning one octave. Vertical lines show the tempered half steps, at intervals of the 12th root of 2. An octave of a piano keyboard from C to C is superimposed at the bottom. But keep in mind that the spacing of half steps on the keyboard is not quite even because of the nonuniform placement of black keys.

• The vertical scale indicates consonance vs. dissonance of the intervals. More consonant intervals are at the bottom, more dissonant intervals at the top. Numerically, I measure dissonance as the logarithm of the product of the numerator and denominator of the rational frequency. The general trend from consonance to dissonance is perceptually meaningful, but the particular values are probably not.

• Gold dots are the most popular choices for the 12 chromatic pitches in just intonation. The tritone pitch in the middle of the octave (augmented 4th at F sharp or diminished 5th at G flat) is usually omitted in just scales, but I show two reasonable choices for it. I found a poor consensus on the minor 7th at B flat, so I showed three popular choices and joined them in a triangle. Ignoring the tritones, and choosing the 9/5 ratio for the minor 7th gives the "5-limit" just scale.

• Blue dots are the Pythagorean ratios generated by following the circle of 5ths in the order D flat, A flat, E flat, B flat, F, C, G, D, A, E, B. (Strictly speaking, Pythagorean is one sort of just tuning, but it is not the most popular one for music involving conventional major and minor chords.) Pushing one more step before D flat generates G flat, and one more step after B generates F sharp. They correspond to the same piano key, but they are different ratios, and provide two versions of Pythagorean tritone. You can extend the circle of fifths indefinitely at both ends, and generate infinitely many different pitch values for each key. The ratio between the two tritones, 3^12/2^19=531441/524288, is called the "Pythagorean comma." It would be to the far left of the picture and up at level 26.35. Almost all just tunings agree with the Pythagorean on the perfect 4th and 5th, so they are shown with blue surrounding gold. The 5-limit major 2d, and one of the minor 7ths, also agree between popular just and Pythagorean.

• Red dots are ratios of intervals between popular just pitches (not including the tritones) that don't fit the most popular 12-tone just scale. When they coincide with Pythagorean pitches, they are shown as red surrounding blue. The comma between the two just tritones is 2^11/(3^4*5^2)=2048/2025. It would be to the far left of the picture and up at level 15.24.

• The gold and blue dots at the lower left ends of the piano keys show which keys have precise minor or major thirds above them in the just and Pythagorean C major scales, respectively (the definitions of the thirds are different for the two scales). In all cases except B, there is also a perfect 5th, yielding a precise minor or major triad.

• The picture is misleading in the way that it uses pitch points to represent intervals from a single point. Using a continuously tunable instrument, or the human voice, pitches of individual notes are often adjusted differently according to context, to provide just intervals with other notes played simultaneously or nearby in time. I haven't figured out how to draw a picture of the interval relationships in triads, much less 4- and 5-note chords.

• Postscript figure (`pitches.ps`)
• PDF figure (`pitches.pdf`)
• Fig source for the figure (`pitches.fig`)

#### Supporting Demonstrations

• Supporting demonstrations in Scilab source form. To run the demos:
1. If you are in the CS 295 class at U. Chicago, go to the `<scilab_demo>` directory that I have already created as `~odonnell/html/CS295_files/Scilab_demos`, and skip to step 4. If you are not in the class, continue with step 2.
2. Install Scilab (it's free GPL software).
3. Download all of the following files into a `<scilab_demo>` directory. Make sure to give each file precisely the name specified below. Alternative: Download the tarball `scilab_demos.tgz` (12,538 bytes), and unpack it with the command ```tar -xzf scilab_demos.tgz```.
4. Execute the command `scilab` in the `<scilab_demo>` directory.
5. Give the command `exec('lecture_demos.dem')` in the Scilab window.
6. Follow the instructions in the popup windows to navigate and execute the demos.
• Supporting demonstrations in Matlab source form. To run the demos:
1. If you are in the CS 295 class at U. Chicago, go to the `<matlab_demo>` directory that I have already created as `~odonnell/html/CS295_files/Matlab_demos`, and skip to step 4. If you are not in the class, continue with step 2.
2. Install Matlab. Matlab is expensive proprietary stuff, so you probably don't want to do this unless your employer already has a license. You can get most of the benefit of the demos by the alternative method below, or you can convert the scripts to work with Octave. Octave is a free alternative to Matlab. It works just as well, but some commands have different names, particularly I/O commands.
3. Download the tarball `matlab_demos.tgz` (21,859,946 bytes), and unpack it with the command ```tar -xzf matlab_demos.tgz```.
4. Execute the command `matlab` in the `<matlab_demo>` directory.
5. Give the command `filterdemo` in the Matlab command window to produce interesting sounds by filtering.
6. Watch the demo go by. When a `pause` command appears, hit any key to continue.
7. Give the command `filtergraph` to see some graphs of transfer functions.
• If you can't afford Matlab, or object to proprietary software, or find that the Matlab function to play sound isn't configured correctly (a common problem), you can run the graphing demo (`filtergraph.m`) under Octave. You can also get most of the benefit of the sound demo by playing the precompiled sound files.
1. Download the tarball `soundfiles.tgz` (22,520,100 bytes), and unpack it with the command ```tar -xzf soundfiles.tgz```.
2. Download the script file `filterdemo.m`
3. Read through the script file with your favorite text viewer. When you come to a command `splay<name>`, view and play the corresponding sound file `<name>.aiff` with your favorite soundfile editor. I seem to have lost the last sound file, but you can hear all the others.
• Supporting demonstrations programmed with Fltk and C++ (very flakey, probably won't work for you).