I have been brainstorming today about generating musical intervals with logic chips. I think I am correct in saying that if you divide the frequency of an audio signal by three you obtain the musical fifth of the original note. [edit: whoops! actually it's the fourth; see below] So if you put in a C you'll get out a G [edit: F, actually] two octaves down. If you chain these together you start walking around the circle of fifths [edit: fourths], so, say you put in C8 and chain a few divide-by-three circuits together, you'd get:

C8 -> G6 -> D5 -> A3 -> E2

[edit: should be, starting instead on E8:
E8 -> A6 -> D5 -> G3 -> C2]

then divide each of the higher-frequency signals by the appropriate power of 2 to get them all into the same octave, rearrange them, and you can get a pentatonic scale:

major: C D E G A
minor: A C D E G

there's your top-octave pentatonic scale, and if you started with a high enough frequency you can divide by further powers of two to get the octaves below.

I am waiting on the chips to breadboard this, but how does the theory sound? It seems neater to me than tuning individual oscillators to achieve the same result.Last edited by trav on Sun Mar 10, 2013 1:03 pm; edited 2 times in total

I scraped together enough chips to try out two chained divide-by-three counters and got encouraging results. In the recording the first group of three notes is the raw chain, the second group brings them within the same octave.

I am already at a fairly high chip-count: a NAND for the osc, a BCD and an AND for the divide-by-threes, and a divider to bring the higher frequencies down. I'll have a think about designing it better; perhaps rigging the BCD as a divide-by-six will help... Good to discover that the principle is sound, though; and I think it is simpler than trying to fine-tune musical intervals. A good way to learn about just intonation too!

Really good work trav.
What you're basically doing is re-creating a Top Octave Generator similar to those found in old organs, but the whole thing can be simplified, as you've shown, by just extracting the pentatonic scale, rather than a whole chromatic octave, as the TOG does.
It should be relativly easy to tune the high frequency clock up or down by say 3-4 semitones, and then everything could be within easy reach, without the 20 or so chips needed to replicate a TOG, and you've built in more flexibility at the same time. _________________What makes a space ours, is what we put there, and what we do there.

of course, dividing by three and then dividing by three again is the same as dividing by nine, which got me thinking...

I did some more math and figured that in order to generate the five notes of a major pentatonic scale I needed to divide the high frequency clock by 64, 72, 81, 48, and 54, respectively. I noticed each of these has either 8 or 9 as a factor:

64 = 8 * 8
72 = 8 * 9
81 = 9 * 9
48 = 8 * 6
54 = 9 * 6

so, for example, I can generate the first note of the scale by sending the signal through a divide-by-eight and then on to another divide-by-eight. This keeps the number of chips low, since I can do the divide-by-eight and divide-by nine first, then divide once more for each note. That's 7 dividers: I can get that from four 4518s, with one divider left over to get the sub-octaves. The only other chips required will be some simple logic to get division by 6 and 9 out of the BCDs, and something for the high freq oscillator.

Here is a diagram of what I am talking about. 1 signal + 7 dividers = a pentatonic top octave.

Now, that is a lot of division: I wonder what the initial frequency will have to be... I was thinking of just having a pot to adjust the frequency, maybe a slider that I can use to "bend" to the in-between notes by ear.

Was thinking that the odd numbered divisions tend to give a pulse instead of a square wave (i.e. less than 50% pulse width) so it may need post division by two to square the signal up ... anyway, something to look into for a practical realisation.

great, I have been thinking about this for a while, that is taking a high frequency and dividing it down. I was personally thinking of doing
this with a PIC, But it's nice if you can do it with a handful of chips too. I don't know enough about scales and intervals yet, so for now
I just watch you do it _________________"My perf, it's full of holes!"http://phobos.000space.com/http://www.acidtrash.com/Stickney Synthyards

I was unable to find the post the circuit below came from. Basically, it was twelve such circuits to replace the 50240 top octave generator. Built 5 of 'em and there's your pentatonics, all in the same octave, and all of them square waves.

Yes 12-tone equal temperament has been done, and more elegantly. Thanks for that diagram, richardc64: very useful. The huge divisions are are why I've limited myself to 5 notes. I figure I can make this with just six chips, which I don't think is bad at all.

Rather than a rigorous TOG this is more of an experiment in just intonation and whether a few musical notes can be obtained by ruthlessly applying the same primitive (divide the frequency by three to get the next note)

So I was thinking about how to "play" these notes. Originally I thought I'd just have the keys gate the signal, which would give me polyphony too. Then I realized if I used the key press to select the appropriate divisions I could cut down the number of dividers needed, although I'd lose polyphony, since I wasn't doing all of the divisions all of the time. A worthwhile sacrifice, though, I told myself after spending quite some time failing to debug an overloaded breadboard.

First I chained two dividers: the first one divided by either 8 or 9, the second by either 6, 8, or 9. By cycling through the permutations I got my five tones. This cut the chip-count down to 3, but it required 2-pole switches to select the right combination of divisions for each note.

I went back and had a look at the ratios in the Just Diatonic scale:

C = 1
D = 9/8
E = 5/4
F = 4/3
G = 3/2
A = 5/3
B = 15/18
C = 2

I'm only interested in C D E G A. I took those ratios and divided through by 10 to get:

C = 1/10
D = 9/80
E = 1/8
G = 3/20
A = 1/6
C = 1/5

well, 9/80 is pretty close to 9/81 = 1/9. It's not so easy to turn 3/20 into 3/21 = 1/7, but when I saw that I could twist the above to get the following:

C = 1/10
D = 1/9
E = 1/8
G = 1/7
A = 1/6
C = 1/5

I saw something that I could easily rig up with a single BCD and a few AND gates. I've attached two recordings of me poking around the breadboard. In the first recording you can hear that the G is indeed flat and a bit nasty; but the D sounds good to my ear (I double-tap the D and the G the second time through the notes: they're the one whose ratios I massaged). In the second recording I use the other BCD on the chip to get some more octaves.

