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

Posted: 9/15/2014 3:06:11 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"I kind of wonder about your "Hooked up a 1k resistor and red LED.." - If this LED wasn't a fast response part*, could this be the cause of the problem?"  - FredM

Just tried a 220R and am seeing essentially the same spectra.  I think if there were any digital issues at the serial interface they would show up as gross issues with the spectra.  I'm actually kind of shocked the results are as good as this, with the second harmonic ~80dB down (the sine waveform has its LSBs simply truncated to fit 16 bits, rather than noise shaped or dithered).  What I don't get is why feeding it a 0dB digital signal causes severe clipping, though a quick web search seems to indicate others have perhaps similar problems with SPDIF levels:

http://www.kemper-amps.com/forum/index.php?page=Thread&threadID=4722

http://duc.avid.com/archive/index.php/t-43770.html

It's interesting that the value of -11dB mentioned in the first link is suspiciously close to the >> 2 bit / -12dB case I'm seeing.  I have the huge advantage in that I know exactly what information the serial SPDIF contains.  Those poor slobs are shooting in the dark behind a wall of drivers and other SW, trying to make sense of things.  Yet I still don't have a clue.  The data should be aligned so that MSB is in the MSB location, and any unused LSBs set to zero.

I see a Toslink output on my PC motherboard but not sure I've got the time nor the patience to see what's going on with that.

Posted: 9/15/2014 4:52:46 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

OK, the SPDIF 0dB clipping mystery is solved.  After pouring over the Cirrus Logic 8416 datasheet and probing some pins it's clear that there are no errors in the serial stream the FPGA tester is providing via LED.  Probing the Everest Semiconductor ES7144LV DAC analog right output pin with -12dB, -6dB, and 0dB SPDIF levels from the tester shows a ~0.5Vp-p, ~1Vp-p, and ~2Vp-p triangle waveform with no clipping.  Probing the DAC box right side line level output shows clipping for the latter two cases.  So the clipping is happening in the final DAC box line out conditioning / drive circuitry, which, for whatever crazy reason, has ~4x too much analog gain.

To be able to adapt to this kind of unforeseen nonsense I suppose I'll have to incorporate a sticky "SPDIF gain" user control setting somewhere in the bowels of my digital Theremin.

Posted: 9/20/2014 4:39:29 AM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Been working on the pitch display:

Above I'm testing it by feeding it a super slow sine wave as pitch operating point, and it is tracking ~4 octaves of change.  The display on the left is the octave display, with 4 wrap-around levels.  Higher LEDs are higher pitched octaves.  The display on the right is a ring of 12 LEDs, one for each note, with increasing pitch going clockwise.  The center LED tracks the "darkness" of the nearest note, and so is never more than 1/2 brightness.  The octave display uses PWM only at the B|C note transition.  I tried using PWM over the entire octave range but it was more confusing.

Above: The 10mm red/orange LEDs from Adafruit on vector board.

Above: rear view of the vector board showing popsicle stick cable clamp, 2 resistors & one NPN per LED, connected to FPGA board at left.  This is an old PATA cable I had laying around.  Powering everything via USB serial port adapter (probably ~300mA).

Not totally sure what I think of this yet, I suppose the true test will be in seeing how intuitive the visual feedback is while playing it musically.

Posted: 9/20/2014 4:51:49 AM
Touchless

From: Tucson, AZ USA

Joined: 2/26/2011

Amazingly I get it but why no tone for the effect. I applaud you for the amount of time, thought and work that went into the display. Does a Thereminist have time to look at this while playing, I guess if the theremin design has enough latency they could have all day. The girl below is our favorite TW pin up girl.

T

Posted: 9/20/2014 11:47:38 AM
rkram53

From: Northern NJ, USA

Joined: 7/29/2014

Very interesting display. Any reason why the 2 LEDs on the left are different (just ran out of the others for prototyping?).

But it might also be nice if you also had a more deterministic pitch tracking mode for training that gives a bit more pitch feedback than just the center light getting brighter (and only up to 1/2 brightness?) You'll have to play in the dark to really see any small change.

