I made a theremin. Kinda.


I used an Ultrasonic Ping))) Sensor coupled with a speaker and some Arduino magic to make what I think might be referred to as a sonically digital theremin. Here's a video of it in action (- YouTube) and the code is in the description of that video. I'm not entirely happy, however, with the sound quality coming from it. I think some of it is coming from the fluctuations in the reported distance from the sensor, do to a poor accuracy, and some of it from the fact that I'm using the speaker from an old rotary telephone handset with no amplifier. You'll notice in the code that the length of each tone is 10ms, which I take it is rather large. The problem is, as it gets smaller, the audio gets even worse, such that I've found 10ms to be the best for now.

I guess what I'm trying to ask, is what can I do to get this closer to sounding like a true theremin? Would replacing the ping))) sensor with a 10cm-80cm IR sensor improve it? The range seems to fit the job better than the ~43cm ping sensor.

Thanks a bunch.

I would think about your algorithm for making the output sound before you change the sensor. I watched your nice video and it doesn't seem like the sensor is the real problem.

Cool, thanks! Have you looked over the code? What exactly should I do to the algorithm to improve it? Where is it failing?

Ultrasonic Ping))) Sensor length distance fluctuations and pitch reports no problem, you may need to adjust the scope of IR sensor under. . . Non-professionals

Well, you are generating your tone for 1 millisecond, and then stopping it.

And the going and reading the sensor again. How long does that take ?

Your could try leaving the tone running ( instead of stopping it ), and go and get the next ultrasound reading, and then stop the tone immediately before you start the new tone.

That might reduce that slightly annoying vibrato effect that you have there.

If you are getting "noise" in your ultrasound measurment, you could try smoothing out the frequency you are asking for by averaging successive measurement samples.

You are generating square wave sound. You could try generating sine wave sound, or using a filter to reduce the harmonics.

Thats some suggestions of things you can try in a few minutes with software changes without going and changing the hardware ( possibly unnecessarily ).

I'd be worried that it would take longer to average the signals, which would make the tone even quieter. Also, how do I generate a sin wave instead of square?