Multiple pitches from Rocktave?

Started by Taylor, February 08, 2009, 11:18:32 PM

Previous topic - Next topic

Taylor

I was reading the Rocktave document and am especially interested in the ability to get pitches besides octaves. But is there any way to get all of the possible divisions of a note simultaneously from one chip? Here's the schem:

http://hammer.ampage.org/files/rocktave.pdf

oskar

I'll go looking around a bit for more exotic divider chips for you but generally speaking I think not. You can however use some sort of programmable logic or microprocessor to do the job and then... yes. But you need to write the code for it and get it into your chip. Actually the code for this function shouldn't be that hard to do. Just dividing a pulse on one input down and presenting the result on different outputs. That's an excellent beginner project for PIC or AVR programming.

Cliff Schecht

Quote from: oskar on February 08, 2009, 11:45:02 PM
I'll go looking around a bit for more exotic divider chips for you but generally speaking I think not. You can however use some sort of programmable logic or microprocessor to do the job and then... yes. But you need to write the code for it and get it into your chip. Actually the code for this function shouldn't be that hard to do. Just dividing a pulse on one input down and presenting the result on different outputs. That's an excellent beginner project for PIC or AVR programming.

You can always play with sample rate changes as well.

oskar

Cliff. I'm lost here... Picture yourself in kindergarten, trying to explain DIY audio stuff to the kids...
Now suggest something...  ;)  sample what? I picture myself playing with a digitally squared soundwave...
I'm not really a programmer so I find it hard to think outside of my rather limited frame.    ::)

Cliff Schecht

Changing sample rates will give you a shift in pitch as well, unless you compensate for the change in pitch. The Whammy uses this method and it's pretty obvious when you shift down two octaves because you can hear the sample rate reduction pretty bad. Not to hate on the Whammy ;).

snap

Quote from: Taylor on February 08, 2009, 11:18:32 PM
I was reading the Rocktave document and am especially interested in the ability to get pitches besides octaves. But is there any way to get all of the possible divisions of a note simultaneously from one chip? Here's the schem:

http://hammer.ampage.org/files/rocktave.pdf


not from 1 chip alone, but: multiply the squarewave by a 4046 PLL, then divide by some counter.

Mark Hammer

The limitation of the Rocktave is that it divides down the actual fundamental.  You could divide that down in all sorts of ways to yield a chromatic scale, but none of those notes would be in the range of human hearing!  Maybe if you were a worm, but not otherwise...  When the division process is done by means of integers (i.e., count off every 3rd pulse, every 4th, every 7th, etc.), you need to start way high up in order to have your final dividend be in a usable range.

Keep digging around my web-page and you'll find a scanned project for an old E & MM project RG sent me a copy of years ago, called the Harmony Generator.  This will take you part of the way there.  Rather than dividing down the actual note, it locks onto the fundamental, generates a much higher frequency on the basis of that note, and divides that note in order to produce a variety of intervals.  It's not chromatic, but it has a broader range of parallel notes than the Rocktave.  My board is only partially populated, so I can't offer an opinion, but apparently some folks have built it with success.

R.G.

Quote from: Taylor on February 08, 2009, 11:18:32 PM
I was reading the Rocktave document and am especially interested in the ability to get pitches besides octaves. But is there any way to get all of the possible divisions of a note simultaneously from one chip?
There is a way.  :icon_biggrin:

Like many effects circuits, it relies on parts you can't get.  :icon_sad:

A phase locked loop is a circuit that takes in a reference frequency on its input, and adjusts the frequency of its internal oscillator to be locked in phase with the reference. This can only happen if the two frequencies are the same, so you get out of the PLL whatever frequency you put in. A little dull perhaps, but it was originally used for recreating signals buried in noise. But if you put a divider on the output of the PLL's oscillator, the use the divided signal for locking onto the reference signal, the main voltage controlled oscillator (VCO) in the PLL has to run much faster to make the divided signal lock to the reference. So the VCO is the same multiple higher than the reference as the division ratio. Use a 2:1 divider, get 2:1 higher frequency from the VCO.

There existed (note the past tense!) a chip called a Top Octave Divider. The best of these was the MOSTEK 50240. When fed a 2MHz signal, it generated all twelve tones of the tempered scale on twelve output pins. Perhaps more to the point, when fed any frequency on its clock input, it put out twelve divided-down frequencies, all of which were much lower in frequency and which were related in frequency by the twelfth root of two - the relationship of the even tempered scale.

