Another Pseudo Theremin

So I really liked @chame 's psuedo-theremin, it was one of the first sketches I checked out when I first got my arduboy a year or two ago. But I tried to find it recently to no avail, the links on the old post are broken. With that in mind and a desire to make some wonky chiptunes in my heart, I set out to recreate the program, or at least something passably similar. My version of the theremin is based on @BBCAC4 's Electrical Noise Input functions and this post describing how to display a waveform based on a provided analog value. I just made the code work with arduboy and for this specific situation, instead of a potentiometer. The code is pretty simple, though I’m not entirely satisfied with it. Right now, when the waveform reaches the width of the screen, it resets to zero, which is fine, but a more polished version would just stay updating at screen width and moving previous values back so that it just trails. But I’m admittedly having a bit of trouble figuring out how. At any rate, enjoy!

Hex.

Source.

I’ve thought about using my light meter sketch as the basis for a theremin. It wouldn’t take much work. Just convert the numeric output to a proportional audio frequency. You could use your hand to block a bright light source to provide frequency modulation.

I thought maybe I’d use one button to turn on the sound and the frequency would follow the light input while pressed. Another button would lock the current frequency when pressed and play that “note” until released, regardless of whether the light input changed while held.

If you wanted to get a bit more fancy, you could have another button to switch to high volume while pressed. ArduboyTones can play tones at normal and high volume but I don’t know if it can play smooth glissandos, needed for a theremin, without inter-tone noise. You would have to try it and see.

Anyway, I don’t think I’ll ever find the time to do this but you might want to consider experimenting with it yourself.

Implement a sliding window, basically an array that holds the frame data and when you update the array you shift everything left, dropping the first column and adding the newest measurement to the last column. It’s more computationally efficient though to use pointers and keep the array fixed, but overwrite the old data like a fifo circular buffer.

It would have to be modified to make it work in an Arduino environment, but I happen to have a C++ container-compatible circular buffer implementation just lying around…