Let's Design and Build a (mostly) Digital Theremin!

Posted: 2/1/2015 7:48:36 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Been thinking about PLLs and DLLs as the basis of oscillators, particularly those for the volume / left hand axis control where resolution isn't quite as pressing.  LC resonators don't make the best "clocks" (they need periodic stimulation to get to higher amplitudes) so from my limited experimentation it seems simply using the LC signal delayed to whatever phase is appropriate for LC stimulation can lead to stalling and other strange GIGO behavior.  The best configuration seems to be a steady clock of some sort as stimulation, with phase lock to the LC output.

PLLs employ an explicit oscillator with frequency control input.  This isn't ideal because we really want the period, which is the inverse of frequency and to a first order proportional to capacitance.  A DLL with cyclic or repeating output may be best here.  Two axes for the left hand might be implemented with two Ls connected to two antennas with the output connected to two phase detectors, with the combined output controlling a single repeating delay-based stimulus.  The phase error must be integrated to set the delay, and this provides a natural LPF output for the operating point, which could easily be LPF'ed more for use in synthesis.

=============

Also thinking about LC Q some.  If Q is degraded then the resonant peak is broader and squatter, which makes resonance less selective and may let environment interference and the radiation of other axes in.  In-phase stimulation & sense gives the best Q because the drive resistor can be made quite small (tens of K) but unfortunately the sense reverses phase just a bit below resonance.  Above resonance it's fine though.  Arrangements that rely on RC delay (Vackar?) kind of scare me because they don't naturally go right to the natural resonance point and so may require component value adjustments to get them right for a given antenna.

Posted: 2/28/2015 5:35:49 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Found potential cases to build Theremins in!  A search for "arrow case" on Amazon brings up lots of long plastic boxes with hinges and latches. 

Like this one from Plano:

 Or this one from MTM which comes in translucent or black:

  (Personally, I find bow hunting unnecessarily cruel in the extreme, but the "sport" has some nice cases.)

Posted: 9/7/2015 4:10:33 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Coming up for air after ~8 months of Hive work.  Feels like I gestated and birthed a human child whilst in solitary confinement!

http://www.mediafire.com/download/844087o9v6c914j/HIVE_2015-09-07_v08.06.zip

That zip archive has the latest design document, the latest System Verilog code, the new C++ simulator, and a spreadsheet of algorithms.

The sim is what's taken me so long to develop.  It's a Win console app that simulates all 8 threads and runs about 800kHz clock speed on my older PC (~0.4% of 200MHz, the actual SV core running on a cheap FPGA ).  The sim is interactive, and I developed a new verification boot code file on it that helped me hone the user interface.  There's a short run-through of the sim in the design document.

Good exercise as it helped me refine the opcodes (got rid of short A?B jumps, replaced them with skips, which made room to expand some 6 bit immediates to 8 bits, among many, many other changes), and the tool is something I've been really needing for code development.  Maybe now others will find Hive easier to use too, thousands have looked at the document but very few download the SV, and maybe 2 people have contacted me via email, which is about 1 per year :-(.  Famous last words, but no more basic hive development for a while I hope, and back to Theremins.  

I'm thinking of starting a new thread that is less speculative, more of a documentation of what I'm doing.  The physical thing is still getting me, but plate antennas will make it easier I think as they can be built-into the case rather than hanging out in space, reducing ESD and connector concerns.  Given sufficient room, the plates could be angled inside the case, or the pitch plate could go in the open lid, etc.

Posted: 9/10/2015 10:42:10 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Strange Tank

Looking through my engineering notebook, I decided to play with this circuit a bit more (I thought it up in February of this year).  The idea here is to use a circuit very similar to a split capacitor Clapp LC tank but replace the bias resistor to ground with an inductor of equal value to the series inductor.  As usual, the series inductor obviously resonates primarily with the antenna & hand capacitance.

