Close

Implemented correct algorithm

A project log for The Stereo Theremin

With my version each hand controls both pitch and volume. The up/down motion controls volume, and the right/left motion controls pitch.

mike-christleMike Christle • 08/03/2026 at 15:05•0 Comments

My new PCB's have been delayed for some reason. So while I am waiting I have been working on the software. In particular, the algorithm to convert two time of flight number into frequency and volume. My first cut used the sum to get the volume, and the difference to get the frequency. This works OK to check out the hardware, but it's not good enough to make music. I want horizontal motion to change frequency with constant volume. Vertical motion change volume with constant frequency. 

After staring at the diagrams for a while I realized that, all the points for a given time of flight trace out an ellipse. I have two time of flight numbers, so two ellipses. The point that I want to find is the intersection of these two ellipses. This leaves me with a problem of solving two second order equations in two variables.

Since I am working with Micro-Python, I am a little worried about the time to perform these calculations. I don't want there to be a noticeable delay between hand movement and change in audio output. My next step is to do some profiling. If there is a problem, I will have to write the calculations in a C module that I can call from Micro-Python.

Discussions