📖 What Pearson does

Chapter 3 is the centrepiece of the book. Pearson introduces the breadboard, the resistor, the LED, the potentiometer, the capacitor, and finally the integrated circuit — specifically the 555 timer chip in astable mode, which is the classical “first oscillator” circuit. With a 555, two resistors, and a capacitor, you can build a circuit that outputs a square wave (voltage jumping between +V and 0) at any frequency you want. The frequency is set by the resistor and capacitor values.

The chapter has these sub-sections, in order:

  • The breadboard. How the rows of holes are connected, how to use jumper wires.
  • How jumper wires work. (Basically, copper conducts.)
  • Resistors. Pushing back against current. Measured in ohms. 10 kΩ means 10 000 ohms.
  • LEDs and other diodes. One-way valves for current.
  • Potentiometers. Variable resistors. Twist the knob, change the resistance, change the circuit’s behaviour.
  • Capacitors. Tiny batteries that fill up and empty out. The combination of a resistor and a capacitor makes an RC time constant, which sets the timing of the 555 oscillator.
  • Integrated circuits. Tiny pre-built circuits in a plastic package. The 555 is one. The 40106 is another (a hex inverter).
  • My-First-Square-Wave-Oscillator™. The main project. A 555, two resistors, a capacitor, a 9 V battery, and a potentiometer. Output: a square wave you can hear as a pip pip pip.
  • Variations: The Pinch-O-Matic, Playing with Your Food, The Pencil-Pusher, A Photo Theremin.

This chapter is where the book transitions from “this is what a component is” to “this is what a component does when you put it in a circuit”. If you read one chapter of Pearson’s book, this is the one.

🎓 Background: what an oscillator is, in code

An oscillator is a thing that produces a repeating wave. In hardware, a 555 oscillator produces a square wave: the voltage is +5 V for some duration, then 0 V for some duration, then +5 V again, etc. The frequency is how many times per second this happens. A 440 Hz oscillator is the A above middle C — every musician’s tuning reference.

In our firmware, an oscillator is a struct in C called amy_event. The relevant fields are:

wave = SAW          /* SAW, SINE, SQUARE, PULSE, PCM, NOISE, ... */
frequency = 440.0   /* Hz */
amplitude = 1.0     /* 0..1 */

When you call amy_add_event() with this struct, AMY’s render task (notices the FPU, notices the second core) starts producing 16-bit samples 44 100 times per second that describe the chosen waveform at the chosen frequency. The DAC turns those samples into voltage. The speaker wiggles.

That is the entire translation. Pearson’s “555 timer outputting a square wave at 440 Hz” and our firmware’s “amy_event with wave=SQUARE and frequency=440” are doing the same thing. They differ only in the material — electrons vs. floating-point math.

🔧 Try it on the device

The PO-33 has 16 sample slots. 8 are drum slots (slots 1–8) and 8 are melodic slots (slots 9–16). Drum slots are monophonic — they play one note at a time. Melodic slots are 4-voice polyphonic and respond to pitch.

Exercise 1: play the firmware’s built-in oscillator.

A melodic slot with no recording falls through to AMY’s default synth. Pick slot 9 and play it:

> slot_play 9

You’ll hear a tone. Which tone depends on what AMY’s default patch is. By default it’s a saw-wave at some pitch; the firmware knows the slot is empty, so it doesn’t try to play a sample.

Exercise 2: trigger an oscillator at a specific pitch.

> note 9 69

This plays slot 9 at MIDI note 69, which is A4 = 440 Hz. If you have a music background, that note should sound familiar — it’s concert pitch. Hit it again:

> note 9 81

That’s MIDI note 81, which is A5 = 880 Hz. One octave up.

This is Pearson’s 555 oscillator, with the potentiometer controlling pitch. In our firmware the “potentiometer” is a MIDI note number.

Exercise 3: change the waveform.

The PO-33’s punch-in effects let you change the timbre. The equivalent of changing the 555’s capacitor (which would change the shape of the wave in a more involved analog sub-circuit) is to pick a different FX. Try:

> fx STUTTER_4
> note 9 69

That’s a stuttering repeat of the A note. Not exactly an oscillator modification, but it’s the closest punch-in we have to “modulate the carrier”.

Exercise 4: register a “Pin-O-Matic” (Pearson’s pinch-resistor variation).

The Pinch-O-Matic is a potentiometer replaced by a squishy conductive material. The harder you squeeze, the more current. In our firmware the analog is velocity — a per-note parameter between 0 and 127 that scales the amplitude:

> note 9 69     (firmware uses default velocity)

There is no UART verb to set velocity directly in v0.6 — the PO-33 itself derives velocity from the step-trigger button press. But the concept is there: every note event has a velocity field, and louder velocities make louder notes. Pearson’s “squeeze harder” is our “press the step button harder”.

Exercise 5: do the Photo Theremin (Pearson variation 4).

A photo theremin uses a light-dependent resistor instead of a potentiometer. Shine a torch on the LDR, the pitch goes up. Cover it, the pitch goes down.

Our firmware has no light sensor. But the idea — a continuous input parameter that drives pitch in real time — is exactly what Knob A does on our device. Knob A maps to the “tweak Tone” parameter, which adjusts the pitch of the next triggered note. With Knob A turned up, the firmware plays the slot one or two semitones sharp. With Knob A turned down, flat.

If you have a Ravine: Phoenix device in front of you, try:

  1. Hold FX and tap it (cycles tweak mode to TONE).
  2. Press SOUND + step 9 to pick slot 9 (this makes it the active slot). Note: a bare step 9 press plays the active slot at slice 9 — it does not pick slot 9. Selection is always SOUND + pad.
  3. Press PLAY.
  4. Twist Knob A while slot 9 plays. The pitch glides up and down.

That is Pearson’s photo theremin, with a knob instead of an LDR.

🛠 Code reference

  • The default synth patch — components/amy/src/amy.c, function amy_default_event(). Returns a fully-zeroed event struct; the caller fills in wave, frequency, amplitude, velocity, etc.
  • The note verb — main/main.c, cmd_note(). Calls amy_bridge_play_note(slot, midi_note, ...). Internally that function populates an amy_event and calls amy_add_event().
  • The 4-voice polyphony — main/audio/amy_bridge.c, amy_bridge_play_note(). Sets e.num_voices = (slot < SLOT_DRUM_COUNT) ? 1 : VOICE_COUNT, where VOICE_COUNT is 4. AMY handles the polyphony: it allocates up to 4 voices per melodic slot.
  • Tweak Tone (Knob A = pitch) — main/ui/knobs.c and main/audio/amy_bridge.c. When tweak mode is TWEAK_TONE, Knob A adjusts the next note’s midi_note by ±12 semitones.

🚫 What we can’t simulate

  • The actual 555 timer chip. Pearson spends a whole chapter teaching what a 555 does — discharge a capacitor through a resistor until a threshold, flip the output, charge it again, repeat forever. Our firmware skips this entirely; AMY’s oscillator is software, not silicon.
  • The breadboard experience. The tactile satisfaction of pushing components into a foam board is the most important pedagogical moment in Pearson’s book, and we have no analog. The closest we have is the 4×4 button matrix on the PO-33, which has the same “one input, one output, no menus” quality.
  • The Photo Theremin hardware. No light-dependent resistor on our board. (One could be added in v2 hardware. The firmware has a GPIO reserved for it.)