The reason I thought of this circuit is that, when playing on the bench, I noticed the bias resistor had a huge effect on noise pickup, something I wasn't necessarily expecting.  So I figured if the bias could be frequency dependent (an inductor) then maybe we could "short out" gobs of low frequency noise from the antenna to ground.  In fact the noise response doesn't look all that different from that of a resistor, but the resonance looks somewhat better.  Enough to warrant a second inductor?  I didn't think so at the time but now I'm thinking yes.

This is a very low-current in-phase drive / sense arrangement, and it is particularly well suited for digital use. The digital I/O are at relatively high capacitance points and somewhat isolated from the tank, facilitating ESD treatment.  The inductors here are really high value for experimental stimulus via a function generator.  The FPGA logic would likely be some form of DPLL (I'm looking into period based digital oscillators rather than frequency-based as period is more useful as an operating point).  3V square drive gives a pretty nice looking 3V sine wave out, with around 18V at the antenna.  For more swing increase the caps to 470pF and reduce the drive resistor to 10k, which gives ~35V.

This circuit is an excellent candidate for the volume side of things, and maybe the pitch side too.

[EDIT] The FPGA drive & sense could obviously be replaced by a FET or BJT to produce an analog Clapp oscillator.

Posted: 9/27/2015 2:36:06 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

I made a Clapp oscillator using the above tank and it had two modes, a lower frequency one that would kick and stick higher when I touched the antenna.  The above tank isn't good for left hand use, where phase can't be allowed to flip when the hand gets very near or actually touches the antenna.  A Vackar tank is best for that scenario when going the digital route.

For LED drive I ran across the TLC5916 (8 LEDs) and TLC5926 (16 LEDs) which are serial to parallel devices.  They set global brightness with a single resistor, and have an internal brightness register one can access via the serial port.  Pretty nice looking, will order some shortly.  Should massively cut down on the wiring effort in the "tuner", with plenty of outputs left over for the LCD backlight and other panel indicators.

Am settling on a 20 x 4 LCD from Eastrising:  http://www.buydisplay.com/default/3-3v-5v-20x4-character-lcd-display-module-black-on-white-high-contrast, it's available on eBay for less but I may buy direct as the ordering process is clearer.  Thinking of using PWM to control the contrast voltage digitally (or possibly a resistor in series with one of the output constant current sources of the the TLC5916?).

For prototype use I'm going with a pencil box similar to this one from Staples:  http://www.staples.com/Staples-Pencil-Box-Translucent-Clear/product_472593.  The tuner and LCD will simply be visible through the translucent plastic.  Will mount it on a stick or something along with the antennas and tank circuits until I can find something more permanent.  Thinking of a vertical mount for the controls with the tuner at the top, LCD in the middle, controls at the bottom.  This way the tuner is most visible to peripheral vision.

Downloaded Eagle a few days ago and wasn't blown away by it, I may stick to hand wiring things for a while.

Developed a periodic delay-based PLL last week, have yet to try it out in hardware but the sims look very promising.  Dithering the fractional part of the delay requires no multiplication (unlike a frequency based phase accumulating NCO) and placing the dither earlier in the feedback loop allows it to also truncate the loop filter output, producing an almost trivial construct that kicks out low pass filtered period rather than frequency as the operating point.   I don't have any pressing need for period rather than frequency - either should work almost equally well for the left hand, and since the right hand will be heterodyned the operating point isn't used directly.  But if it pans out it should be an extremely efficient topology for FPGA dithered oscillator use.

Posted: 9/27/2015 3:48:54 PM
rkram53

From: Northern NJ, USA

Joined: 7/29/2014

Are you now using the LCD to show pitch or are you still using that rather unique method you described a while back that had a different matrix device you constructed I believe. 

Rich

Posted: 9/27/2015 6:01:17 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Hi Rich,

I'm going to use the dedicated LED matrix shown earlier.  Here is my proposed control unit layout (<bad> artist's conception):

The control unit will be mounted at the center of a cross member, with antennae at the opposite ends end of the cross member.  

