Generative music on the Arduino driven by optical sensors on a bicycle wheel.
Originally made at Dorkbot Bristol in 2009 for an event called Staging Sound in Bath. Runs on Arduino Duemilanove with ATmega328 microcontroller.
| Arduino Pin | Function | Notes |
|---|---|---|
| 2 | Trigger 0 | Pull HIGH. Bring LOW to trigger note on Generator 0 |
| 3 | PWM Out | Audio output. Connect to low-pass filter |
| 4 | Trigger 1 | Pull HIGH. Bring LOW to trigger note on Generator 1 |
| 5 | Envelope 0 | PWM representing amplitude of voice 0 |
| 6 | Envelope 1 | PWM representing amplitude of voice 1 |
| 7 | Trigger 2 | Pull HIGH. Bring LOW to trigger note on Generator 2 |
| 8 | Debug 1 | HIGH when inside PWM ISR |
| 9 | Envelope 2 | PWM representing amplitude of voice 2 |
| 12 | Debug 2 | HIGH during envelope generation |
PWM amplitude signals may have been added to drive LEDs.
| Generator | Voice | Envelope |
|---|---|---|
| 0 | Hammond Organ | Sustain |
| 1 | Sinewave | ADSR |
| 2 | Brass | Tremolo |
Other voices and envelopes are available, but at present can only be selected by modifying the code and recompiling.
With NOTES set to 3, as we usually have it, the timer ISR that fires every 32us runs for 16.8us. This means that we're using just over 50% of the CPU time for note generation.
Adding the #define DO_VIBRATO makes the note generation ISR take 28.8us. It uses a square-wve modulation, which does not sound very good. Maybe we could add a proper synthesiser-style LFO?