Saturday, March 7, 2009

A More Accurate Theremin (possibly)

One of the weird things about the Theremin is the way it creates sound. Rather than generating sound directly from a voltage controlled oscillator like later analogue synths, it creates sound via the heterodyne principle. Why I have no idea, but it does.  Before I go any further I sould point out that  I learned everything I know about signal processing from Wikipedia, so my explanations here might be a bit garbled. 

In a Theremin there are two high frequency oscilators, one at a fixed frequency and one at a frequency controlled by the movement of the players hand.  These two signals are multiplied by each other, which gives two new frequecies, one at the sum of the original two and one at the diffrence between them.  The difference of these two is the audio signal that is output, so 

120000hz * 115000 = 235000hz and 5000hz. 

I think. 

So just for the hell of it I decided to try doing this in SuperCollider and surprise, it works!

(
{
var mouse = MouseX.kr(100000,110000,1);

BPF.ar((SinOsc.ar(100000) * SinOsc.ar(mouse)), mouse - 100000, 0.2);


}.scope

)

I've put it through a band pass filter that follows the audio frequency in an attempt to filter out what I can only assume are sidebands or aliasing or something. It doesn't quite work completely, but it's better than nothing.

The Ondes Martenot used heterodyning too so I did the same thing with my simple version of it. 

(
{



var mouse = MouseX.kr(100000,110000,1);

w = SCWindow.new("I catch keystrokes");
w.front; 



FreeVerb.ar(BPF.ar((SinOsc.ar(100000, 0, KeyState.kr(36, 0, MouseY.kr(1,0)) ) * SinOsc.ar(mouse)), mouse - 100000, 0.2), 0.5, 0.3);


}.freqscope

)

And that's Jazz. 

No comments:

Post a Comment