I'm thinking no analog volume control, just digital SPDIF control with some kind of quick defeat mechanism.

The LEDs can be any color, maybe one color for the note display and another color for the octave display.  I'm wondering if an actual number for the octave (0-9) might be easier to interpret?

Posted: 9/27/2015 6:17:45 PM
rkram53

From: Northern NJ, USA

Joined: 7/29/2014

Yea - that's what I remember. So how does a performer quickly know they are playing for example a C vs. a D (primarily for when muted to get the note to come in on)? I know there is a way to figure that out from your matrix - but people that already are used to note names will likely be better off with a simple display of that.

So it still would also be very helpful to see the closest pitch on the LCD in note letter names (that you can change with one of your dials to show as either sharp (say C#) or flat (Db), etc.

Posted: 9/27/2015 6:32:41 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

video

The beauty of LEDs is you can see them clearly peripherally, if arranged in certain ways major and minor scales form simple patterns, and the C# / Db doesn't need disambiguation.  But having the octave and note on the LCD as well is a good idea, thanks!  The tuner will be largely in software, and I plan to implement pitch quantization and correction, so the info should be there for the pickin'.

Posted: 9/27/2015 9:45:03 PM
rkram53

From: Northern NJ, USA

Joined: 7/29/2014

The reason for C# vs. Db has more to do with musical issues. If I am playing a piece in C# and some may even be looking at a score when playing, I'm actually thinking C#, not Db (though in minor you do commonly mix things so you would need to know what minor key and impose leading tones). It will get complicated musically and key change will rear its ugly head making it even more complicated to figure out flats vs. sharps. So thinking more maybe trying to gear display to actual key is not worth it. I guess you could just know how to convert your matrix patterns in your mind to be one or the other. I'm interested to see how that is going to develop.

Now after playing a lot with Theremini pitch quantization, I've come to these realizations. 

1. Too much and its just an effect and useless for musical playing

2. It doesn't take a lot to get to be too much.

3. Just a touch of quantization to effortlessly gravitate to the nearest note is likely what will be used most unless someones just wants to play scales. But then vibrato raises its ugly head. Actually, the theremin is all about vibrato and portamento. All else is rather simple - the sound source itself of a theremin is not that complicated or in some senses even that interesting. Flexibility of pitch is the name of the game and that again means vibrato and portmento - the enemies of quantization and your biggest challenge in creating musical pitch correction.

Quantization that gravitates to the nearest note (by say settings of 10 cents, 20 cents, up to 40 or so cents) could be useful. But what you really might want is to slightly adjust too. For example if I am 25 cents off, but using vibrato, its going to be hard to know whats going on unless you average things and maybe not just try and throw me back to 0 cents off, but maybe just throw me back to within 10 cents off (maybe randomly in the 0-10 range) as vibrato is going to be moving things around. There are a lot of cool things to experiment with there - but you need to be playing to really determine how quantization is going to be useful and how it affects musicality.

Lets compare the Etherwave and the Burns B3. The Etherwave (at least mine) is very, very sensitive to hand motion. The B3 much less so. So very slight hand motions on the Etherwave will appear to change pitch constantly where on the B3 it seems like pitch is locking in better. In reality it's the theremin's sensitivity that is creating that perception, and in effect perhaps what quantization can help achieve. In its best case, quantization should not appear to be locking you into notes, but instead appear to be letting you hit pitches with greater ease, possibly at the expense of hearing a bit less vibrato. But you still need to hear smooth portamento between notes when pitch correction is on (or quantization just becomes a scalar effect).

I'm not sure if this makes sense, but that is the feeling I get when I play. I only use a little bit of Pitch Correction when playing the Theremini, and if set right it really feels like the normal pitch production on the Burns B3 Pro. So quantization in addition to possibly being a learning tool for beginners should also let you simulate the "feel" of any theremin and that is where it likely will come in most useful to better theremin players.

 

 

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