The Open.Theremin UNO project consists of an Arduino UNO processor board with an additional theremin circuit board (« shield » in Arduino language) and corresponding software which takes the pulse widths coming from the heterodyne circuits on the shield, and processes them to obtain 2 integer values, one for pitch and one for volume. The pitch value is used to step through a wave form lookup table which is defined as an array of 1024 integers in a separate file. The resulting y(t) value is then multiplied by the volume variable.
The Arduino UNO has not the computing power to generate a complex waveform in real time, thus the external lookup table is the only way to obtain nice waveforms. But most people who build and play the Open.Theremin neither have the programming and mathematical skills nor the patience to calculate and to write new wavetable files for their instrument.
So, why not use the Arduino to calculate different wave tables offline in a different sketch and then use the result by recompiling and uploading the Open.Theremin software again?
How it works
Since the Arduino’s only way to communicate with the development environment (IDE) is the serial port, the only way is to make the Arduino calculate a wave table and to output it in the serial monitor window which can be opened from the IDE’s Tools menu. Once the Arduino will have finished writing the new wave table, the user will just have to select the whole content of the serial window with Ctrl-A, and copy it with Ctrl-C. Then he’ll have to open the Open.Theremin sketch, select the « theremin_sintable.c » file tab, delete everything which is in its code window, and paste the new wave table code here. Recompiling and uploading the Open.Theremin software will make the Open.Theremin play with the new sound.
Please download the full article with musical and mathematical details here: wavegen (pdf, 333kB)
You may also download the readily built Arduino sketch here:
wavegen.ino (zip, 1kB)