An analog how-to: A "close-enough"-izer

Started by phector2004, August 06, 2011, 08:27:56 PM

Previous topic - Next topic

phector2004

I know the "easy" way to do this is probably by use of a PIC, but I'm not much of a programmer...  :icon_redface:

So I've got to ask:

Is there a way to quantize an input voltage using an analog circuit?

E.g. 0-1V on the input gives X volts, 1-2V gives 2X volts, 2-3V gives 3X volts, etc...

I'm thinking of tweaking with adjustable thresholds and step sizes too. It could make for some cool sounds

Thanks!

R.G.

A microcontroller is just the most flexible way to do it. An LM3914 will take an analog voltage and turn on one of ten LEDs depending on the voltage level. It does this by having a string of comparators inside that tell you when it's between X and Y. You can use the outputs to turn on voltages instead of just driving LEDs, too.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

phector2004

Thanks!

They look pretty simple to use

I'll look into obtaining a few  :)

Taylor

Both my "Uncanny Valley" and Earthtonesaudio's ADC circuit will do this. ETA's is much more efficient than mine, but the Uncanny Valley may be a bit more easily tweaked as far as amplitude bins and bit inverting.

PRR

> quantize an input voltage using an analog circuit?

Steal this LM339 circuit:


Add a resistor on each output, all summed together.

You may or may not want the black diodes (leave open).

For be-bugging, you do want the colored diodes, LEDs; when done, you still need those resistors but the LEDs can be replaced with shorts.

There's more-boiled simpler solutions if you know just what you want. But since you are still exploring, this leaves leeway for seeing what is happening and changing without big interaction.
  • SUPPORTER

phector2004

Thanks for the ideas! Looks like I have to do my homework on comparators...

I guess I'll just say what I'm going for -- a "fretted" fake theremin
By quantizing the output of a proximity sensor (zvex proximity wah circuit), a set of 12 oscillators can be tuned to cover the whole chromatic scale
Each oscillator can then be switched off so that only a specific set of notes or arpeggio is played (within the octave, unfortunately)

Don't know how much of this is doable for me, but I'm willing to try it one step at a time.
Maybe I'll start with a quantized wah

I like the LM3914's simplicity, but it's limited to only 10 levels
The LM339 circuit might be more suitable if expanded, and while I'm figuring comparators out, I'll definitely give the "Uncanny Valley" a shot.
I've never been able to picture what it sounds like!

Thanks again,

Phil

Taylor

Why not just one oscillator, and have the voltage controlling pitch? If you use a 4-bit flash ADC, you get 16 levels. You can tune the thresholds for your notes.

amptramp

Quote from: phector2004 on August 07, 2011, 12:29:36 AM
I like the LM3914's simplicity, but it's limited to only 10 levels

LM3914's can be cascaded and I know of one automotive air-fuel ratio meter in production that uses 20 LED's and does exactly that.  There is also an LM3915 which is a 3 db per step logarithmic device that may better suit your needs depending on how you sense proximity.  The LM3916 is another version with Vu-meter scaling.  All three devices are cascadable.  Check the applications in the spec sheets:

http://www.national.com/ds/LM/LM3914.pdf
http://www.national.com/ds/LM/LM3915.pdf
http://www.national.com/ds/LM/LM3916.pdf

phector2004

Hmmm I'm getting ideas... what are good VCOs for producing audible frequencies?

I can use trimpots to the LED outputs to set the output voltage sent to the VCO... might need multi-turns, but normal ones will do for now

Taylor, I somewhat understand the 4-bit flash ADC, but since it's using only 4 bits, how can the output be tuned? IIRC notes aren't linearly related, so how could the bits be added in such a fashion  ???

R.G.

Quote from: PRR on August 06, 2011, 11:49:36 PM
> quantize an input voltage using an analog circuit?
Steal this LM339 circuit:
I completely agree. That's pretty much what the inside of the LM3914 is. If you want to dink with fewer steps, or tinker closely with the action, it's a good way to go about it.