I think you could have a much more effective pitch response mode (if you can have modes in this design - assume you can) if you had only that center LED go on if you were within N cents (in tune) of center freq (A=440, for example), then only the 6 LEDs around it might go off if you get within a danger threhold you define and then only the outer LEDs go off if you pass that. I think that would be easier to see as you play and you can better use it as a pitch training mode as you have hard kick points for pitch change. 

Just a thought. 

Rich

Posted: 9/20/2014 1:13:50 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"...why no tone for the effect."  - Touchless

At the top of my Theremin to-do list.  Alas, several other to-do lists trump it.

"Does a Thereminist have time to look at this while playing..."

Good point: does a Thereminist need to watch his/her hands like a hawk?

=========

"Any reason why the 2 LEDs on the left are different (just ran out of the others for prototyping?)."  - rkram53

I actually had a couple left over (they come in packs of 25).  The octave pattern wraps around with 2 LEDs per position and 5 vertical positions for 4 levels, so as to match the note ring layout which also has 5 vertical positions.  I think it is good for the octave display to look and behave noticeably differently than the note display.  And I think 4 octaves with wrap are just enough information here. 

A different pattern could certainly be employed, any suggestions?

"But it might also be nice if you also had a more deterministic pitch tracking mode for training that gives a bit more pitch feedback than just the center light getting brighter (and only up to 1/2 brightness?) You'll have to play in the dark to really see any small change."

The totally dark point appears pretty narrow which is the main reason I decided to go with this "negative" display.  It seems also that if the action of the center LED doesn't match that of the other LEDs, my eyes don't see what's going on as a pattern as much.  50% brightness is necessary for the darkness "hand off" from one LED to the next, but it seems much brighter than 50% due to the ~logarithmic/power nature of the eye brightness response, so it isn't exactly a huge compromise.  I can see the display pretty well on my rather well lit workbench as these are 1000 mcd LEDs (https://www.adafruit.com/products/845) and the frosted red plexiglas bezel increases the contrast quite a bit.

I've been playing around with LED linear PWM for years and I'm always a bit shocked at the brightness difference between 50% vs. 100%, and 25% vs. 0% (off).  The former change is barely discernible, the latter change is super obvious.  For a display such as this, one can choose to either fight the log eye response or exploit it. 

I should also say that virtually any LED display will benefit from a colored filter bezel - this pitch display looks much crappier without it.  It unfortunately cuts the brightness, but more than makes up for this with dramatically increased contrast.  But the minute you employ a bezel you lose positional information as to what LED is on if the others are off.  The only real downside to having a bunch of LEDs on is the power / heat issue.

Posted: 9/20/2014 11:47:24 PM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

Hi Dewster -

You really are getting there! ;-) .. I wasn't convinced about the merit of any pitch display - still aren't.. But it will certainly add something visual and unusual! ... You should duplicate the LEDS in big super-bright versions and have a display on the back of the instrument for the audience to view!

Ok, a while back, somewhere (I think it was this thread) there was discussion about how to test for latency and sticky pitch and all that stuff - pendulums and motors and helicopters were suggested.. ;-)

I am now facing the same testing requirements - never needed to before (for latency) because I was always directly heterodyning the oscillators, so latency was impossible.. But now I need to check the operation of the phase-locked oscillators in practice (rather than just in theory and simulation, which seem to work).

Havent done it yet - but I think the easiest way may be to connect an electronically controlled capacitor to the antennas, and drive this from a function generator.. I am looking at having an antenna connected to ground through a  stack of reverse biased diodes (1N4007's or other bulky similar parts) and driving these from the function generator via an inductor, so that the function generator grounding itself doesn't unduly influence results... Place this antenna close to the pitch antenna and perhaps I dont need to mess with anything mechanical - I like the idea of no physical connection, but failing this, directly connecting to the antenna with an electronically controlled capacitance should allow testing of latency and "stickies" .. And allow faster transients to be tested without risk of decapitation ;-)

