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

Posted: 11/26/2021 5:23:20 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"Will the next set of Clarabox kits be the Sesquicentennial Plus 1 Year Edition? 🤪"  - ContraDude

Posted: 11/26/2021 5:30:30 PM
ContraDude

From: Basking Ridge, New Jersey, USA

Joined: 12/12/2020

OMG!! LOL!!! 😂

Posted: 11/26/2021 11:42:30 PM
Mr_Dham

From: Occitanie

Joined: 3/4/2012

Clarabox has its MIDI cable ready.

Old oxidized connectors from my stock, no soldering flux (I should buy some), ... A difficult moment but I finally made it.

Posted: 11/27/2021 10:46:07 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

"Clarabox has its MIDI cable ready."  - Mr_Dham

Whee!  Incoming test loads in 3... 2... 1...

Posted: 12/5/2021 2:46:15 AM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

D-Lev Bulk Update

Literally all files have been updated, including the software, manual, presets, librarian, etc. : https://d-lev.com/support.html

Software
- MIDI:bend[0] range +/-50 => +/-200 cents (good suggestion from Mr_Dham).
- Negative MIDI channels give 2ms dead time between data clumps (another good suggestion from Mr_Dham).
- More tinkering with the type system, doubled the signed singles areas.
- New signed full scale squared types: [0xa8:0xab].
- Pcal & Vcal 4x gain-up; type change: 0xa7=>0xab (fs=>fs_sq).
- damp type 0x73 2x range: [0:31]=>[0:63].
- Post knob is now [0:3]: 0=V&P pre; 1=P post; 2=V post; 3=P&V post.
- Pcal & Vcal knobs now [-127:127](fs) (type 0x23 => 0xa7).
- damp knob is now multiplicative: controls fall, filters, resonator.
- Removed damp dloc[0] disable.
- Preview oscillator phase now zeroed @ preset load.

A biggie here is the complete automation of the ACAL auto-muting process for those who use traditional volume sense.  ACAL auto-mute is disabled when the volume hand plays < -48dB.

Posted: 12/5/2021 7:52:35 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

Greensleeves

Trying my hand (literally!) at an oldie but goodie: https://d-lev.com/audio/2021-12-05_greensleeves.mp3

It can't quit Patsy!

Posted: 12/5/2021 8:20:05 PM
dewster

From: Northern NJ, USA

Joined: 2/17/2012

The Bourns Identity

And by their works ye shall know them:

The above is a Bourns rotary encoder, part number PEC11L-4120K-S0020, failing spectacularly at its one job.  Of the bad ones, some work OK in one direction but don't register some detent regions in the other direction.  Some miss many detents in both directions.  And this is turning them very slowly, the defective ones are much worse when turned more quickly, sometimes even reversing direction.  The contact noise is horrific!  There are aggressive countermeasures in the FPGA they are connected to (digital filtering, hysteresis, gray code error rejection, acceleration error rejection, etc.) but almost nothing can withstand this level of input noise and correctly decode detent events.

I was told by the datasheet that I was buying long-wearing encoders, but they are proving to be way worse than the cheap generic encoders from eBay used during development.  I've seen the cheap ones sometimes wear out after a ton of use, but I've never seen any malfunction right out of the tray, nor none wear out almost instantly after very little use, like these Bourns encoders have.

What we've got here is a failure to communicate.

Posted: 12/6/2021 5:38:21 PM
ILYA

From: Theremin Motherland

Joined: 11/13/2005

Thanks dewster for links at the first page of this thread. Quick access is very handy. Truly, this topics is a kind of encyclopedia.
I'd like to share some observation, this concerns the noise generator (it was discussed [here] and [here]).
Maybe it will be useful for someone.

A brief reminder.
If we generate an unipolar pseudo random sequence and normalize it correctly (to obtain a bipolar signal), we get a spectrum like this (fs=48000 Hz):

The "whitening" filter compensates some high frequencies reduction (the difference is almost inaudible):

dewster's "whitening" algorithm is s[n] = s[n] - s[n-1] / 2, and Dattorro's one is s[n] = s[n] - s[n-1] * 2 (due of right shifted register).

Well.
Experimenting with different polynomials, I have discovered the following thing.

Some polynomials, C0FEBABE for example , produces the flat spectrum curve even without the "whitening" filter. Unfortunately, "C0FEBABE" does not generate a maximum-length sequence (the length is 13FFFFFB versus FFFFFFFF) but it is not so critical because the period is long enough (about 2 hours at fs=48000 Hz). Another polynomial, E0000200, produces the true white noise and has a maximum length:

It should be noted that I'm using the modular ("Galois") form of generator, not the simple ("Fibonacci") form which dewster or Dattorro exploits.

Algorithm looks like this:

It is interesting that these polynomials (C0FEBABE, E0000200, as well as their reciprocals), being used in simple form generator, do not produces the flat spectrum, inexplicably. The question requires researching.

Posted: 12/6/2021 6:07:16 PM
ILYA

From: Theremin Motherland

Joined: 11/13/2005

It is also interesting to have a look into waveforms before and after whitening filter.
The PRN generator based on LF shift register sometimes produces characteristic exponential sections (left) which are slightly smoothes by filter (right):

Below is the waveform from generator with "magic" polynomial E0000200 (modular form, left shifted):

The exponential sections are generated too, but the spectrum producrd is originally flat.

(All waveforms are generated by "C" and transfered to CollEdit (Adobe Audition) application for analysis)

Posted: 12/6/2021 6:13:36 PM
ILYA

From: Theremin Motherland

Joined: 11/13/2005


Life-hack for some MCUs

Some MCUs have the CRC calculation unit. Basically it is used to verify data transmission or storage integrity.

Putting a constant instead of verifying data, we get a pseudorandom sequence.
No special code is required, only pair of write/read instructions:

  next=CRC->DR; // read the next pseudo random value (unsigned 32 bit)
  CRC->DR=0;    // write a constant to data register

(true for STM32 family of STMicroelectronic)

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