# teaching machines

## Oscillating

This post is part of a series of notes and exercises for a summer camp on making musical instruments with Arduino and Pure Data.

The very first thing we must do this week is make noise. We’ll create this patch in Pure Data to generate a single frequency:

• Open Pure Data. To find it, hit Command-Space to open Spotlight and type Pd.
• Click File / New to create a new Pd patch.
• Click Put / Number to place a number widget in the patch.
• Click Put / Object to place an object widget in the patch. In the object’s box, type osc~. This osc~ widget generates a cosine wave at a given frequency. You won’t hear anything, as osc~ by itself doesn’t generate any sound.
• Drag from the outlet on the bottom of the number box to the inlet of osc~. With this connection in place, the number shown in the box is the frequency of the generated cosine wave.
• Create a second object and enter dac~—which stands for digital-to-analog converter. The job of a DAC is to turn the cosine wave into a signal that pushes the computer’s speaker in and out.
• Connect the outlet of osc~ to the left inlet of dac~. You still won’t hear any sound.
• In the console window, check the DSP checkbox. Sound is now being generated, but it has frequency 0, which is arguably not sound.
• Change the frequency by dragging on the number box to change the number. However, this doesn’t work in Edit Mode. Click Edit / Edit Mode and then drag. As the frequency increases, do you hear sound?

### Challenges

After you get your patch working, answer the following questions on a piece of scratch paper.

1. What’s the lowest frequency you can hear? The highest?
2. In Edit Mode, figure out how to delete edges. Delete the edge from osc~ and dac~. Add a new edge from osc~ to the right inlet of dac~. What effect does this have?
3. In Edit Mode, box-select the three nodes by dragging from one corner of the patch to the diagonally opposite corner. Copy and paste (either via the Edit menu or the standard keyboard shortcuts) to produce an identical set of nodes. Leave edit mode and set one of the frequences to 440. Set the frequency of the other to produce some unpleasant combination. What is the frequency you picked?