This one only requires the keys to be single-pole switches, I get the C at both ends of the scale, and it all happens on only three chips (not counting the oscillator). It's a shame the fifth is so nasty, but, hey, this is Lunetta-land. When I get brave enough I'll try the 12-tone generator richardc64 posted.

The keys just connect the reset pin to the appropriate signal. There is a pull-up resistor on RST so that when no key is pressed nothing comes through. I take the output from BIT3. As Blue Hell mentioned, this doesn't give a squarewave (except for division by 8), but the octave-down divisions fix this (you can hear the difference in the highest octave of the second recording above).

Haha! Yes, this has all been an elaborate, round-about way of implementing a manual melody generator The 4017 version would be very simple: just put a clock into the chip and have the keypress connect the reset pin to the right place. Or, to do the original idea, chain hardwired 4017s. I'll pick up some this week and try it out.

err... so looking at those ratios made me realize that the assumption I made in my very first post was incorrect: dividing by three yields the perfect FOURTH two octaves down, not the perfect fifth.

Code:

Root | Fourth | Octave | 2nd Octave
1 | 4/3 | 2 | 4

You can see that if you start with a frequency of 4 then divide by 3 you get 4/3 = the perfect fourth two octaves below. I wondered why I had to re-rearrange my notes... I was still generating the right intervals (the fourth is the inverse of the fifth), just in the opposite direction. Edited the first post to correct my error.

I'm doing something similar with a PLL and programmable dividers.
The ratios between intervals is a irrational number, [2^(1/12)]^n.
Where n is the number of semitones between notes, Fout/Fin=n.
You'll have to approximate the irrational number with a fraction. Higher value for the denominator (which will be the nominal, unity frequency) will give better precision.
Just google 'twelfth root of two' and 'musical intervals'. It's all there, (almost) no math required. Just pick some multiple of the input, use that to form a fraction approximating the ratio and then divide down again if needed._________________@jonasjberg Analog be harder than digital.

Well, here's a picture of two keyboards made out of a bunch of shitty switches. The top one is a simple monophonic pentatonic thing with a pot for tuning and 4-throw rotary switch for octave selection. The bottom one is a (kinda) polyphonic diatonic thing with a pot for tuning, 4x ON-OFF-MOM switches for octaves/sub-octaves, and the top three octaves brought ought to banana jacks for feeding notes into melody gens, gates, sequencers etc.

The pentatonic circuit is really simple. Send a fairly high frequency into a 4017. RST is tied high by a pull-up resistor, so OUT is usually low, but closing one of the switches connects reset to one of the output pins, dividing the original frequency and putting it on OUT. I fed this into a ripple counter to square up the signal and get a few more octaves.

The diatonic circuit was a bit more complicated, but basically the diagram above plus a few more dividers to get a three-octave keyboard plus 4 octave/sub-octave switches to get a range of 6 octaves altogether. Polyphony sounds alright when only the top octave is activated, after that it gets all diode-crunchy. As for the build, I'm not much of a pianist; what I really am looking forward to is seeing what kind of melodies the lunetta can make on its own, hence the use of crappy switches for "keys" while the jacks are for patching the notes elsewhere.

The pentatonic circuit is really simple. Send a fairly high frequency into a 4017. RST is tied high by a pull-up resistor, so OUT is usually low, but closing one of the switches connects reset to one of the output pins, dividing the original frequency and putting it on OUT. I fed this into a ripple counter to square up the signal and get a few more octaves.

The diatonic circuit was a bit more complicated, but basically the diagram above plus a few more dividers to get a three-octave keyboard plus 4 octave/sub-octave switches to get a range of 6 octaves altogether. Polyphony sounds alright when only the top octave is activated, after that it gets all diode-crunchy. As for the build, I'm not much of a pianist; what I really am looking forward to is seeing what kind of melodies the lunetta can make on its own, hence the use of crappy switches for "keys" while the jacks are for patching the notes elsewhere.

have a listen, tell me what you think

hmm. I think I somehow missed your last post
I like the simplicity of the 5-tone generator and it does sound like the melody generator. 7-tone seems to be a bit of but it's not bad. I actually
found a circuit in an old elektor which is similar in concept to the one richardc64 posted. It's designed to play a fixed melody (Big Ben) but I think
it would be possible to use it in a similar way you made the 5-tone generator. I probably won't be trying that anytime soon though, and I allready
have a lunetta keyboard anyway _________________"My perf, it's full of holes!"http://phobos.000space.com/http://www.acidtrash.com/Stickney Synthyards

I just had a listen back to what was admittedly not a great demonstration. When you say it sounds a bit off, I think in the beginning I played a minor scale: is this the offness you mean? (You get some major arpeggios later) I think I wanted to demonstrate the full range, and you can see from the keyboard layout I begin and end on A (Cs are the red switches).

Of course, the whole thing is a bit ramshackle, so it may just be that. But it is fun to play with. I like to patch the tones into a multiplexor clocked by random bits: you can hear this on the attached patch.

PS, PHOBoS, I love the LUN·A·KEY! watched that thread with great admiration.

All of the Pythagorean harmonic relationships were via mathematical divisions of 2 and 3. I've done a bit of thinking and planning on the idea of how to divide down tones to get different intervals, but never actually built anything._________________∆ A. MAGIC PULSEWAVE ELECTRONICS ∆

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum

Please support our site. If you click through and buy from our affiliate partners, we earn a small commission.