Posted: 9/4/2009 2:24:38 PM

Hi there... I am new here and this quite a cool site!

I am developing a software emulation of the theremin in Java and am trying to derive as authentic a sound as possible.

After reading up on this, I sort of understand the heterodyning concept that it appears the theremin sound is driven by.

My question is this: What frequencies of sine waves do I use to achieve this heterodyne effect?

It seems as if one sinewave needs to remain at one frequency and the other sinewave operates at variable frequencies.

Can anyone suggest what the static frequency should be and what range the variable frequencies of the other sinewave should be? Or... am I totally off base here?

Thanks in advance for any guidance you can provide.

~Mojo

I am developing a software emulation of the theremin in Java and am trying to derive as authentic a sound as possible.

After reading up on this, I sort of understand the heterodyning concept that it appears the theremin sound is driven by.

My question is this: What frequencies of sine waves do I use to achieve this heterodyne effect?

It seems as if one sinewave needs to remain at one frequency and the other sinewave operates at variable frequencies.

Can anyone suggest what the static frequency should be and what range the variable frequencies of the other sinewave should be? Or... am I totally off base here?

Thanks in advance for any guidance you can provide.

~Mojo

Posted: 9/4/2009 6:17:13 PM

Posted: 9/4/2009 6:41:32 PM

Hi Gordon,

Thanks for the welcome and for the link.

The Java API I am using allows the developer to define "Unit Generators" which can be oscillators, for example, that define a wave form type as well as associated parameters such as frequency, amplitude, etc.

In this case I can define 2 Sinewave oscillators and then feed them the frequency I want... add them together, subtract them or perform other operations. I am still getting my head around this stuff... I have dabbled with Audio synthesis and DSP for years but never at this level, so it's a bit of a challenge. But it's all very enjoyable.

As soon as I have a more concrete example of my work, I will post a link here.

Thanks again!

Thanks for the welcome and for the link.

The Java API I am using allows the developer to define "Unit Generators" which can be oscillators, for example, that define a wave form type as well as associated parameters such as frequency, amplitude, etc.

In this case I can define 2 Sinewave oscillators and then feed them the frequency I want... add them together, subtract them or perform other operations. I am still getting my head around this stuff... I have dabbled with Audio synthesis and DSP for years but never at this level, so it's a bit of a challenge. But it's all very enjoyable.

As soon as I have a more concrete example of my work, I will post a link here.

Thanks again!

Posted: 9/5/2009 4:09:46 AM

I'm feeling that my touch with the world of computing must be rather out of date if Java can process radio frequency signals. Wow!

I'm also a little concerned that my grasp of heterodyning might be wrong, as I had the impression that the result of heterodyning two sine waves and filtering off the high-frequency component is just another sine wave. That would be a lot of processing for no apparent purpose.

