Um... is there an easy way to get 5 octaves up?

Started by earthtonesaudio, January 13, 2011, 09:10:45 AM

Previous topic - Next topic

earthtonesaudio

Seriously.  I want to multiply audio by 32, square it up, then feed it into a divider and use weighted resistors to make a new waveshape at the same frequency as the original input.  I don't care about retaining amplitude or phase information, just frequency.

So, is this something I could do with a few ICs or am I looking at a microcontroller project?

[edit] Changed "32" to "5" in subject line.  Just five octaves up is fine!  :)

Mark Hammer

A similar approach is used in the E&MM Harmony Generator.  It uses the input signal to drive a 4046 as an oscillator, which is up several octaves over the original, such that it can be divided down in a strategic way.

http://hammer.ampage.org/files/EMMHarmoGen.PDF

~arph

Yup, use a PLL... you still have the tracking issues at the lower frets though..

Thomeeque

Do you have a technical question? Please don't send private messages, use the FORUM!

earthtonesaudio

Quote from: ~arph on January 13, 2011, 09:19:45 AMYup, use a PLL... you still have the tracking issues at the lower frets though..


Actually I need the x32 frequency within about a period or two of the input, so the PLL is not an option.


Quote from: Thomeeque on January 13, 2011, 09:26:02 AM= 5 octaves up ;)

D'oh!  Thanks.  5 octaves is a lot easier.  :)

~arph

Well, I guess you'll need a DSP chip then. Might look into the FV-1 spin semi. Not sure if that is suitable for this though.
I wish you luck, as you ask for something really complicated  :icon_cool:

R.G.

Quote from: earthtonesaudio on January 13, 2011, 09:53:06 AM
Actually I need the x32 frequency within about a period or two of the input, so the PLL is not an option.
+1, what Arph said.

There are actually three ways I can think of. Of these, the PLL is simplest, the DSP best performance, and an I-Q frequency modulator is what you really want to do.

Unfortunately, only the PLL and DSP are suitable to putting in a pedal of reasonable size. The I-Q frequency modulator could be made to fit, but will have horrible frequency tracking issues because of the analog nature of trying to make it track a frequency in an analog manner. We're talking temperature compensation and tuning with each performance.

Heterodyne techniques could do it, but they suffer even more from the tracking issues than I-Q modulators do.

If a PLL won't do, you've defined yourself into a DSP.
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.

Gurner

I know you're likely after analogue, but due to component count alone, I'd roll with a $1.50 PIC + $5.00 DDS chip?

Square up your signal....bosh it into a PIC's internal comparator, when the comparator triggers, start a PIC timer, when the comparator flips back again, stop your timer, have the PIC do some maths - this yields the incoming frequency, use a PIC look up table to have the PIC serially send  the frequency you're after to a DDS IC.

Easy? Depends on your PIC experience....I'd estimate one night's work if you're already PIC literate (a good few weeks if you're not)

earthtonesaudio

Hm...  I wonder what the frequency resolution would be for a series of 5 XOR R/C doubler stages?  With fixed RC time constants the pulse width is all over the place as input frequency changes, but then again the worst error (in seconds or hertz) will be at the earlier stages.

Johan

...uhm....5 string bassplayer and 80's lead guitar player playing unison?...
...just kidding...sorry...carry on..
DON'T PANIC

amptramp

To get an octave up, you can use fullwave rectifier circuits or squaring circuits.  The fullwave rectifier introduces a lot of extra harmonics, so for a pure sine wave, the squarer circuit works better.  You could put five stages of this in a row to produce five octaves up.  When the input departs from a sine wave, you have to make allowances for the fact that the harmonics are not necessarily given the same octave up treatment, but that may be just as well - they are already higher frequencies.  Each stage could go into a mixer input so you could have a guitar pedal with drawbars like a Hammond organ for the mix of octaves you want.

sin2(w) = (1 - cos 2(w)) / 2