Quote from: phector2004 on August 07, 2011, 12:29:36 AM
I guess I'll just say what I'm going for -- a "fretted" fake theremin
By quantizing the output of a proximity sensor (zvex proximity wah circuit), a set of 12 oscillators can be tuned to cover the whole chromatic scale
Each oscillator can then be switched off so that only a specific set of notes or arpeggio is played (within the octave, unfortunately)
Cool!

Unfortunately, what you want is an MK50240. This is a single-chip top octave generator. It generates a full octave of -accurate- even tempered notes simultaneously. All you need to get a note to start/stop is some kind of switching arrangement to let/not let the frequency through to a mixer, which can be resistors. A CMOS flipflop on each output generates an octave down. One MK50240 plus twelve CD4024s generates 96 -accurate- even tempered notes of the music scale, and can serve as the tone generator for an entire organ.

Unfortunate, because these are extinct, and surviving ones are very expensive if available at all.

There are a large number of VCOs for synthesizer use that will follow a voltage accurately; these are very, very sensitive to analog accuracy in getting accurate musical notes.

The scheme I liked was to produce an accurate musical frequency, and then use a phase locked loop to glide to the accurate note frequency, perhaps overshooting and wobbling as it settled. This completely squashed the accuracy and tuning issues.

A good way to do what you want is to produce your proximity signal, then quantize it. An LM3914 or any other quantizing system works fine to produce digital on/off signals for select-a-note. Use the select signals to gate on a note frequency, then have a PLL acquire and lock onto the note frequency. The PLL can be made of a 74HC7046 and a XR2206 to get you sine/square/triangle outputs simultaneously for waveshaping.

Once you're there, you're into electronic organ territory. I recommend reading "Electronic Musical Instruments" by Richard Dorf. My copy is third edition, 1968.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Taylor

Quote from: phector2004 on August 07, 2011, 10:18:47 AM

Taylor, I somewhat understand the 4-bit flash ADC, but since it's using only 4 bits, how can the output be tuned? IIRC notes aren't linearly related, so how could the bits be added in such a fashion  ???

If you use a folding flash ADC like ETA's, you can't, but the inefficient style, as in my Uncanny Valley, where you have one lever per opamp, rather than 1 bit per opamp, you can tune the thresholds by tuning the resistors in the resistor ladder.



I know you want to do this in analog, but just to give you another idea, doing this entire shebang in the Spin FV1 would be ultra-simple. It will not only take care of your quantizing, but also can do the oscillator/oscillators right there in the code, and unlike 12 analog oscillators individually tuned, you won't have to retune every single note every time you play the instrument. You can have a lot more than just 12 notes very easily.

Code for an audio sine oscillator is available on the Spin site. Getting a sine-to-square waveshape knob is as simple as some gain (to make the sine clip) and your quantizing would be relatively simple as well. Even though it's not the easiest thing to get into, if I were looking at starting from scratch I still think it would be easier than doing it in analog. Just another idea to consider.

As a side note, anybody know the adverb form of analog? Analogically? Analogously?

phector2004

Archaically?  :icon_lol:

I could try an FV-1 too... Maybe see what I can tap out of it. (Chords, maybe?)

Not a very experienced programmer though. A bit of VB and some ActionScript, but I'll consider trying it out. It's not C is it?

nexekho

I have quite a bit of programming experience as a games developer.  Not a whole lot in the audio processing or PIC fields, but I'll offer whatever help I can.  Though this technically is not audio processing I guess...
I made the transistor angry.

Taylor

Quote from: phector2004 on August 07, 2011, 07:10:50 PM
Archaically?  :icon_lol:

I could try an FV-1 too... Maybe see what I can tap out of it. (Chords, maybe?)

Not a very experienced programmer though. A bit of VB and some ActionScript, but I'll consider trying it out. It's not C is it?

It's its own language, but when I got into it I had almost no programming experience at all, so I found it relatively easy to get into. I still find it a lot more intuitive than analog tech.

Re chords, your limit there would be instructions - you can only have 128 instructions in a program. The sine oscillator is only around 10 instructions as I recall if you only need low audio freqs, but you must oversample to get higher freqs which eats up program space. You could probably get double stops happening, but more than that might be pushing it in terms of program size.