πŸ“– What Pearson does

Chapter 12 builds a drum machine out of analog oscillators. Sub-sections:

  • A brief history of drum machines. From the Rhythmicon (1930s) to the Roland TR-808 (1980) to the SP-12, MPC, etc.
  • Making inharmonic sounds. Sounds whose frequencies are not integer multiples of a fundamental. (Most acoustic instruments are inharmonic to some degree.) Pearson builds:
    • Tambourines β€” short bursts of inharmonic noise.
    • Crash cymbals β€” long inharmonic noise with a sharp attack.
  • Making harmonic sounds. Sounds whose frequencies are integer multiples of a fundamental. Pearson builds:
    • Kick drums β€” a low sine wave with a quick pitch envelope.
    • Tom-toms β€” a mid sine wave with a slower envelope.
  • Making noise. Pure noise. Pearson builds:
    • Snare drums β€” bandpass-filtered noise.
  • Percussion sequencing. A drum machine with multiple voices driven by a sequencer. Examples:
    • Bomba β€” a simple 3-voice pattern.
    • Bossa Nova β€” a complex 4-voice pattern.

The chapter leans on the 40106 hex inverter chip, which is both an oscillator (when used with RC timing) and a logic inverter.

πŸŽ“ Background: drum slots vs melodic slots

Our firmware has a hard split:

  • Slots 1–8 are drum slots. Monophonic (one voice each). When triggered, they play a recorded sample at fixed pitch.
  • Slots 9–16 are melodic slots. 4-voice polyphonic each. When triggered, they play at the requested pitch.

Drum slots are perfect for the kinds of sounds Pearson builds β€” kick, snare, hat, tom, cymbal. They are recorded from a microphone (or synthesised offline). They play at one pitch. They are triggered in patterns.

Our firmware does not synthesise drum sounds from scratch. You record or upload a sample, then trigger it. That is a different design choice than Pearson’s. It is closer to the original PO-33’s design β€” sample-based drums, oscillator-based melody β€” than to Pearson’s drum-machine chapters.

πŸ”§ Try it on the device

Exercise 1: record a kick drum.

If you have a real kick-drum sample (or a YouTube video of one), play it near the device’s microphone and record:

> record_mic 1 1   ; record 1 second into slot 1
> slot_play 1

You’ll hear the recorded kick.

Exercise 2: record a snare, kick, hat.

> record_mic 2 1   ; snare to slot 2
> record_mic 3 1   ; hat to slot 3

Exercise 3: build a 4-on-the-floor pattern.

> pattern_clear 1
> step_set 1 1 1 1   ; step 1: slot 1 (kick) at velocity 1
> step_set 1 5 2 1   ; step 5: slot 2 (snare) at velocity 1
> step_set 1 9 1 1   ; step 9: slot 1 (kick)
> step_set 1 13 2 1  ; step 13: slot 2 (snare)
> bpm 120
> play

A basic kick-snare pattern. (See the note below about the step_set syntax β€” depending on your firmware version it might be step_set <pattern> <step> <slot> <note> or step_set <pattern> <step> <slot> <velocity>.)

Exercise 4: add a hi-hat on every off-beat.

> step_set 1 3 3 1
> step_set 1 7 3 1
> step_set 1 11 3 1
> step_set 1 15 3 1

Now you have kick on 1, hat on 3, snare on 5, hat on 7, kick on 9, hat on 11, snare on 13, hat on 15 β€” the classic β€œfour-on-the-floor” with snare on 2 and 4.

Exercise 5: layer two slots on one step.

You can’t currently play two slots on one step through the standard sequencer, but you can fake it by recording slot 1 and slot 2 into the same buffer (via a separate command, if your firmware supports it). v2 will have explicit layering.

πŸ›  Code reference

  • Slot types β€” main/audio/amy_bridge.h. SLOT_COUNT is 16; SLOT_DRUM_COUNT is 8. The split is at index 8.
  • Recording to a slot β€” main/audio/amy_bridge.c, amy_bridge_record_mic(). The function allocates PSRAM, streams from IΒ²S RX into the buffer, registers with AMY.
  • Pattern step data β€” main/sequencer/pattern.h, pattern_step_t. The slot field is 0…15; 0 means the step is empty.

🚫 What we can’t simulate

  • Synthesis of drum sounds. We don’t have a kick_drum() function that makes a kick from a sine wave with a pitch envelope. You have to record or upload a sample.
  • The 40106 oscillator-based drum sounds. Pearson’s drum circuits are hardware oscillators with envelope generators. Our firmware has nothing of the kind β€” drum slots are sample players, full stop.