is the trig identity you want where w is an instantaneous angle equal to 2 x pi x f where f is the frequency input.  Because of the constant 1/2 in the output, each stage should be capacitively coupled to the next to remove this DC component.

The MC1496 is your friend.  (With friends like that...)

rousejeremy

Consistency is a worthy adversary

www.jeremyrouse.weebly.com

deadastronaut

https://www.youtube.com/user/100roberthenry
https://deadastronaut.wixsite.com/effects

chasm reverb/tremshifter/faze filter/abductor II delay/timestream reverb/dreamtime delay/skinwalker hi gain dist/black triangle OD/ nano drums/space patrol fuzz//

slacker

I've done the same thing with a PLL and a divider using a similar circuit to the Harmony generator Mark mentioned, R/2R resistor DAC off the divider to get a saw from guitar.

earthtonesaudio

Quote from: slacker on January 13, 2011, 12:42:13 PM
I've done the same thing with a PLL and a divider using a similar circuit to the Harmony generator Mark mentioned, R/2R resistor DAC off the divider to get a saw from guitar.

A resistor DAC is my desired end result.  I'm just interested in a different way of doing the front end.

R.G.

Quote from: earthtonesaudio on January 13, 2011, 10:59:59 AM
Hm...  I wonder what the frequency resolution would be for a series of 5 XOR R/C doubler stages? 

Build it or sim it. That's faster than speculating on a forum

QuoteWith fixed RC time constants the pulse width is all over the place as input frequency changes, but then again the worst error (in seconds or hertz) will be at the earlier stages.
And that's the problem. The big errors in early stages can easily be bigger than the period of the higher stages.

An XOR "doubler" is only a doubler with square waves fed to it. It does a fixed width pulse on each edge. The second stage then generates a shorter pulse for each edge of each pulse the first stage generated. Unless each successive stage has a pulse width that makes the output be a square wave, the following stages do not start from the right place, and the non-harmonically related spectrum partials diverge a lot from the waveform you're trying to build. And since what you need is a pulse for each edge that's half the width of the original waveform, the thing can't track. If you can automagically create a half-time-period pulse to make the one shot put out, then you don't need the rest of the mess to make an octave up.

At the risk of duplication, an XOR "doubler" is only a doubler with square waves fed to it. And if the pulses generated at each edge are not the perfect length, the next stage is off timing, sometimes badly. And the error propagates and increases.

That's not to say that you won't like the result. Just that it's not what you said you wanted and thought you'd be getting.

Build it or sim it.
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.

PRR

Derive the rectangle-wave of your sound's fundamental (IMHO, the hardest part).

Slew/slow the risetime a bit.

Sense the rising edge, bottom and top. Derive two short pulses.

Build a ramp generator. Current-source and capacitor. Scale so your longest period nearly reaches your available (supply) voltage. 1mA and 1uFd will rise to 12V in 0.012 seconds which is nearly your lowest guitar note.

On the next rising edge, first trigger a Sample/Hold to capture the cap voltage, then trigger a reset switch to dump the cap for the next period.

Rig a second ramp generator with identical cap but 32 times the current (32mA {wrong on drawing}). Rig a comparator to sense when this cap has charged to the same voltage as the first ramp generator (as held by the S/H).



This second ramp generator will dump 32 times in the same time as the last period observed by the first ramp generator.

There's NO flywheel effect. If the first ramper glitches (double-count or half-count), the second ramper will obediently jump also.

If the input stops, it will want to follow input hiss/hum. You could offset or Schmitt the input comparator but then it won't follow faint decays.

The 32mA ramper should probably be run at much lower current. You could use 0.031mA and 1mA, or you could scale the caps 1uFd and 31.25nFd. You want total ratio match better than 3%, so you are sure to want a trimmer.

Frankly today I suspect a micro-CPU can do it better, less wear on your protoboard, and you can add smart frills like not hopping frequency for occasional glitches. And never locking to 60/120Hz, nor to the wildly wobbly result of random hiss.
  • SUPPORTER

PRR

> There's NO flywheel effect. If the first ramper glitches

