The Tooba
|
The Tooba is an electronic musical instrument built into a piece of PVC tubing (hence the name). It borrows principles from the Moog-style analog music synthesizers of past decades.

Way back when, one of my friends in high school was a guy named Dave Wilson whose father got him into 1970s-era Moog-style analog electronic music synthesizers. Dave created a museum of historical synthesizers in his home in Nashua, New Hampshire. Throughout our high school and college years, we exchanged ideas and circuits and bits of lore for various synthesizer hacks.
Music synthesizers of that era were actually special-purpose analog computers, performing arithmetic operations with integrators, summers, and other such circuits. These computations can be performed digitally by a microprocessor or special-purpose digital circuit (e.g. FPGA). So Dave and I both at various points and in various contexts wrote code to do that.
Sound generation in the Tooba (and keyboard scanning and voice assignment) is done in C++ running on a 32-bit ARM microcontroller.
The first PVC prototype, the one shown at Providence on Aug 8th 2015, did all sound generation in the interrupt handler. More recently, the interrupt handler only transfers audio samples from a queue to the microcontroller's on-chip 12-bit DAC, and sound generation occurs in the loop() function.
I want to read the GPIO in assembly to accurately measure the period of the oscillator. This code ran on the June prototype and measured the capacitance of the touch sensitive keyboard. The capacitance was used in the RC time constant of a free-running oscillator and the idea here is to get a measurement roughly proportional to the period.
So that piece is assembly, and then in C you choose a touch contact and call that function. That should ensure that you read the keyboard about as fast as it can be read. The code for this is buried in the sandbox directory.
This works well in both the Arduino/Teensy IDE and in the online ARM C++ compiler.