Author |
Message |
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
Posted: Tue Feb 26, 2013 6:04 pm Post subject:
Counter/dividers and the circle of fifths [edit: fourths!] |
|
|
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 |
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
|
Back to top
|
|
|
Uncle Krunkus
Moderator
Joined: Jul 11, 2005 Posts: 4761 Location: Sydney, Australia
Audio files: 52
G2 patch files: 1
|
Posted: Fri Mar 01, 2013 3:04 am Post subject:
|
|
|
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. |
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
Posted: Sat Mar 02, 2013 2:15 am Post subject:
|
|
|
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. |
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Sat Mar 02, 2013 5:40 am Post subject:
|
|
|
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.
Then I thought why not use rate multipliers (like http://www.datasheetcatalog.org/datasheets/105/109353_DS.pdf for instance) ... but these work with pulse skipping .. so that would be a musical disaster
Anyway, this is an interesting project. _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
PHOBoS
Joined: Jan 14, 2010 Posts: 5591 Location: Moon Base
Audio files: 705
|
Posted: Sat Mar 02, 2013 5:41 am Post subject:
|
|
|
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/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube |
|
Back to top
|
|
|
cbm
Joined: Oct 25, 2005 Posts: 381 Location: San Francisco
|
Posted: Sat Mar 02, 2013 12:21 pm Post subject:
|
|
|
Unless I'm missing something, this is not going to give equal-tempered results. _________________ Chris Muir
http://www.eardrill.com <– My jobby (more than a hobby, less than a job) |
|
Back to top
|
|
|
richardc64
Joined: Jun 01, 2006 Posts: 679 Location: NYC
Audio files: 26
|
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
Posted: Sat Mar 02, 2013 6:13 pm Post subject:
|
|
|
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) |
|
Back to top
|
|
|
Uncle Krunkus
Moderator
Joined: Jul 11, 2005 Posts: 4761 Location: Sydney, Australia
Audio files: 52
G2 patch files: 1
|
Posted: Sat Mar 02, 2013 10:35 pm Post subject:
|
|
|
Great thread this is turning out to be. _________________ What makes a space ours, is what we put there, and what we do there. |
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
Posted: Sun Mar 10, 2013 2:20 am Post subject:
|
|
|
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.
Description: |
|
Download |
Filename: |
divisions.mp3 |
Filesize: |
402 KB |
Downloaded: |
1036 Time(s) |
Description: |
|
Download |
Filename: |
divisions_octaves.mp3 |
Filesize: |
640.5 KB |
Downloaded: |
900 Time(s) |
|
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
Posted: Sun Mar 10, 2013 2:38 am Post subject:
|
|
|
Here's how I wire the BCD up-counter:
Code: |
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1 BIT1 + BIT3 --> RST (divide by 5)
0 1 1 0 BIT2 + BIT3 --> RST (divide by 6)
0 1 1 1 BIT1 + BIT2 + BIT3 --> RST (divide by 7)
1 0 0 0 BIT4 --> RST (divide by 8)
1 0 0 1 BIT1 + BIT4 --> RST (divide by 9)
GND --> RST (divide by 10)
|
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). |
|
Back to top
|
|
|
PHOBoS
Joined: Jan 14, 2010 Posts: 5591 Location: Moon Base
Audio files: 705
|
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
Posted: Sun Mar 10, 2013 12:18 pm Post subject:
|
|
|
PHOBoS wrote: | Maybe the CD4018 (presettable divide-by-n counter) is useful. |
Yep, I've been playing with 4518s because that's what the cmos challenge landed me with and what got me thinking. Note that the 4018 needs extra NAND gates for divisions by odd numbers.
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. |
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
Posted: Sun Mar 10, 2013 1:18 pm Post subject:
|
|
|
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. |
|
Back to top
|
|
|
jonasx26
Joined: Sep 20, 2009 Posts: 5 Location: Sweden
|
Posted: Wed Mar 13, 2013 4:30 pm Post subject:
|
|
|
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. |
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
Posted: Sat Apr 06, 2013 6:20 am Post subject:
|
|
|
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
Description: |
|
Filesize: |
8.02 KB |
Viewed: |
31237 Time(s) |
|
Description: |
|
Download |
Filename: |
5-tone.mp3 |
Filesize: |
513.75 KB |
Downloaded: |
902 Time(s) |
Description: |
|
Download |
Filename: |
7-tone.mp3 |
Filesize: |
1.04 MB |
Downloaded: |
865 Time(s) |
|
|
Back to top
|
|
|
PHOBoS
Joined: Jan 14, 2010 Posts: 5591 Location: Moon Base
Audio files: 705
|
Posted: Sun Nov 10, 2013 4:44 am Post subject:
|
|
|
trav wrote: | 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/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube |
|
Back to top
|
|
|
commathe
Joined: Jul 26, 2013 Posts: 153 Location: Beijing
Audio files: 5
|
Posted: Sun Nov 10, 2013 6:30 pm Post subject:
|
|
|
This is fantastic. I have been really interested in this sort of idea for a long time, mainly for creating big organ-like drones. I really appreciate the documentation |
|
Back to top
|
|
|
trav
Joined: Sep 11, 2012 Posts: 108 Location: Auckland
Audio files: 16
|
|
Back to top
|
|
|
Top Top
Joined: Feb 02, 2010 Posts: 266 Location: California
|
Posted: Sat Nov 23, 2013 3:03 pm Post subject:
|
|
|
Great thread.
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.M.P. ESOTERIC ELECTRONICS ∆ |
|
Back to top
|
|
|
|