Oh - re the LED brightness.. In looking at digital pots, I found a load of reference to their use in controlling led brightness - pots with a log law are suggested, and "audio taper" is said to be ideal! ... Not of any interest to me (I found it annoying to find these as I was looking for audio applications ;-) but thought it may interest you.

Fred.

Posted: 9/21/2014 12:02:43 AM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"I wasn't convinced about the merit of any pitch display - still aren't.."  - FredM

I was hoping you would comment - though you're my toughest customer when it comes to my cockamamie pitch display ideas!  ;-)

"Havent done it yet - but I think the easiest way may be to connect an electronically controlled capacitor to the antennas, and drive this from a function generator.."

I wonder if you might be able to forgo the electronically controlled capacitor and just drive the antenna with a voltage waveform through a 1pF cap, or via a closely spaced second antenna?  I should give this a try with the (ill fated) Theremini...

Posted: 9/21/2014 1:19:41 AM
FredM

From: Eastleigh, Hampshire, U.K. ................................... Fred Mundell. ................................... Electronics Engineer. (Primarily Analogue) .. CV Synths 1974-1980 .. Theremin developer 2007 to present .. soon to be Developing / Trading as WaveCrafter.com . ...................................

Joined: 12/7/2007

"I was hoping you would comment - though you're my toughest customer when it comes to my cockamamie pitch display ideas!  ;-)" - Dewster

LOL ;-)

I am glad you dont pay too much attention to my rantings! ;-) .... I am realizing that anyone who listens to my opinions is probably doomed to commercial failure!

You see, i have got it all wrong all my life.. When I saw the first LED digital watch being displayed to the crowd of admiring engineers at my first job, I couldn't comprehend the enthusiasm at all - a bulky ugly box you strapped to your wrist and needed a battery change every week at least.. WTF ?!... And I have the same reaction to the wrist worn computer, and to game consoles, and to mobile phones which are so complex it takes an hour to work out how to answer a bloody call..!!  ;-)

And almost everything that I believed was too useless or stupid or complicated to ever catch on has been a hit. And most "eye candy" and "ear candy" just makes me sick. And at the bottom line, I do not understand what makes most of the human race tick, dont see what pleasure or satisfaction they get from the bulk of what they do, cannot relate to their worship of celebrity or royalty or whatever, and just dont understand anyone or anything...

And compared to the majority of the stuff I dont understand or think are 'stupid' ideas, your pitch display is brilliant!

But I dont think it will have any useful function other than the most important function of all - people will want it!

;-)

Hey - dont take me seriously! Im one of these people who only has any chance of playing a theremin if I have my eyes closed and my full concentration is on what I hear and my pitch hand! - so a visual display - no matter if designed by Einstein or lord Krishna could never be of any use to me ;-) ... I find any visual disturbance interferes with my musical ability - I cannot play the keyboard while looking at my DAW, I can follow sonic cues, but if watching a display, even if simultaneously hearing the cues, my timing and intonation goes to hell!

Fred.

Posted: 9/21/2014 2:31:04 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"But I dont think it will have any useful function other than the most important function of all - people will want it!  ;-)"  - FredM

Don't hold back, tell me what you really think. ;-)

Theremin himself designed and built crude pitch displays for his stuff (IIRC based on mechanical resonance and tied to bulbs).  And not that one needs to follow in every single footstep of the master, but after having experienced a truncated pitch display on my earliest (and only) prototype I can fully appreciate why he did so, if only for myself.  And it gives me something to do with all these FPGA pins just hanging out in space.  ;-)

Here is the SV tuner code: http://www.mediafire.com/download/4u7et9e1136u74k/tuner_tester_2014-09-21.zip

(The pitch display will most likely end up as software, but I find it easier to do this kind of low level testing and development in SV.)

===========

Maybe a week ago I updated the Hive page over at opencores.com and now MediaFire tells me that the latest design document (that I link to in the comments over at opencores) has been downloaded 524 times!  I kind of don't believe it as the document only gets ~1 download per day on average over at opencores.  Maybe it's a webcrawling robot spider thing?

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