The top octave generator chip was a handy device back in the 70s. Feed in 2MHz, take out one frequency corresponding to each frequency of the highest octave of the even-tempered musical scale. Most early organs used these, then a string of dividers. Once you have the top octave, seven stages of division gets you eight full octaves of the musical scale as discrete outputs.
TOGs were a custom logic widget, and they went the way of the dodo.
However, we now have microprocessors, right? Alls you gots to do is program a uC to make the top octave, right? Not necessarily. The real time constraints make this very hard to do, even with today's blowtorch processors, because the differences between the frequencies matter, not the absolute frequencies so much, and the human ear picks out little frequency problems.
I was pondering this - don't ask! :icon_biggrin: - and it occurred to me that even if I did succeed in getting a uC to make the top octave, I still needed 12 divider chips to get the divided octaves, one chip per note.
If instead, I used the insides of the uC to make ONE note of the top octave, I never get into the problems with real-time counting of multiple notes, and after that, dividers are just binary counting, which controllers do very quickly. So instead of a top octave generator, you do a note generator. One chip, all of the Cs, the next all of the Dbs, the next all of the Ds, etc. You have to do twelve uCs, but you save twelve divider chips and one really really tricky programming problem in making the TOG, which you also don't need. The program inside each uC is different by exactly one constant, the divider from the clock to the top frequency.
A uC that will do this - I think - costs $1.29 in ones. We'll see. :icon_biggrin:
Why is it I get something wierd in my hands (tonight I brought home a Casio keyboard to fix the power jack) and you pop up some irrelevantly relevant post? Keys, synths... and I have a craptastic Casio in hand, lol. It's a Casio CT 360 that apparently uses Pulse Code Modulation. I really don't know if it's even close in comparison to what you are talking about... just thought it was ironic. :icon_biggrin:
RG,
this is an interesting approach: a uC for each note. THEN use dividors for octaves.
Actually, U could probably do ALL the octaves with the ONE uC! U'd have the extra pins.
But, a uC for EACH note would be great if U were going to build a many-key (note) system.
long ago, I was able to duplicate the TOG that "old crow" did with an obsolete PIC (a "C" series).
I used a 16F84 at the time and was able to make it function with only machine code programming.
I was thinking of one uC for black notes and one uC for white notes.
this was to lessen the calculations needed for real time output even using a 20MHz xtal.
Never got around to doing anything with it..it was just a challenge to myself at the time.
Don't know where U would be going with this 1-uP-per-note idea??
roland has so much stuff with their synth-engines, that it seems pointless to try to duplicate.
EH's POG is a killer bank-4-the-buck approach if U don't want to go hexaphonic.
Behringer has a $40 pitchshifter that goes 2octaves UP and 2octaves DOWN!
What would be your application?
Just wondering.......
8)
There was a PAIA project from way back called the Chord EGG (Encephalo Gratification Generator). It used a TOG to generate several notes which it faded in and out at random while sweeping a mild band pass filter across the left and right channels. I had the bug to build this when I first started this DIY stuff. I found a TOG at an Organ repair place online. I printed a PNP and ironed it on a black copper board. In the end I never etched the size of the project was daunting.
I remember when I was looking for the the TOG chip, which was hard to find, I ran across some info on using a PIC as a replacement.
All of this had to have been ten years ago.
http://www.paia.com/talk/viewtopic.php?f=9&t=118 (http://www.paia.com/talk/viewtopic.php?f=9&t=118)
http://m.matrixsynth.com/2008/03/paia-oddity-3790-eeg.html (http://m.matrixsynth.com/2008/03/paia-oddity-3790-eeg.html)
If bringing a uC into the mix, why have it only generate the top octave? (as this method would still require a lot of 'dividing down' hw)
Why not just have the uC generate the actual required note itself? (no matter which octave) - the amount of polyphony required would then dictate the number of uCs needed.
You could also do an electronic emulation of the Hammond tone wheel chain - use a top note generator and do a 185/196 division eleven times to get the top octave, then just use a divide by two chain for each note. You can use a buttload of 74HC161's with some other logic. It might not be the cheapest way, but it would be impressive.
Quote from: toneman on September 07, 2011, 12:48:11 AM
Actually, U could probably do ALL the octaves with the ONE uC! U'd have the extra pins.
Actually, that's what I meant but used too many words to say, here:
Quoteand after that, dividers are just binary counting, which controllers do very quickly. So instead of a top octave generator, you do a note generator. One chip, all of the Cs, the next all of the Dbs, the next all of the Ds, etc. You have to do twelve uCs, but you save twelve divider chips
The real work of making a high accuracy note is done in the timing loop. After that, you use an eight-bit word incremented by one every timing loop, and put the word out on pins. The individual bits are exactly the same as the outputs from a divider chain - which is what they are.
One uC generates the top note and all the lower octaves as outputs on the other pins.
Quotelong ago, I was able to duplicate the TOG that "old crow" did with an obsolete PIC (a "C" series).
I used a 16F84 at the time and was able to make it function with only machine code programming.
I was thinking of one uC for black notes and one uC for white notes.
this was to lessen the calculations needed for real time output even using a 20MHz xtal.
Never got around to doing anything with it..it was just a challenge to myself at the time.
I liked that setup. Messed with the code a bit, but never did much with it either.
Quote
Don't know where U would be going with this 1-uP-per-note idea??
...
What would be your application?
If I told you, I'd have to kill you.
:icon_lol:
As it goes, I've been dabbling in DDS myself over the past fortnight....my initial gut feeling is that low end (8 bit MCUs) are only good for about 5khz (even clocked with an instruction clock of 8Mhz+)
Quote from: R.G. on September 07, 2011, 11:09:05 AM
The real work of making a high accuracy note is done in the timing loop. After that, you use an eight-bit word incremented by one every timing loop, and put the word out on pins. The individual bits are exactly the same as the outputs from a divider chain - which is what they are.
I'm figuring you mean 16 bit word - this yields an 'accumulator' with the maximum number of values of 65536.
Re resolution/granularity (or what we're worried about - accuracy), that's a function of 'sample frequency/accumulator', therefore assume a sample frequency of 40khz, you get 40,000/65536 or resolution to 0.61hz ...good, but not
quite there.
To get more granularity (accuracy), we need to increase the accumulator (to say 24 bits) or decrease the sample frequency - I reckon the the former is the way to go but then you start getting into complicated coding on 8 bit MCUs!
Quote from: Gurner on September 07, 2011, 11:32:04 AM
As it goes, I've been dabbling in DDS myself over the past fortnight....my initial gut feeling is that low end (8 bit MCUs) are only good for about 5khz (even clocked with an instruction clock of 8Mhz+)
You may be right, although I have seen applications that claim usable sines in the 100s of kHz for 8-bit devices in DDS.
I wasn't thinking of doing DDS. This is purely to turn out a square wave output at the required frequencies, and specifically at as close to the even tempered scale as possible with hard-locked timing. Once you generate all the possible even tempered scale notes, you can generate other waveforms from that, including by phase locking a sine-output VCO to it, by shift register techniques, other ways, if that's what you were trying to do.
Quote from: R.G. on September 07, 2011, 11:41:55 AM
I wasn't thinking of doing DDS. This is purely to turn out a square wave output at the required frequencies, and specifically at as close to the even tempered scale as possible with hard-locked timing.
Aaah ok, IMHO you should be able to go much higher in frequency than 5khz (& with incredible accuracy)
I think so. I was hoping to get the real top octave, between 10kHz and 20 kHz. The A in that octave is 14,080Hz, so the next frequencies are
- 14917.2
- 15804.3
- 16744
- 17739.7
- 18794.5
- 19912.1
Probably these aren't all that useful, because real human ears can't usually go up that high after age 20 or so. But hey, maybe someone.
So if you want a top frequency of 20khz, then I reckon a 40khz interrupt (sample) rate would be needed.
Assuming a 16 bit accumulator and a required frequency of 14.8khz...
14,800/40000 * 65536 means 24248 would be the amount you add to the accumulator every interrupt, which should yield a square wave of 14799.8046875Hz which in percentage terms is a miniscule error
Using such a method, you lose the accuracy (in percentage terms) at the lower end of the audio frequency band, for example a required frequency of 50Hz...
50/40000 * 65536 = a value of 81 to be added to the accumulator which yields a frequency of 49.43Hz (i.e. about 1% error)
Someone did a one chip per note and then divide with CMOS over on the electro-music forums http://electro-music.com/forum/viewtopic.php?t=45583&start=0&postdays=0&postorder=asc&highlight=top+octave (http://electro-music.com/forum/viewtopic.php?t=45583&start=0&postdays=0&postorder=asc&highlight=top+octave). His method of generating the notes was pretty neat. I don't know if there's anything in there that might be useful to doing it with uCs.
Two oscillators per puC (PIC) here, and divided down...
http://picsynth.000space.com/schematic.html
...quite a neat implementation.
> a uC to make the top octave, I still needed 12 divider chips to get the divided octaves, one chip per note.
Any way you slice, it takes 50 to 100 output pins.
Since you only get 8 to 13 useful pins on compact packages, you need 4 to 12 chips. Maybe fewer larger chips, but even a 80286 CPU only had 68 pins. PIC16F8877A is 40 pins, unless my eyes crossed, and seems to be no-stock. Parallax SX comes up to 48 pins and 75MHz clock, but seems to be end-of-life.
There's a cascade divider, CD4040, which will take your high A and give all the lower As, for like 29 cents. Therefore it seems sweet to have your one special chip just do the 12 high-octave notes, and fan-out with 4040s. Which is how it was done.
It seems you want individual PICs for A A# B C C# D D# ... G#? Now you have twelve unique parts. All the same chip but 12 programs to maintain. Sure, they differ in only one byte (the divider), but any code changes must be copied to 11 more files with new revision number, you need 12 separate code-flashings, you need 12 bins and 12 little stickers so the right parts go in the bag and into the right socket.
Ah, you could use one code-base which at power-up examines its pins and becomes A A# B etc depending how socket pins are pulled up/down. So the note assignment is in the socket/PCB not the chip. It's still twelve $3 PICs at $36 instead of one $3 PIC and twelve $0.29 divider strings for $7.
Additional wish-list items (for someone else; I haven't touched a TO in decades):
The tuning is close, but not perfect equal-temper, and has become stereotypical of new-age synths/organs of the late 1970s. We need that sound, but perhaps also another with different error so it does not sound like all the others.
The minimum error is related to the 2MHz top rate, a compromise with cost of 1970s logic and low-volume production. A 20MHz clock could make errors inaudible.
Equal-temper is just an ugly thing. There's 9,876 other tunings (I saw a list somewhere), a few dozen which are better for some things (worse for others). One interesting tuning is to set the Thirds perfect (instead of ET's dissonance), to go along with overdriven amps and their Perfect Third distortions. Of course this means a higher level of user-interfacing than a simple TO chip needs.
A wild approach: you only got 10 fingers. Input the key-presses, derive _just_ those notes (with overtones), and output.
Yeah, I've been through all those approaches many, many times. The top octave generator is the clear winner - but there doesn't seem to be any good way to do it with acceptable accuracy without really, really high speed uCs. 20MHz is probably minimum. It's a tough programming problem to run all 12 dividers in parallel and address the issue of latency to handle all the results. The time spent changing an output then calculating the next state of all 12 and getting an output updated when they may all change at once gets out of hand. Been there.
The only way I could think of to solve it without sheer brute force clock speed was to program all the adders in vertical counters so all bits changed (effectively) simultaneously.
However, using hardware to sidestep a programming problem seems justified, especially when it requires less raw speed than doing the difficult problem.
Quote from: PRR on September 09, 2011, 09:19:10 PM
Any way you slice, it takes 50 to 100 output pins.
Yep.
QuoteThere's a cascade divider, CD4040, which will take your high A and give all the lower As, for like 29 cents. Therefore it seems sweet to have your one special chip just do the 12 high-octave notes, and fan-out with 4040s. Which is how it was done.
Yep. Actually, I like the CD4024 for that job. It's a 7-stage, and is a little easier to find (or was last I looked) than the 4040, which is a 12 stage. It is a sweet idea to have one top chip and 12 dividers - if you can get that top chip. The top octave chip can be had for $35-$50 today.
Quote
It seems you want individual PICs for A A# B C C# D D# ... G#? Now you have twelve unique parts. All the same chip but 12 programs to maintain. Sure, they differ in only one byte (the divider), but any code changes must be copied to 11 more files with new revision number, you need 12 separate code-flashings, you need 12 bins and 12 little stickers so the right parts go in the bag and into the right socket.
Yep. That is what I was proposing as a sidestep to the unavailability of the TOG.
QuoteAh, you could use one code-base which at power-up examines its pins and becomes A A# B etc depending how socket pins are pulled up/down.
Yep. :icon_biggrin:
I could also put programming pins on the board and make the one in the "A" socket be an "A". :icon_biggrin:
QuoteIt's still twelve $3 PICs at $36 instead of one $3 PIC and twelve $0.29 divider strings for $7.
Now we're getting to the rub. The PIC I thought I'd use to do one note and divide it eight times with eight outputs is a $0.75 PIC, $1.29 in units at Mouser. Well *a* PIC that will do it. I didn't try to minimize total dollars; I was solving the tough real time programming problem.
But looking things up now, I find I can get a 20MHZ PIC 16F54 that would do the simple countdown and octaves for $0.66 in ones. I was going to use another one, but the F54 will do. That's 7.92 for logic. A 32MHz PIC that might do the top octave job is $1.48, which is much lower than two years ago when I first touched the problem. And CMOS is now going up in cost. Mouser wants $0.48 for a CD4024 and $0.52 for a CD4040. A PIC + dividers system is one high speed PIC and twelve dividers, for a total of 12* $0.50 + $1.48 = $7.48
They actually come in very nearly the same cost. I hadn't expected that.
QuoteThe tuning is close, but not perfect equal-temper, and has become stereotypical of new-age synths/organs of the late 1970s. We need that sound, but perhaps also another with different error so it does not sound like all the others.
I like the program-on-board approach. You can make the dividers be any temperament you like. Another PIC also lets you have it do the on-board programming of all the note PICs, and get any temperament you like.
QuoteThe minimum error is related to the 2MHz top rate, a compromise with cost of 1970s logic and low-volume production. A 20MHz clock could make errors inaudible.
It turns out that 2MHZ is OK for hard logic dividers doing equal temperament. It is much harder to do the job in a program instead of hard logic dividers. I have not finished the programming, obviously, but a 20MHZ PIC is likely to just barely able to generate the same top octave that a 2MHz hard logic divider TOG does.
I looked into gate arrays and FPGAs, but that's a mess.
Don´t waste your time, this has already been done with a pic ages ago:
http://www.picbasic.co.uk/forum/showthread.php?t=11484&page=1
http://www.dutchforce.com/~eforum/index.php?s=5d02ddf66e923bb79f6379999837cd28&&act=ST&f=1&t=35897
And the CD4024 was used in several synths/organs as a divider (instead of the more expensive SAJ110).
analogguru
Quote from: analogguru on September 10, 2011, 04:49:59 AM
Don´t waste your time, this has already been done with a pic ages ago:
http://www.picbasic.co.uk/forum/showthread.php?t=11484&page=1
http://www.dutchforce.com/~eforum/index.php?s=5d02ddf66e923bb79f6379999837cd28&&act=ST&f=1&t=35897
And the CD4024 was used in several synths/organs as a divider (instead of the more expensive SAJ110).
analogguru
But that program puts out middle C as its highest note, so about 6 octaves too low, right? ??? But perhaps it will work for RG's mysterious app (I'll let some one else post the photo of the flower blooming :icon_lol: ).
Yep, I'm very familiar with that particular piece of code. It is done with a 16MHz PIC, and as Taylor notes, is several octaves too low to be a top octave. It also has some accuracy limitations.
I think I first saw that some years ago. The approach used in that code is to subdefine timer intervals which are counted to get to the note frequencies. The timer intervals are what get counted, and in turn are the limiting factor on either accuracy or the octave you generate, depending on your approach.
Getting to a real top octave requires a much faster processor. Four octaves up from that is really what you need for a top octave. Using that same code gets you to the nominal top octave at 64MHz for the PIC architecture. Other uC architectures with 1 instruction per clock cycle architectures may get the same performance at 16-20MHz, but also may not get you the reliable number of instructions per cycle of the PIC.
Thanks, but I've been there, and it helps define the problem, not the solution.
The approach of doing one note per PIC does two things: (1) it makes the programming simpler because you only have to count one interval and (2) it raises the frequency of the accurate note you can generate.
Quote from: Taylor on September 10, 2011, 07:13:53 AM
But that program puts out middle C as its highest note, so about 6 octaves too low, right? ??? But perhaps it will work for RG's mysterious app (I'll let some one else post the photo of the flower blooming :icon_lol: ).
My flower bloomed so long ago that it's already wilted. :icon_biggrin: Besides, having been burned on the net a few times, if I were doing a start up, you wouldn't read about it here. :icon_lol:
any guitar related suggestions for putting a tda1008 to good use?
Quite some time ago, I acquired a Minshall Model E organ which had 36 x 12AU7's as top octave oscillators and dividers. This was very critical for adjustment and component drift, so I replaced the tone generator chassis with a single board using 12 Fairchild µA2240PC oscillator-divider chips. The oscillator is like a 555 connected internally as an astable and the dividers were open collector. A lot of ribbon cable was consumed, but it worked.
Hi
my 2c worth..
I'm guessing that it wouldn't matter if you used A (3.5kHz) through A (7 kHz) for the top octave.
People only imagine they can hear much over 10kHz. The TV whistles at 14kHz - can any of us hear that?
For me the TV whistle disappeared 22 November 1975. Deep Purple took it away. ;D
cheers
Quote from: brett on September 11, 2011, 11:46:11 PMThe TV whistles at 14kHz - can any of us hear that?
Yes, I can always tell when a CRT TV is on in the area just by hearing it. Then again, my ears didn't exist until well after 1975. :D
...and I don't consider myself a golden ear type. My friend who plays guitar is always gawking at different clean guitar tones in music, but to me they're all nearly indistinguishable. (Ready the torches!)
I'm with you Taylor, I hear CRT's in the back of my head for some reason. Perhaps it's a resonance issue. Either way, I have only one good ear, the other is a casualty of a car accident when I was 4yrs old. My right ear only hears very high frequencies for some reason, again most likely a skull resonance issue, because I'm missing some inner ear bones.
Anyway, back on topic, I have a mutlitude of uses for a top-octave generator, but primarily i'd use it to make a workalike of a Roland RS string synth (PARAPHONIC!).
I think that generating each note using a single pic, then dividing down each octave is the way to go for sure.
I know SMT is generally frowned upon, but CPLDs are probably a competitive option here (generally QFP packaging). RG, I don't know your intentions with this project in general, but the CPLD side is certainly better suited for making lots of these, and thats where it would lose against general DIY. But I will still give my reasons:
Pros:
1. Space saving. Eg. Altera EPM3064 = 44QFP (maybe x2, depending on the counter constraints) vs the ~12 DIP14-16, ouch
2. You're already pre-programming the microcontroller, so you're probably going to be OK with having to pre-program an EEPROM which includes the CPLD program/ glue logic.
3. The glue logic is straight forward to code (counters are usually the text book examples), and the development tools are usually free (Altera web edition, etc).
4. Cost: hopefully will stay under the 'pros' section. EPM3064 (slowest speed grade, lowest temperature) = $2.10 x1. Lets call power and EEPROM memory $2, then a single CPLD implementation = $4.10, and a double (this is the one to beat, totally based on the logic requirements) = $6.10 (also assuming a single EEPROM can handle loading two CPLDs).
And of course, cons:
1. Power: limited to 3.3V in most cases. But you can probably scoot by with an LDO since the PIC will require 5V (max) anyway.
2. SMT assembly, oh well.
3. Some CPLDs are only available directly from the manufacturer (Eg. EPM3064 in my example).
4. Complexity: an extra code environment
And it seems like some other contenders are thinking along the same lines:
http://m.matrixsynth.com/2009/01/top-octave-generator-11.html
Please also note that i have no affiliation with Altera, but i use them all the time. Xilinx also has a great offering of PLDs.
I messed with that approach for a while. I decided it was a PITA, given where I am with the PLD technologies.
It would be Really Good if someone did the internal dividers to get a top octave, then also the chains of binary dividers to get all the notes out in a QFP so that other glue chips and such were not needed, and so the internals were substantially or fully static so one could play vibrato/slide games with the master system clock. Even better yet if one could use internal PLLs to give some looseness from the main clock and perhaps modulate the relative frequencies of the note-strings a bit for adding some complexity to the scale. I thumbnailed a design a few years back but I'm so inept with PLDs that I have no idea if it was feasible or junk.
What I wanted was an MK50240 and some dividers. I wound up at single-note-and-divider PICs because of cheapness and simple programming. Actually, this is kind of an advantage, because PICs are fully static, and you can monkey with their clock inputs within reason.
Before everyone goes off to design his own generators and dividers, consider that most musical instruments do not have precise harmonic relations between the components of the frequency spectrum they put out. If you play an acoustic guitar with a 300 Hz fundamental, the next component up (they are sometimes called partials to distinguish them from integer multiples of frequency, which are harmonics) is 595.4 Hz then 897 Hz then 1198.1 Hz then 1500.0 Hz. In other words, the partials are at 1.985, 2.99, 3.994, 5.000 times the fundamental. The deviation from exact multiples is part of the timbre of the instrument. If you use exact harmonics from a divider, the output will sound like a Lowrey organ - not a particulary great sound. You can see this sort of thing on a scope where waveform components seem to be running past each other in a real instrument whereas with integer division, everything is in lockstep.
For those of you with a library of obscure electronics applications books, check out the "Systems Design Handbook" by Monolithic Memories incorporated. They show a "High-Quality Musical Sound Generator" as one of their articles which is an arithmetic processor to generate musical instrument voicing. They explain in detail why the partials must remain inharmonic.
Yep, the inharmonicity of partials is part of the instrument timbre. For a good example, listen to some mbira music. The thick reeds start with fairly far-off harmonics, which quickly decay, leaving a smoother sounding fundamental. Most lamellophones do the same thing.
However, organs have done fairly well with top-note or top-octave and locked dividers for harmonics. And synthesizers have done OK with waveform generation as a basis. A triangle, sawtooth, or square wave just can't have partials that are off from the mathematically-expected frequencies. Mother Nature said so. And exact harmonics won't sound like a Lowrey organ, it'll sound like all electronic organs. I've just been re-reading "Electronic Musical Instruments" by Richard Dorf, so I have some fresh review of Lowrey versus Baldwin, Thomas, Schober, Allen, Rogers, et. al. Lowrey's distinct sound is more a matter of its tone shaping than the divider nature of the thing.
A fair amount of the Hammond sound was its additive synthesis approach to harmonics.
Looks like i mis-spoke about the EPM3064 using an external EEPROM. This device comes from the MAX3000 family which ARE EEPROM based, and you can only load them through a JTAG programmer (much like the PICs). You can socket them, but it makes more sense to put down a header and do in-circuit programming. So if you're willing to invest in the programmer, this particular device family is very cost effective: my estimate from before would drop to $3 - $5.
Now, there are devices that can utilize an external EEPROM to load their configurations, and this is useful because you can socket the EEPROM and use your existing PICKIT to burn it. Unfortunately, the CPLD devices that support this are more expensive (Altera ones start at $6).
Can you specify the dividers and I/O? Knowing that, along with the loading method is enough to know if a CPLD is worth it or not. If so then i'd be happy to code the dividers (thats the easy part).
Interesting. For me, my vast lack of knowledge about current PLDs makes the coding the hard part for me.
I'll have to think about the most convenient way to do programming and the physical setup of how to get the signals into and out of the chip.
Here's the overview:
- a master clock input; actually, twelve clock inputs that can be ganged to one clock or separated would be really good as an enhancement
- divider chains; the MK50240 "9-bit magic series" is the place to start; that's divide by 239, 253, 268, 284, 301, 319, 338, 358, 379, 402, 426, 451, 478
- each divider chain brought out to an output pin
- for each divider output, a string of seven binary dividers doing a simple binary countdown, with each divider output brought out to a pin
- That makes for 12*8 output pins, 96 total; one (better, 12) clock input pins, then power(s) and ground(s); then programming pins as needed. Looks like 144pin QFP would do the whole thing.
- Next choice down: limit pins by backing down on the divider chains' length. The master divider chains give you one top octave. One divider on each one of them gives you 12 notes of the next octave down. Another divider gives you a third octave down, and so on.
Is there a simple way (and I'll go look it up as well) to implement the JTAG programming in a PIC that can itself accept a serial input via USB, 232, I2C, etc. and have a default programming stored for autonomous bring up and then also external programming of the mule?
Heh, in all of this, i was aiming on stuffing all of your "simple binary countdown" in the PLD. The odd-ball dividers definitely won't fit in a single, but maybe 2x the PLD i'm talking about.
Were you originally aiming to satisfy the divider chains with all CD4024/ CD4040? Or am i completely missing something?
There is a simple way to load the PLD with a PIC, but not with the one you selected (gotta have the resources). Altera has something called a JAM player, which is general purpose embedded driver meant for controllers loading peripherals. The JBI (JAM byte interpreter) has a ~14kb flash foot print, and takes about 4kb RAM to work.
https://www.altera.com/download/programming/jam/jam-index.jsp
This is usually why the header to external USB/232/etc - JATG converters are used the most.
Quote from: rustypinto on September 14, 2011, 10:17:16 AM
Heh, in all of this, i was aiming on stuffing all of your "simple binary countdown" in the PLD. The odd-ball dividers definitely won't fit in a single, but maybe 2x the PLD i'm talking about.
Given the ease of getting binary dividers, I'd vastly prefer to have all the oddball dividers into a single if that's possible. This is in fact the thing that made me abandon the PLD thing - I could not get all of the top octave into a single PLD. It seemed to be a poorer choice to me to go to a high-pin-count SMD package if I still couldn't get all the funny stuff into one fancy package.
Is there a PLD package you're familiar with which can get all the top octave dividers into one package?
This is the crux of the issue for going to single-note PICs: pins! If I have to have a dozen divider chips at 14-16 pins each, I may as well make those PICs, each doing the oddball divider for one note and all the binary/octave divides, and eliminate the top octave chip all together. If I can get the top octave plus all the dividers into one PLD, a single chip solution is attractive enough to go to a QFP.
QuoteWere you originally aiming to satisfy the divider chains with all CD4024/ CD4040? Or am i completely missing something?
No, I wasn't. I only mentioned the partitioning into other external dividers so that if needed, the logic in the PLD could all get into one package by pushing dividers out of the QFP onto external stuff, in the aim of getting all the complex stuff into one QFP.
That was my reasoning - however odd it may seem. It was logic design directed by ease of assembly. :icon_biggrin:
I did some more thinking. Looks like the 16F54 will handily do a single note divider from 8 or 16MHz to a top octave note, and also put out eight octaves of that note. The 16F54 is $0.66 each in ones from Mouser at today's prices. Since you need 12 of them you get the price break of $0.55 each for quantities over 10, so the whole dozen notes and eight octaves is $6.60. A CD4040 or CD4024 is $0.48 in ones, and the price break is at 25, so 12 of them cost you $5.76, and you still have to generate the top octave.
The 16F54 also has enough pins left to sense what note it's supposed to be from where it is in the PCB and what pins are connected, so the same program will be any of the twelve notes.
The oscillator is a PITA. You need a dozen 16MHz clocks, and it's very tempting to try to make one of the 16F54s do it and feed the others. That is not a good idea. You can either buy a dozen 16MHz crystals at $0.30 each ($3.60) or one 16MHz and one other chip to do the oscillation, or an oscillator module. The oscillator module is $1.60, and probably more reliable at the job than rolling your own.
Looks like the whole mess is 12 PICS, a clock oscillator module, and about 96 wires :icon_eek: off that board to be the actual notes.
Hmm, that's not the satisfyingly simple solution I was hoping for R.G!
Quote from: Jaicen_solo on September 18, 2011, 08:52:07 AM
Hmm, that's not the satisfyingly simple solution I was hoping for R.G!
Me neither - but it is a solution that can be had. A complicated, expensive bird in the hand is worth about 50 rare, delicate, perfect birds on the other side of the planet, or on another planet altogether. :icon_lol:
One other thing about PICs - they are fully static, so you can play the same games with messing with clock frequency that you could with the MK50240. If you fed the 50240 1MHz, you got one octave lower than the top one; 500kHz, two octaves lower, and so on. You could get the specific octave you wanted by lowering the clock.
Likewise, the PIC solution does the same thing. If you feed it a variable clock frequency, its outputs obligingly go lower. If you want a specific octave, you still have to use all 12 chips to get a full octave, but you only need 12 wires going off the board.
Hey guys,
I successfully ported over the PIC16c54 code to a PIC18F18k23 which can run at 64Mhz! Which gives you a top octave of 1041.68 Hz using the standard code. It sounds in tune to me (well maybe a little off, it is hard to tell). I have been trying to tweak the code to get a top octave of 2093Hz by playing with the pre-scaler and counter numbers. But I can't seem to dial it in. I am about ready to throw in the towel on using the PIC. Another idea is to use 2 hex Scmitt triggers. Each oscillator uses 1cap and 1 resistor, but replace the resistor with a digital pot controlled by a PIC. Allthough the combined cost of the digital pots might make it a better idea to just buy a real TOS for $40.
Quote from: igor12 on November 11, 2012, 12:34:25 PM
I am about ready to throw in the towel on using the PIC.
As I said, using several small
PICs for one or two notes per PIC is probably simpler and more practical than using
the PIC for all of them.
This is a kind of parallel to how CPU development is going these days. Getting ever-higher clock speeds for uniprocessors stalled out at about 3-4GHz. So we're getting higher computational performance by using several CPUs in tandem, each doing part of the job.
You could build a replica of the Hammond tone wheel generator using a phase-locked loop (PLL) and a divider network that does 185/196. This gives you a close approximation to the twelfth root of two frequency ratio between adjacent notes. You may be able to do a divider network in a PLD, so you would have eleven of them (a generator for key of A at 7040 Hz and everything else derived from that). The A generator would probably be a phase-locked loop running from a master 1 MHz crystal. You would have simple dividers each running 4046 PLL's for a top octave. A pair of 8-bit divider chains is a relatively simple task for a small PLD.
I was thinking about this, and what about doubling instead of dividing? Would that be simpler than using a divider chip? Looking at a triangle wave, if you full-wave rectify it, it will double the frequency without distorting it much. Setting an oscillator for a lower frequency and doubling it for each next octave seems like it might be simpler.
> doubling it for each next octave
One way or another, the octaves are easy.
The Top Octave Chip did the hard part: the 12 semi-tones, each twelfth-root-of-two apart(*).
Twelfth-root-of-two is a very hard number to compute 11 times in 500 microseconds (1/2000th of a second, period of a high note).
Hmmmm... I suppose that computing 2^(1/12) at 32Hz, then doubling-up, does lessen the computational frenzy. But making triangles and rectfying them is a lot trickier to do 76 times than just using 12 hex-flop counter chips.
(*) Or close-enough that the errors were mostly unnoticed.
> divider network that does 185/196.
Does anybody remember the Rate Multiplier?
Apparently TI still does. (http://www.ti.com/paramsearch/docs/parametricsearch.tsp?familyId=300&family=logic&uiTemplateId=SZVI_T)
Good old-old CD4089 is 4-bit, not enough. It's stackable, and at $0.18 for PDIP you can't whine about cost, but pin-wiring labor would be a chore.
SN7497 is 6-bit cascadable. Still not enough for the Hammond approximation (http://www.diystompboxes.com/smfforum/index.php?topic=93636.msg877737#msg877737).
Quote from: PRR on November 16, 2012, 01:41:21 AM
Does anybody remember the Rate Multiplier?
Yes, I always thought that name was hugely misleading.. as it divides.
The rate multiplier provides some oddball waveforms depending on the ratio in use. It may or may not be usable. But I do remember avoiding it.
Quote from: WaveshapeIllusions on November 15, 2012, 11:38:28 PM
I was thinking about this, and what about doubling instead of dividing? Would that be simpler than using a divider chip? Looking at a triangle wave, if you full-wave rectify it, it will double the frequency without distorting it much. Setting an oscillator for a lower frequency and doubling it for each next octave seems like it might be simpler.
There's not much simpler in the electronics world than dividing a square wave by two. Analog or digital doubling are way worse by the time you actually get to the end result you need.
Quote from: PRR on November 16, 2012, 01:33:03 AM
Twelfth-root-of-two is a very hard number to compute 11 times in 500 microseconds (1/2000th of a second, period of a high note)...
It's worse than that.
You don't have the period of a high note to compute it. You have zero time to compute it in some cases. The notes at different frequencies will have transitions that they must make on time to get the proper notes out. Those transition times will inevitably correspond to less than a clock tick at some point, and that is effectively zero time to a digital device. That may or may not be audible, or you may be able to do some special casing, whatever.
This kind of thinking is what led me to decide that getting one close-enough frequency, and divided-down outputs out of a uC per note was probably the most effective.
PLDs and the hard-logic 50240 and its ilk are effectively parallel processors, one per note because the divider chains are independently being clocked down to the particular dividers. There may be some commonality at the first divider stages by factoring the divide-by chains and using as many common early stages as possible, but the divider chains at the end become independent, not locked as they must be in a single-thread computation.
Many years ago, a scheme was suggested whereby there would be a divider chain that would use a broadband phase-locked loop with 185/196 dividers which would be augmented by a narrowband phase-UNlock loop that would push the VCO away from an exact multiple. It is the slight deviation from accurate phase lock that provides an acoustic instrument sound in place of a Lowrey organ sound. Of course, which direction to push off the logic divider frequency may be somewhat in doubt.
Total over-kill:
Quote from: December issue of CURRENTS from Analog Devices
3.5 GSPS Direct Digital Synthesizer with 12-bit ADC
• 3.5 GSPS internal clock speed
• Integrated 12-bit DAC
• Frequency tuning resolution to 190 pHz
• 16-bit phase tuning resolution
• 12-bit amplitude scaling
• 32-bit parallel datapath interface
• Programmable modulus
• Automatic linear and nonlinear frequency sweeping capability AD9914 1K price $135.58
Learn more about the AD9914 GSPS Direct Digital Synthesizer, download the datasheet and order samples here (http://www.analog.com/en/digital-to-analog-converters/direct-digital-synthesis-dds/ad9914/products/product.html)
datasheet (http://www.analog.com/static/imported-files/data_sheets/AD9914.pdf)
*pico* Hz?? Boy, can't complain about pitch error!