Just a thought:
If anyone is interested in what I term "Mode 0" Theremin oscillators (where the tank L & C are in series - most are what I term "Mode 1" where the tank L & C are in parallel) but wants to stay in the strictly analog domain, you could probably (I haven't tried this but I was thinking at one point of doing so) use my AFE & antenna and substitute an inexpensive CD4046B PLL (using the internal XOR phase detector) for the FPGA DPLL. Pick an OK looking sine wave off of the capacitive voltage divider and mix it with a fixed oscillator of some sort. You could probably simplify the AFE while you're at it.
Though the result would likely drift more, and you'd certainly lose the note display (which I find exceedingly useful for development, playing, and tuning / setup).
My humble opinion, and I probably shouldn't express it here, but I think using a single transistor as an oscillator is really just asking too much of it.
[EDIT] And if you want CV from it rather than noise, the 4046 loop filter will give you that. Linearity will be dependent on the linearity of the VCO (but Theremins themselves aren't all that linear anyway, so perhaps not a big deal?). Drift might kill you though, so a better VCO would probably be in order.
This is impressive stuff, Dewster!
And you have done the same as I eventually did for my Epsilon design, on your AFE.. Having a fixed frequency oscillator in "mode 0".. When looking at 4 'antennas' in close proximity, having a common oscillator and determining X and Y co-ordinates (and Z from the sum) is a lot easier by determining phase relationships than trying to use FM.
Regarding the PSoC - Yes, you are absolutely right - I realized that I was going in the wrong direction with this quite early, but not quite early enough, LOL! Right at the start of my theremin venture (5 years ago !?) I thought I had cracked it - I had a working PSoC theremin, and joined TW to let the world know that the analogue theremin was about to be replaced... Ha Ha ! ;-)
- At that time, I had never seen a theremin being played - had no real understanding about any of the finer points - I simply assumed that no-one had bothered to innovate on the basic concept, and that it was time to get rid of the junk and drag the theremin, screaming, into the digital 21st century....
I know you are not an idiot like I was back then - I think my aversion to digital theremins may be partly because the idea reminds me of my folly!
I will look over your verilog ASAP - I have extremely little exposure to verilog (ABEL is the only language I used for CPLD's)
Thanks for revealing so much - It is a real pleasure to engage with people who share their knowledge freely.
"Right at the start of my theremin venture (5 years ago !?) I thought I had cracked it - I had a working PSoC theremin, and joined TW to let the world know that the analogue theremin was about to be replaced... Ha Ha ! ;-)"
Fred, you're really scaring me! But you're in good company, even Bob M. couldn't seem to get the Theremin out of his hair.
"And you have done the same as I eventually did for my Epsilon design, on your AFE."
[EDIT] Let me extol the virtues of the AFE:
- Simple square (ish) logic levels at input and output.
- Exceedingly clear resonance point defined purely in the phase domain.
- Pretty darn linear without any complex tuning procedures.
- Single ended logic level power supply.
- High voltage sine wave at the antenna.
"I will look over your verilog ASAP - I have extremely little exposure to verilog (ABEL is the only language I used for CPLD's)"
After years of coding in VHDL I was forced on a major project to switch to verilog - and I'm quite glad I was forced. verilog isn't perfect (neither is VHDL) but it is less verbose and friendlier.
"Thanks for revealing so much - It is a real pleasure to engage with people who share their knowledge freely."
In industry literally everything is a secret for no good reason, making employees too frightened to say anything to anyone - I've pretty much had it. Corporate secrecy will be the death of us, cooperation is the only sustainable existence.
"MIDI is too slow and innacurate for theremins."
Fred, you're probably aware of this but I just ran across it a couple of days ago:
MIDI seems to be working pretty well with it. I particularly like the "finger drum" video at the end of this page:
>> "MIDI seems to be working pretty well with it. I particularly like the "finger drum" video at the end of this page:"
To be honest, it looks like a fun instrument - with possibly some serious musical applications.. I am not going to comment much more on this particular theremin, or be pedantic about whether in instrument without a volume antenna con be called a theremin - I have given up on that battle, and now accept that any proximity detector connected to an oscillator is a "theremin" - but it still sticks in my throat!
However - (I may be wrong) - The only performance using MIDI remotely approaching a "theremin" in the way I percieve a theremin, is the first - and this lacks the smoothness - it is using the pitch CC message I think.. And it is, IMO, horrible!
Perhaps if there were MIDI Synths / "recievers" which processed the full CC message and took another CC for volume, without retriggering the EG's (in fact, EGs are not needed or wanted) it would be worth looking at - But one would really need an external MIDI theremin module.
This whole subject has been extensively debated here before - I will see if I can find the link.
"This whole subject has been extensively debated here before - I will see if I can find the link."
That's OK, I'm almost certainly not going to go the MIDI route. MIDI seriously needs an update (more bandwidth, audio channels, etc.) but I don't think it will happen in the current climate as it tends to commodify products.
Confusingly on my part, I was pointing the product out as more of a digital approach to Theremin pitch than MIDI. It appears to be a garden-variety Theremin circuit plus processor and some other stuff (from their FAQ):
"The sensing circuit with the antenna attached, is a proper Theremin Circuit (using inductors, reference oscillator and nearly identical pitch-antenna oscillator, finely tuned with matched, high quality components and electronic tuning circuit)"
It also has volume antenna stuff they don't populate unless you specifically ask and pay for it, and then they put it in a bigger case. Kind of strange.
For the last couple of days I've been adjusting and altering the digital Theremin FPGA logic. The pitch numbers I was getting from the DPLL had too few significant digits above the noise floor at lower playing frequencies, and indeed this was something I anticipated - I spent at least a month on and off investigating with back of the envelope math and various simulations, trying to determine if this project even had a shot at working (which mostly boils down to the AFE Hz/pF sensitivity, and the whiteness of the phase noise from the DPLL). I knew it would be close, if it indeed would work at all.
Anyway, I tried increasing the DPLL NCO and error accumulator width, as well as lowering the cutoff of the downstream first order filter. Widening the error accumulator didn't help much, but lowering the cutoff of the filter did. There's no problem increasing the SNR this way if you love all portamento all the time and hate vibrato :-) but I think we'd all agree that vibrato is pretty important to the Theremin, as is highly responsive pitch.
Today I replaced the first order filter with a state variable second order filter, and that seems to have done the trick. I can open it up to around 340 Hz (~3 ms response time) and the phase noise seems tolerable. I need to move to a different development board with a DAC so I can start making noises other than square waves.
The repository of files, including my latest verilog code, is here:
Also there are several spreadsheets I wrote that helped me during the design process. "Theremin_NCO_RLC_PLL_2012-04-15.xls" is kind of neat because it stimulates an RLC with an NCO and phase locks to the result. "Theremin_frequency_display.xls" shows how to do either the CORDIC or the al Kashi log2 algorithms - I chose al Kashi because it doesn't require the storage of any constants and is more straightforward. "filters_1st_2nd_4th_order.xls" and "filters_1st_2nd_4th_order_quickie.xls" show you how to build floating point and integer based multiplier or multiplier-less (power of 2 shifts) digital filters. Spreadsheets are your friend when undertaking any numeric design job.
I'll post whenever there is a significant update or addition.
"And you have done the same as I eventually did for my Epsilon design, on your AFE.. Having a fixed frequency oscillator in "mode 0".. When looking at 4 'antennas' in close proximity, having a common oscillator and determining X and Y co-ordinates (and Z from the sum) is a lot easier by determining phase relationships than trying to use FM."
For the pitch side I have the DPLL adjusting its frequency to maintain a quadrature phase relationship, and use this operating frequency as a numeric input to the audio NCO. Phase locking allows a wider, more linear operating range for the AFE.
But for the amplitude side, where linearity isn't so important, I may go with what you are describing: multiple "antennae" connected to individual LC mode 0 circuits (probably without "linearizing" coils) and stimulated by a fixed frequency NCO (or just the output of a simple noise dithered divider). Then have the digital side look at the small changes in the individual phase relationships with changing hand capacitance.
I've tried many approaches in order to reduce low frequency phase noise, and came to a realization yesterday that much of what I've been fretting about for the last week or so was simply the result of looking at very small operating point numbers. SNR is quite poor there because the signal is so small, not because the noise is particularly bad.
I've had a second order filter after the DPLL to trade response time for increased resolution. Yesterday I found that the low pass filtering of the DPLL itself (if the design parameters are set for a roughly equivalent pass band) gives the same subjective performance. So the filter is now out and the design is simplified.
I'm grappling with linearity and note spacing now. If I adjust the DPLL offset to give the null point with my body about 2 feet away, I get the fairly linear open hand / fist octaves shown in the posted video. But changing that to get wider note spacing farther out doesn't change the spacing near the antenna, where the notes remain rather cramped. It would be nice to have a simple curve & offset that could correct this, or some piece-wise linear fit as long as it isn't too difficult for the average user to perform. I'm loath to go from the semi-logarithmic domain to the linear domain and back again to do this as that would be more complex, and fear what it might do to the noise dither. Squaring numbers in an FPGA isn't too difficult, but the polynomial fit I've looked at in a spreadsheet seems super sensitive to coefficients. This might be best left to a processor, placing the linearity / spacing calculations in the audio update loop.