I also note that the Hartley oscillator (as used in the RCA Victor) does not necessarily produce a pure sine wave. (http://en.wikipedia.org/wiki/Hartley_oscillator, but see the discussion page, and also see here (http://www.thereminvox.com/article/articleview/68/1/2)) (Same consideration re: heterodyning applies though - two similar waveforms in = similar waveform out on the lower sideband.) And then there is amp and speaker distortion to take into account, and that's only half the story.

The other half is emulating the player's hand movements - most theremin emulators are easy to identify as such because the pitch is too accurate, the vibrato is too even and the volume is too constant.

Please don't think I am trying to discourage you, just trying to point you in the right direction. :-)

I'm also a little concerned that my grasp of heterodyning might be wrong, as I had the impression that the result of heterodyning two sine waves and filtering off the high-frequency component is just another sine wave. That would be a lot of processing for no apparent purpose.

I also note that the Hartley oscillator (as used in the RCA Victor) does not necessarily produce a pure sine wave. (http://en.wikipedia.org/wiki/Hartley_oscillator, but see the discussion page, and also see here (http://www.thereminvox.com/article/articleview/68/1/2)) (Same consideration re: heterodyning applies though - two similar waveforms in = similar waveform out on the lower sideband.) And then there is amp and speaker distortion to take into account, and that's only half the story.

The other half is emulating the player's hand movements - most theremin emulators are easy to identify as such because the pitch is too accurate, the vibrato is too even and the volume is too constant.

Please don't think I am trying to discourage you, just trying to point you in the right direction. :-)

Posted: 9/5/2009 11:03:10 AM

It's not radio frequency processing per se...

This is Digital Signal Processing using the computer's sound card to generate waveforms. I chose sines because everything I've read so far about the theremin sound points to sine waves, although clearly you can hear something else going on... it's not just a pure sine... and I suspect that is the heterodyning.

So I realize I won't be able to completely replicate the sound, but if I can get something close I would be happy. And by all means, you are not discouraging at all. Your feedback is very helpful!

This is Digital Signal Processing using the computer's sound card to generate waveforms. I chose sines because everything I've read so far about the theremin sound points to sine waves, although clearly you can hear something else going on... it's not just a pure sine... and I suspect that is the heterodyning.

So I realize I won't be able to completely replicate the sound, but if I can get something close I would be happy. And by all means, you are not discouraging at all. Your feedback is very helpful!

Posted: 9/5/2009 4:20:34 PM

Uh, it is. 175 kHz is right in the middle of the low frequency band of radio frequencies.

http://en.wikipedia.org/wiki/Low_frequency

The difference in frequencies between the 175 kHz reference oscillator and the variable oscillator is, as noted in the first article I referenced, at most 1400Hz - that's the highest audible frequency you'd be synthesising - between F6 and F#6 - but you'd be using RF oscillators to make it.

http://en.wikipedia.org/wiki/Low_frequency

The difference in frequencies between the 175 kHz reference oscillator and the variable oscillator is, as noted in the first article I referenced, at most 1400Hz - that's the highest audible frequency you'd be synthesising - between F6 and F#6 - but you'd be using RF oscillators to make it.

Posted: 9/5/2009 7:11:25 PM

Sorry Gordon, I was describing the programming side... not the real world theremin side.

I think I am misunderstanding things a bit. When I say SineWave I am referring to a Digital Signal I am triggering in my program. If I pass it a value such as 440 Hz for its frequency it plays an A note.

As you noted, you are referring to radio frequencies.

I thought I could achieve heterodyning by having the Digital audio sinewaves of my application oscillate at certain frequencies like the RF oscillations of a real theremin, but I guess I am mistaken...

I think I am misunderstanding things a bit. When I say SineWave I am referring to a Digital Signal I am triggering in my program. If I pass it a value such as 440 Hz for its frequency it plays an A note.

As you noted, you are referring to radio frequencies.

I thought I could achieve heterodyning by having the Digital audio sinewaves of my application oscillate at certain frequencies like the RF oscillations of a real theremin, but I guess I am mistaken...

Posted: 9/5/2009 8:53:34 PM

Emulating true heterodyning in JAVA may most probably not work. At first it will be rather difficult to simulate 2 RF sine oscillators at the same time and then multiply their output values, most standard PCs will not be able to achieve this with an acceptable sample rate and precision. After that you will see the next difficulties: Using a recursive algorithm as low-pass filter and scaling results down to a fixed sample rate which may be delivered to a SourceDataLine object for output.

Even if this would work, your output signal will be still a sine wave which you may get in an easier way...

The "special" and "typical" theremin sound (which doesn't really exist since each theremin design has its individual sound(s)) comes from the fact that either the oscillators don't give perfect sine waves, the heterodyning mixer is not perfectly linear and balanced, or from post mixer wave shaping by adding controlled distortion.

Simulating all this in good quality exceeds the computing power of normal PCs or Macs and may surely not be realizable with a standard JAVA framework and runtime but would need specialized code.

Even if this would work, your output signal will be still a sine wave which you may get in an easier way...

The "special" and "typical" theremin sound (which doesn't really exist since each theremin design has its individual sound(s)) comes from the fact that either the oscillators don't give perfect sine waves, the heterodyning mixer is not perfectly linear and balanced, or from post mixer wave shaping by adding controlled distortion.

Simulating all this in good quality exceeds the computing power of normal PCs or Macs and may surely not be realizable with a standard JAVA framework and runtime but would need specialized code.

Posted: 9/5/2009 9:01:13 PM

That's what I thought you meant - emulating the heterodyning process in software.

Anyways - I don't think the heterodyning process is the key to the sound.

This was discussed a few months ago on TW, and apparently what you get by heterodyning is the same waveform as the fixed and variable RF oscillators are producing (assuming they produce the same waveform as each other) but slowed down into the audible range. It also produces a lot stuff in the RF range, but that is all filtered off.

It's the sum and difference of the input frequencies. With pure sine waves it's simple - if the input frequencies are 175kHz and 176kHz then the difference is 1kHz (audible) and the sum is 351kHz - well above the audible range and in the RF range.

With other waveforms you have to consider the harmonics as well as the fundamental frequencies. Say your oscillators are making a waveform with one harmonic, so you have a fundamental of 175kHz and a first harmonic of 350kHz from the fixed oscillator, and correspondingly from the variable a fundamental of 176kHz, with a first harmonic of 352kHz.

We need to consider the differences between the two fundamentals - 1kHz - between the two first harmonics - 2kHz - and between the fundamental of one and the first harmonic of the other - either 176 or 174kHz - well above the audible range, so can be disregarded.

So in the audible range we get a fundamental and a first harmonic, nothing more or less than the same as the waveform generated by the two RF oscillators.

You can see. no doubt, how this can be extended to higher harmonics.

[edit] Hi Thierry. I hope I got that right. :-) [/edit]

Anyways - I don't think the heterodyning process is the key to the sound.

This was discussed a few months ago on TW, and apparently what you get by heterodyning is the same waveform as the fixed and variable RF oscillators are producing (assuming they produce the same waveform as each other) but slowed down into the audible range. It also produces a lot stuff in the RF range, but that is all filtered off.

It's the sum and difference of the input frequencies. With pure sine waves it's simple - if the input frequencies are 175kHz and 176kHz then the difference is 1kHz (audible) and the sum is 351kHz - well above the audible range and in the RF range.

With other waveforms you have to consider the harmonics as well as the fundamental frequencies. Say your oscillators are making a waveform with one harmonic, so you have a fundamental of 175kHz and a first harmonic of 350kHz from the fixed oscillator, and correspondingly from the variable a fundamental of 176kHz, with a first harmonic of 352kHz.

We need to consider the differences between the two fundamentals - 1kHz - between the two first harmonics - 2kHz - and between the fundamental of one and the first harmonic of the other - either 176 or 174kHz - well above the audible range, so can be disregarded.

So in the audible range we get a fundamental and a first harmonic, nothing more or less than the same as the waveform generated by the two RF oscillators.

You can see. no doubt, how this can be extended to higher harmonics.

[edit] Hi Thierry. I hope I got that right. :-) [/edit]

Posted: 9/5/2009 9:28:03 PM

It's a little more complicated than that:

If one oscillator has 176 kHz and a first Harmonic of 352 kHz and the second one has 175kHz and a first harmonic of 350 kHz, I get at the output of the mixer:

176-175=1kHz (AF fundamental)

175+176=351kHz (inaudible)

352-175=177kHz (inaudible)

352+175=527kHz (inaudible)

350-177=173kHz (inaudible)

350+177=527kHz (inaudible)

352-350=2kHz (AF first harmonic)

352+350=702kHz (inaudible)

In a non-ideal, rather real mixer there are still intermodulation and feedback effects which may give you still some sum and difference signals of the outputs, so that you may find (among others)

177-173=4kHz (AF third harmonic), the latter having been non-existent in the oscillators signals. There is still the problem that semiconductors behave like voltage depending capacitors (varicap effect) which may lead to phase distortion, less audible in the AF fundamental but strongly influencing the harmonics (as found on the Etherwave Standard thanks to Fred M.).

If one oscillator has 176 kHz and a first Harmonic of 352 kHz and the second one has 175kHz and a first harmonic of 350 kHz, I get at the output of the mixer:

176-175=1kHz (AF fundamental)

175+176=351kHz (inaudible)

352-175=177kHz (inaudible)

352+175=527kHz (inaudible)

350-177=173kHz (inaudible)

350+177=527kHz (inaudible)

352-350=2kHz (AF first harmonic)

352+350=702kHz (inaudible)

In a non-ideal, rather real mixer there are still intermodulation and feedback effects which may give you still some sum and difference signals of the outputs, so that you may find (among others)

177-173=4kHz (AF third harmonic), the latter having been non-existent in the oscillators signals. There is still the problem that semiconductors behave like voltage depending capacitors (varicap effect) which may lead to phase distortion, less audible in the AF fundamental but strongly influencing the harmonics (as found on the Etherwave Standard thanks to Fred M.).

You must be logged in to post a reply. Please log in or register for a new account.