Ah, if the S/H value changes suddenly, you could Do Something. Differentiate the S/H output and if the change is large, period has changed radically from the previous cycle. (This is complicated by the 14:1 range of voltages: less sensitive to higher pitch.) 

You could add another S/H and try to hold the last "valid" measurement, switch to that when the main S/H seems bogus. You could try to maintain a weighted average of recent samples. You could use a vote scheme where the most-out samples are discarded.

The hardware and "hardware programming" can mushroom all over the bench.

You also have the classic problems of analog time (and voltage). Those sample and reset switches must work much-much faster than your period. Your upper rates are 35KHz so common 1MHz comparators and audio S/H chips may lag at high pitch. Such concerns kept us off the streets all through the 1970s and 1980s. Bob Pease made a name in precision V/F/V tricks. Now that CPUs are faster than a typist's fingers and cheaper than Wite-Out, maybe the old ways are not the best ways.
  • SUPPORTER

R.G.

 :icon_biggrin:

You're absolutely correct Paul.  All one needs to do is
- derive the fundamental; yep, probably the hardest part to do well
- derive the time when there is no sound, which is equal to the same (or exact opposite) problem as a good noise gate
- find identical caps within musical pitch tolerance
- do the analog computation in hardware to get 32x frequency
- do all the above so that any errors are less than 1/100 of the twelfth root of two for serious music

I like your comment:
QuoteSuch concerns kept us off the streets all through the 1970s and 1980s.
Again, dead accurate. Doing stuff like this to commercial/functional accuracy is a job for the journeyman EE, or more accurately, one or two geniuses at it (Bob Pease) and a legion of regular guys who like calculus for breakfast.   :icon_lol:

I must have breadboarded several hundred schemes to do may octaves up in the attempt to do fundamental extraction, gating, frequency multiplication, etc. I still have an assortment of scars as reminders of the lessons in precision and stability.  :icon_biggrin:

It reminds me of things like "How do you get to the moon?"
Easy.
1. Get a great big rocket. (note, some special financing arrangements and local licensing work may be needed)
2. Buy a vehicle suitable for maintaining human life in a vacuum for the period of the trip.
3. Find ...

:icon_biggrin:

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.

PRR

> [i[ All one needs to do is   ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... [/i]

I'm just trying to keep Alex busy.

I had first sketched (in snow) 32 level-detectors strung across the Hold cap, so the next ramp would click 32 times on the way up.

That would keep Alex busy a while.

The 32:1 CCS+C ratio saves a LOT of pins.

> errors are less than 1/100 of the twelfth root of two for serious music

Surely we can tolerate several cents error? Only 0.3% or so absolute error.

> find identical caps within musical pitch tolerance

The current-sources may be easily trimmed to accommodate +/-10% caps.

Then there's drift. 32X _is_ a large ratio. 0.3% is a tight error budget. Two caps or two current-sources 32X different are not likely to drift together.

There's two "ramps" in each ramper. A slow up ramp, 1,000V/S and 32,000V/A, and the "reset" which is of course a very-fast ramp. but never infinitely fast, which will tend to mess-up the primary ratios.

The accuracy needed is, existentially, the same as the CPU approach. A CPU counting off a 1KHz or 10KHz clock won't cut it: >semitone error on high notes. I thumb-estymated the clock must be over 1MHz; top-octave generators start from 2MHz to get pitch accuracy. I just re-read the whole TV Typewriter series, when CPUs were 1MHz, and the tricks Don used to sift a 2MHz dot-clock out of CPU main RAM. I guess today's $3 PIC-CPUs can clock 10MHz and have a counter so the main brain is not kept tied-up.

Conversely your analog swings must be faster than 2MHz for musically-low error at 1KHz. (Or you must figure complementary speed-ups that cancel your slow-downs far past 2MHz.) I recall the first modular synths using absurdly expensive or fancy-connected chips and discrete comparators to keep pitch error low. (ARP used a chip cost as much as a week's supply of beer.)

  • SUPPORTER