So if you take a 4046 PLL chip, hook it up to a 50240 properly, and feed in a carefully prepared musical note, out come twelve outputs, all even tempered notes related to the input pitch. You can then use any or all of them at the same time to make intervals or chords.

Unfortunately, the 50240 hasn't been made for at least 20, perhaps 30 years. They're rarer than SAD512Ds.

But you could use the circuit of the Harmony Generator you found, and go massively parallel. The harmony generator generates one note at a time, largely because its divider cannot simultaneously generate all those divisor ratios in the proper proportions. What you ...could... do if you were stubb...er, dedicated (!) is to use one CD4046 and one CD4018 per output note, and make as many of the intervals simultaneously as you like. Given that you've properly conditioned the input, each 4046/4018 pair will generate one note at its programmed interval. Sounds complex, but really it's just repetitive: redo the same couple of chips half a dozen time or so.

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.

David

R.G., what about that program the Old Crow wrote that was supposed to do about the same thing as the 50240?

By the way, 50240 chips (or maybe some kind of clone) WERE still available as of two or three years ago.  They are just pricey beyond belief!

Mark Hammer

Yeah, I'll trade you the one I have, and maybe a couple of SSM2040 chips.....for a Gretsch! :icon_lol:

David


Mark Hammer

I'm just kidding.  But you CAN probably expect any of the assorted older out-of-production chips like the Mostek, AMI, SSM, or CEM to command $40-50+.  They can command those prices because there are a number of older keyboards/synths that some folks are very attached to which require those chips to function.   To someone who faces either $50 for an SSM2040 or no working Prophet 5, the choice is simple.  If it was a simple circuit for a DIY project, there are probably workarounds or reasonable subs.  But when the circuit is complex, highly specialized, and not particularly tolerant of stuff just sitting there in kluged or perfed add-ons/adaptors, there is no way out of paying what the vendor commands.

Taylor

A lot of food for thought here. Thanks guys.

scratch

some TOS replacements (equivalents) may be found here, but not cheap.

http://www.organservice.com/crm/topdividers.htm
Denis,
Nothing witty yet ...

R.G.

Quote from: David on February 09, 2009, 11:00:06 AM
R.G., what about that program the Old Crow wrote that was supposed to do about the same thing as the 50240?
Yeah, I was very interested in that one. It actually did three or four octaves down from the top octave, not a real top octave, working from a 4MHz clock on a PIC. And while a PIC is a static part, so the divisors would scale, you'd first have to up-vert the incoming frequency to about 4MHz to get your divider. OC speculated that  you could get a real top octave generator from a PIC if you used one of the 50MHz PICs.

It's not really the same thing. But it points the way to doing something of the kind. I was fascinated by bagpipes at one point, and it occurred to me that you could use the OC scheme to make a bagpipe generator. And you can.  :icon_biggrin: By the way, bagpipes have a scale that's not really the same as other musical instruments, and it's definitely not 12 tone tempered.
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


David

Quote from: R.G. on February 09, 2009, 11:30:21 PM
Quote from: David on February 09, 2009, 11:00:06 AM
R.G., what about that program the Old Crow wrote that was supposed to do about the same thing as the 50240?
Yeah, I was very interested in that one. It actually did three or four octaves down from the top octave, not a real top octave, working from a 4MHz clock on a PIC. And while a PIC is a static part, so the divisors would scale, you'd first have to up-vert the incoming frequency to about 4MHz to get your divider. OC speculated that  you could get a real top octave generator from a PIC if you used one of the 50MHz PICs.

It's not really the same thing. But it points the way to doing something of the kind. I was fascinated by bagpipes at one point, and it occurred to me that you could use the OC scheme to make a bagpipe generator. And you can.  :icon_biggrin: By the way, bagpipes have a scale that's not really the same as other musical instruments, and it's definitely not 12 tone tempered.

Crow used a 16F84 didn't he?  Couldn't one use a 16F648 or 16F877 running at 20MHz and be able to get to the higher octaves?

R.G.

Quote from: David on February 10, 2009, 05:58:19 AM
Crow used a 16F84 didn't he?  Couldn't one use a 16F648 or 16F877 running at 20MHz and be able to get to the higher octaves?
Yes. Maybe.

What he did was set up a timer to go off every X time interval. Well, more exactly, he set a timer to go off every X clocks, which is where all timing starts in a PIC. He then had a code loop that did nothing except look at the timer to see if it went off. When it went off, he branched into a routine that (a) added one to a counter and (b) inverted the state of an output pin if the count was exceeded, then reset the count. He did A and B for each of the 12 tones, then went back to the main loop to wait for the timer again. The set of adding and updating pins and counters was counted instruction by instruction to ensure that even if the longest code path was taken, the code would finish updating before the counter ticked again.

