Monday, March 2, 2009

A Simple Ondes Martenot

The Ondes Martenot is a very early electronic synthesiser created in the late 1920's by Maurice Martenot. It's generates sound in a similar way to the Theremin, but is much more sophisticated, having several waveforms and filters.

The unique thing about the Ondes Martenot is it's control method. Like many later monophonic synths it's got a piano style keyboard,  but it also has a unique finger ring controller. This is a ring connected to a pice of wire worn on the players right index finger, as the ring moves back and forth it alters the pitch of the synth. 

Whether the player is using the keyboard or the ring controller, the sounds themselves are triggered by a an experession key, a small glass button to the left of the keyboard. This is an analogue control, the more the button is pressed down the greater the amplitude. 

Here's a YouTube Video of one being played, which should make things clearer. 


You've probably seen a simple Theremin implemented in SuperCollider several times, it's a classic bit of code, the audio equivalent of 'Hello World',  here it is again in all it's glory. 

{SinOsc.ar(MouseX.kr(20,20000))}.play

To extend this a little bit I decided to create a simple Ondes Martenot style synth, using a key on the keyboard as an expression key. Sadly this is only a binary control, it's either on or off, unlike the orginal, instead I've used the mouse y position to control the level, with the key just acting as a switch. 

Here's the code. 


( 
w = SCWindow.new("I catch keystrokes");w.front;
{ FreeVerb.ar(SinOsc.ar(MouseX.kr(20, 20000, 1), 0,
KeyState.kr(36, 0, MouseY.kr(1,0))),
0.5, 0.3, 0.1) }.play;
)

This firstly creates a standard window, as the title suggests, to catch keystrokes. I got this idea from the help file on keyboard input, it serves no purpose other than as a safe place to direct keyboard input to.

A keyState ugen provides the extra control input to the SinOsc. A KeyState takes 3 arguments, the key number it is to respond to, the output when the key is not pressed and the output when it is. As you can see Im using this to control the amplitude of a SinOsc, when key 36 (the enter key) is pressed it outputs the mouse y value as the multiplier for the osc. 

Using the a key to trigger the sound gives a bit more expressive power than the standard Theremin, plus it's great for doing impressions of the Clangers.

 



No comments:

Post a Comment