I guess a better way to say that is he designed the update sequence, counted instructions for the longest path in the update, then set the timer to the nearest value it could tick which was longer than the code path. That guarantees that you can always finish the update of all 12 notes and never miss a timer update.

Works for the uC. However, the note accuracy is then an issue. The MOSTEK MK50240 was simply a clock feeding twelve specially-set-up digital counters. The largest error in a note frequency was potentially one tick of the nominally 2MHz clock, or 500nS if they did the counters right. The PIC implementation was not fast enough to do that, as the main loop was tens of instructions, each of which was four clocks. So the outputs were a cruder approximation to a musical note.

Musical notes are appallingly demanding of frequency accuracy. A "cent" is a hundredth of a note interval. People can hear inaccuracies of 2-3 cents easily, and many trained people - i.e. many musicians! - can hear half a cent. A few have perfect pitch and can hear closer than half a cent. If you can't get under 2-3 cents in accuracy with a top octave generator, it's worthless.

The trick in octave generation accuracy is then to figure out the allowable error budget in terms of time, then make the actual error based on your dividers be less than the error budget.

Here are the musical pitches based on A=440: http://www.nationmaster.com/encyclopedia/Scientific-pitch-notation As you can see, the ninth octave, C9 through B9, gets you to a frequency of 15804 Hz. An error of one cent is 1/100th of the twelfth root of two, and that difference applied to the top note frequency is the smallest tolerable error ( just picking one cent for an allowable error).

The twelfth root of two is 1.059463..., and the twelve-hundredth root of two (one cent) is 1.00057779... so the error for one cent on B9 is 63.238uS on the top side and 63.311uS on the bottom. Call it 63uS. You need a uC fast enough to run through the longest code sequence on your uC of either
========
- subtract one
- branch if not zero (that is, if the counter for this note has elapsed;)
- set counter back to max
- toggle pin
===or===
- subtract one
- branch if not zero to next counter section
==next counter==

and do that twelve times in succession, and branch back to your wait loop, as well as running the first test in your wait loop before 63uS can have passed. The 16F84 with a 4MHz clock executes one instruction every 1uS, so you only get 63 instructions. That's not enough to service the loop at the top octave.

Using an atmel with one instruction per clock helps, as does using one of the 20 MHz or 50MHz PICs or other uCs.

I guess I ought to write up the code. It's really simple stuff, not even isochronous. I just never needed a top octave generator enough to use the 50240 I have (bought at Radio Shack, in better times for RS) let alone flog the code for a new one.

If the uC was static (i.e. can use clocks all the way to zero) you could give it a variable clock and have it track a PLL-up-ed note, but I wonder if that wouldn't periodically let the uC reset and run through initialization again sometimes.

It was a fun exercise, and I did get a hand-noted bagpipe generator out of it...  :icon_lol:
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.

R.G.

ARGH!!! Who started this?!?

Now I've got top octave generator on the brain and it won't go away.

This is hard to do. To generate ONE note with a 12F609 PIC running at 20MHZ to a very close accuracy, you have available 158 instructions to toggle one output pin to make half of a 15804Hz B9 note, and an error of one instruction possible. Maybe. Get it right and the note is 316 200nS instructions and a resulting note of 15822hz. That's an error of 2 cents if your loop is 158 instructions exactly. Not really good enough.

Bummer. The 12F609 is a $1 part.
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.

David

Quote from: R.G. on February 10, 2009, 09:14:00 AM
ARGH!!! Who started this?!?

Now I've got top octave generator on the brain and it won't go away.

This is hard to do. To generate ONE note with a 12F609 PIC running at 20MHZ to a very close accuracy, you have available 158 instructions to toggle one output pin to make half of a 15804Hz B9 note, and an error of one instruction possible. Maybe. Get it right and the note is 316 200nS instructions and a resulting note of 15822hz. That's an error of 2 cents if your loop is 158 instructions exactly. Not really good enough.

Bummer. The 12F609 is a $1 part.


Well, Taylor started it.  I guess if you need to blame someone for the TOG-itis, though, you'll have to blame me!   :icon_twisted: :icon_mrgreen: :icon_biggrin: :icon_cool:
I'm the one who's been sloshing fuel on the fire.  Here's some more:  Remember when the Crow mentioned some Scenix chip in the doco for his TOG?  Would that fit into this conundrum somewhere?