Author 
Message 
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3


Back to top



Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6109 Location: San Antonio, Tx, USA
Audio files: 265

Posted: Sat Mar 15, 2008 7:27 am Post subject:



Fascinating, I wonder if ChucK can do that? Instead of just a beat, take that whole series thing with x^2=x+1 and expand it to n terms, sufficient for a full song, then adjust the => now value according to the golden ratio durations of that order. I just don't quite fully grasp how to do it, but let me think on it... 

Back to top



Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6109 Location: San Antonio, Tx, USA
Audio files: 265

Posted: Wed Mar 26, 2008 2:21 am Post subject:



I'd like to refresh this thread because I think there is something meaningful that we could accomplish in the music world using ChucK. This "Amen Break" is described on the posted web site to be widely used in music because it has deeply rooted meaning in mathematics, nature, and the human condition. Apparently we've been hardwired by evolution to enjoy this sequence, I suppose because our brains have neural pattern recognizers that are trained to recognize it, but that's just my take on it.
The thing is, this Amen Break is only one example of the musical sequence that is generated by the Golden Ratio. I believe we can generalize the short sequence into any duration of music at any desired level of detail by understanding and programming the math behind it.
If we did that, then we would have generalized this widely used Amen Break from a single known sequence to a spectrum of Amen Breaks, any one of which would elicit the same deeply rooted appreciation that the Amen Break creates. In other words, the result might just have widespread appeal in the music community.
Creating computergenerated music sequences with such ease and such great impact would be very rewarding. So I felt it was worth taking another look at it. The only problem is I don't quite understand the math behind it. To help understand, here is a quote from the website that Kassen posted:
Quote:  It's a remarkable mathematical truth that when unity is added to the Golden Ratio, the result is the Golden Ratio squared! This occurs among no other ratios. (Try it on a calculator to see that 1.6180339 times itself is the same as adding one to it!)
phi^2 = phi + 1
This process can continue to produce an expanding sequence of powers of the Golden Ratio, each power always equaling the sum of its two previous powers. 
The part I don't get is how to produce that "expanding sequence of powers of the Golden Ratio" so that we can then use it to generate any arbitrary duration of the Amen Break. The web site author does not seem to present enough information to do the generalization.
One helpful comment that the author made was that the Amen Break is "reminiscent of fractal structures in nature", so perhaps if we could use fractals if we figured out exactly what fractal to use.
Anyway, I just thought I'd ask our ChucKian math expert(s) if the math behind it is not too esoteric or difficult to understand / use in a ChucK program. It seems to be worth our time and trouble. I'd be interested in coding it up if someone could explain the math.
Or am I once again reinventing the wheel since this is already known and done to death by the music industry? You tell me. 

Back to top



Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3

Posted: Wed Mar 26, 2008 4:11 am Post subject:



You may want to look into the "fibonacci sequence", how it can be used to calculate this ratio and how the occur in nature. For one thing it's probably your best bet to find pritty pictures on math pages :¬)
On a somewhat related note; in the past days I started working on a automated breakbeat cutter in lost moments. So far it's quite crude but I can more or less successfully detect where the drumhits are, detect the most relevant (well, loudest) ones and swap them around (randomly for now). Not bad for under 200 lines. I need a way to tell it very short snippets (bellow 100ms or so) aren't relevant because those make it glitch. From there on it's on to more interesting manipulations :¬) _________________ Kassen 

Back to top



Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6109 Location: San Antonio, Tx, USA
Audio files: 265

Posted: Wed Mar 26, 2008 5:51 am Post subject:



Oh, I think I got the equation. We are given the equation
phi^2 = phi + 1, where phi = 1.6180339
and we are told:
This process can continue to produce an expanding sequence of powers of the Golden Ratio, each power always equaling the sum of its two previous powers.
I tried the following equation:
phi^3 = phi^2 +phi + 1
and it evaluated correctly. So the following equation should be valid:
phi^4 = phi^3 + phi^2 + phi + 1
I checked and it is valid. Then the following would be true:
phi^5 = phi^4 + phi^3 + phi^2 + phi + 1
phi^6 = phi^5 + phi^4 + phi^3 + phi^2 + phi + 1
phi^7 = phi^6 + phi^5 + phi^4 + phi^3 + phi^2 + phi + 1
and so on. That's nice, but I don't know how to translate that into a sequence of notes (yet). I'll look into the Fibonacci sequence next, as Kassen suggests. Maybe they're related. _________________ "Let's make noise for peace."  Kijjaz 

Back to top



Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6109 Location: San Antonio, Tx, USA
Audio files: 265

Posted: Wed Mar 26, 2008 6:27 am Post subject:



Wait, that's not correct. It's just the previous two powers. So the equations are these:
phi^2 = phi + 1
phi^3 = phi^2 +phi + 1
phi^4 = phi^3 + phi^2
phi^5 = phi^4 + phi^3
phi^6 = phi^5 + phi^4
phi^7 = phi^6 + phi^5
I looked up the Wikipedia page on the golden ratio and there is a ton of math related to it. Also I found many references to the use of the golden ratio in music, so this is no new idea. But the audio samples i found all sounded kind of bad. I think there is a lot of activity going on in the music world with the golden ratio, but not all of it is done well. This means we may yet be able to create something original and satisfying with the golden ratio. But how? _________________ "Let's make noise for peace."  Kijjaz 

Back to top



Blue Hell
Site Admin
Joined: Apr 03, 2004 Posts: 21822 Location: The Netherlands, Enschede
Audio files: 177
G2 patch files: 319

Posted: Wed Mar 26, 2008 6:41 am Post subject:



Edit : damn, it took me too long to compose this
When :
(1) phi^3 = phi^2 + phi + 1
and
(2) phi^2 = phi + 1
both hold then that means :
from (2) by multiplying both the left and the right side with phi
phi^3 = phi^2 + phi
combined with (1)
phi^2 + phi = phi^2 + phi + 1
or 0=1 something goes wrong somewhere
I think the sequence should be :
(3) phi=phi, phi^2=1+phi, phi^3=1+2phi, phi^4=2+3phi, ..., phi^n=n2+(n1)phi
=======
The (usua)l Fibonacci sequence is defined recursively with :
Fn = Fn1 + Fn2
F0=1
F1=1
Now when you look at Fn+1 / Fn you'll see the value go to phi when n goes to infinity. That's the relation between the golden mean and Fibonacci.
=======
Now when you look at (3) again you'll see that it resembles a Fibonacci sequence except that :
F0 = phi
F1 = 1+phi
=======
From this we can also obtain :
(4) lim (n>inf){(n2+(n1)phi/(n3+(n2)phi))=phi
which is obvious from inspecting (4) as well ... as (n1)phi/((n2)phi)=phi.
Anyway (5) phi = fun _________________ Jan
(yawning shifts perceived pitch, making things more interesting) 

Back to top



Frostburn
Joined: Dec 12, 2007 Posts: 255 Location: Finland
Audio files: 9

Posted: Wed Mar 26, 2008 6:52 am Post subject:



It's not that the amen break uses the golden ratio but it's that it uses it well. Just forcing the ration into pictures or audio doesn't automatically make them pleasing.
Oops I was too slow, Blue Hell beat me to it:
I'll leave this here just to make this thread even more crazy
And about expanding the powers of phi.
Define:
phi^2 = phi + 1
multiply both sides by phi
phi^3 = phi^2 + phi
substitute phi^2 = phi + 1
phi^3 = phi + 1 + phi
phi^3 = 2*phi + 1
multiply both sides by phi
phi^4 = 2*phi^2 + phi
substitute phi^2 = phi + 1
phi^4 = 2*(phi + 1) + phi
phi^4 = 3*phi + 2
and so on:
phi^5 = 5*phi + 3
phi^6 = 8*phi + 5
phi^7 = 13*phi + 8
...
Can you see the pattern?
The coefficient in front of phi is the sum of the two previous coefficients!
Therefore:
phi^n = Fn*phi + Fn1
Where n is greater than zero and Fn is the n'th Fibonacci number.
Defined as follows:
F0 = 0
F1 = 1
Fk = Fk1 + Fk2
Therefore:
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
...
F20 = 6765
...
F40 = 102334155
F41 = 165580141
Try it:
phi^41 = 165580141*phi + 102334155 _________________ To boldly go where no man has bothered to go before. 

Back to top



Blue Hell
Site Admin
Joined: Apr 03, 2004 Posts: 21822 Location: The Netherlands, Enschede
Audio files: 177
G2 patch files: 319

Posted: Wed Mar 26, 2008 7:17 am Post subject:



Frostburn wrote:  I'll leave this here just to make this thread even more crazy 
It seems to also correct an error I made
(edit : in the generalization I made in (3), I also forgot a closing curly brace in (4), but as (3) is wrong (4) is nonsense as well). _________________ Jan
(yawning shifts perceived pitch, making things more interesting) 

Back to top



Frostburn
Joined: Dec 12, 2007 Posts: 255 Location: Finland
Audio files: 9

Posted: Wed Mar 26, 2008 7:40 am Post subject:



Inventor wrote:  One helpful comment that the author made was that the Amen Break is "reminiscent of fractal structures in nature", so perhaps if we could use fractals if we figured out exactly what fractal to use. 
Yeah the Fibonacci sequence rises naturally in the multiplication of cells that need a break (they listen to the amen break) after splitting.
Start with a cell. 1
It's young and needs to grow up a bit first. 1
Now it's grown up so it splits in to two. 2
The adult cell splits up once more but the second is still growing. 3
The first cell splits, the second one splits but the third one grows. 5
The first, second and third split but the newborn fouth and fifth grow. 8
First five split but the new three grow. 13
And so on. (See the Fibonacci?)
Quote:  Anyway, I just thought I'd ask our ChucKian math expert(s) if the math behind it is not too esoteric or difficult to understand / use in a ChucK program. It seems to be worth our time and trouble. I'd be interested in coding it up if someone could explain the math. 
The math behind the golden ratio is as old as mathematics herself. So it's not esoteric at least. Difficulty is a personal matter but the math at hand is pretty basic algebra and arithmetic.
I did some experimentation with phi when Kassen posted this topic and I noticed that the ratio sounds a bit alien if used too extensively so I didn't come up with anything spectacular. I can look in to more though...
Quote:  Or am I once again reinventing the wheel since this is already known and done to death by the music industry? You tell me. 
It has been used alot, knowingly and unknowingly but beuty is eternal and I don't think that you can wear phi out.
When you're dealing with the golden ratio. Anything you invent you reinvent. It's properties have been studied to death by matheticians great and small.
But that's no reason not to study the ratio. Discovery is always fun even if it's rediscovery. And discovering is in my opinion the most fun way of learning. _________________ To boldly go where no man has bothered to go before. 

Back to top



Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6109 Location: San Antonio, Tx, USA
Audio files: 265

Posted: Wed Mar 26, 2008 10:17 am Post subject:



Ah, thanks guys, and nice to see you chiming in again Blue Hell. I see your posts everywhere I go on this forum, you really get around. As for my math, well, it's been 20 years since my last math class so I'm a little rusty. Now that you've explained them, I see the equations and the Fibonacci sequence a little better now. Here is the beginning of the sequence, from the Wiki:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, ...
It looks like it begins to explode quickly so I'm not sure how to use it for a music sequence. There must be good ways but I don't see one yet. I suppose we could solve for the roots of those exponent equations (including the negative or complex ones, if any), I dunno.
What does look interesting is the diagram in the upper right of the Wiki page. There it is in the photo below for your convenience. It shows a line divided into two segments according to the golden rule. If we put a note at the beginning, one at the middle, and one at the end, we could call that an order=1 song. Then we could divide each segment according to the golden rule again, creating a five note song as order = 2. next would be a nine note song as order = 3, and so on.
In this way the notes will get spaced with a good distribution in time, I imagine. Then obviously it would make sense to match the order number with the duration of the song so the beats per minute come out to something that sounds good. Let's look at that sequence, I think it's a binary progression.
Start with one segment, divide it into two, then four, then 8, yep it's binary. The number of notes would be 2^n + 1 I think. Then the amplitude could be set according to the golden ratio, with the first three notes being the loudest and the next one reduced according to the golen rule and so on, could do frequency that way too.
I think Frostburn stated the situation very well, there's nothing new here but it's worth doing. Maybe I'll attempt to code this up sometime soon. It's might turn out very nice, and I need a little break from optimizing Guitar Lab for speed (which is coming along nicely BTW).
p.s. watch out for that ASCII koala bear in my sig, they get mean when they're hungry! Cheers.
Description: 
The Golden Rule illustrated as a divided line segment, image captured from Wikipedia. 

Filesize: 
14.28 KB 
Viewed: 
11148 Time(s) 

_________________ "Let's make noise for peace."  Kijjaz 

Back to top



Blue Hell
Site Admin
Joined: Apr 03, 2004 Posts: 21822 Location: The Netherlands, Enschede
Audio files: 177
G2 patch files: 319

Posted: Wed Mar 26, 2008 11:07 am Post subject:



Inventor wrote:  What does look interesting is the diagram in the upper right of the Wiki page. There it is in the photo below for your convenience. It shows a line divided into two segments according to the golden rule. If we put a note at the beginning, one at the middle, and one at the end, we could call that an order=1 song. Then we could divide each segment according to the golden rule again, creating a five note song as order = 2. next would be a nine note song as order = 3, and so on. 
That does look interesting indeed, I see symmetries again
BTW I do read most of the forum if only it were for killing spam, but read some stuff (like the ChucK department) with more interest than other. I do like computer languages & math and those applied to music, hence I guess.
I might try some of the golden mean stuff on the G2 later today, I don't really find the time to keep the latest ChucK stuff in the air unfortunately.
Maybe some Fibonacci related pitch intervals could be interesting. 2/3 is a natural one, but maybe 21/34 is interesting as well ... _________________ Jan
(yawning shifts perceived pitch, making things more interesting) 

Back to top



Frostburn
Joined: Dec 12, 2007 Posts: 255 Location: Finland
Audio files: 9

Posted: Wed Mar 26, 2008 12:02 pm Post subject:



Blue Hell wrote:  Maybe some Fibonacci related pitch intervals could be interesting. 2/3 is a natural one, but maybe 21/34 is interesting as well ... 
That is indeed worth looking into. It would be nice to find something that sounds good but isn't a limit 5 ratio.
The last time I experimented with tunings ratios with 13 in them sounded surprisingly good (compared to something with a 7)... I just thought it was because 13 is close to 12 but 13 is also a Fibonacci number... _________________ To boldly go where no man has bothered to go before. 

Back to top



ians
Joined: Apr 01, 2004 Posts: 2638 Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 622

Posted: Wed Mar 26, 2008 1:09 pm Post subject:



Inventor wrote:  0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, ...
It looks like it begins to explode quickly so I'm not sure how to use it for a music sequence. 
Look up the rabbit sequence, it is interesting, but only a bit.
The 8/5 ratio does logically fit into a funky drum break but the ratios from the smaller numbers only approximate the golden ratio. I think the golden ratio fits a lot better into the visual arts. But I think you should experiment and enjoy the journey. 

Back to top



Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6109 Location: San Antonio, Tx, USA
Audio files: 265

Posted: Wed Mar 26, 2008 1:41 pm Post subject:



OK, g2ian, I saw the Rabbit sequence before, I'll have a look again. Guess what? I wrote a nifty little Golden Ratio ChucK program. I used that technique of first dividing the duration in roughly half with a Golden Ratio as in the illustration, then chopping up the two remaining pieces, and then once more. It makes a really good sounding short song! I'm quite impressed with the result!
Actually it didn't sound so good until I varied the frequency according to the golden ratio also. Then it really kicked in and made good sound. Here is the code:
Code:  // Golden Rule Song Generator
// Copyright 2008 Les Hall
// This software is protected by the GNU General Public License
(1 + Math.sqrt(5)) / 2 => float phi; // the Golden Ratio
500::ms => dur T; // the duration of the song
float t[7]; // the not times, normalized to a duration of one
440 => float freq; // the maximum frequency
float f[7]; // the note frequencies
// a simple patch
SinOsc sinosc => dac;
sinosc.freq (freq);
// the 2^0 golden ratio note location
phi  1 => t[0];
freq => f[0];
// the 2^1 two golden ratio note locatoins
t[0] * t[0] => t[1];
t[0] + (1  t[0]) * t[0] => t[2];
freq * t[0] => f[1] => f[2];
// the 2^2 four golden ratio note locations
t[1] * t[0] => t[3];
t[1] + (t[0]  t[1]) * t[0] => t[4];
t[0] + (t[2]  t[0]) * t[0] => t[5];
t[2] + (1  t[2]) * t[0] => t[6];
freq * t[0] * t[0] => f[3] => f[4] => f[5] => f[6];
// play the song
while (true) {
T * t[3] => now; // the first note
sinosc.freq (f[3]);
T * t[1] => now; // the second note
sinosc.freq (f[1]);
T * t[4] => now; // the third note
sinosc.freq (f[4]);
T * t[0] => now; // the fourth note
sinosc.freq (f[0]);
T * t[5] => now; // the fifth note
sinosc.freq (f[5]);
T * t[2] => now; // the sixth note
sinosc.freq (f[2]);
T * t[6] => now; // the seventh note
sinosc.freq (f[6]);
T * (1  t[6]) => now; // wait until end of duration
} 
Unfortunately I have not yet grasped the pattern sequence so I can automatically generate songs of any duration and note frequency, but I'll probably be able to figure it out. Give this one a listen, you'll like it. _________________ "Let's make noise for peace."  Kijjaz 

Back to top



Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6109 Location: San Antonio, Tx, USA
Audio files: 265


Back to top



Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6109 Location: San Antonio, Tx, USA
Audio files: 265


Back to top



Blue Hell
Site Admin
Joined: Apr 03, 2004 Posts: 21822 Location: The Netherlands, Enschede
Audio files: 177
G2 patch files: 319


Back to top



Frostburn
Joined: Dec 12, 2007 Posts: 255 Location: Finland
Audio files: 9


Back to top



gadu
Joined: Nov 21, 2014 Posts: 5 Location: Cyprus

Posted: Tue Mar 17, 2015 12:11 am Post subject:



well, I am fascinating from all of you guy's. I am here to learn ChucK but about the Golden Ratio I am a master and I am willing to give you some input that you all miss, that is the golden angle. In a Phi vision you should embed Phyllotaxy as well. Any how I am posting here some details about my research that involve landscape in historical perspective and more... what I would like to say is that at certain point of your chucK code you should turn... my suggestion is to try at 610.
The key point are:
1) Knowledge has a downward vertical development. Single concept development has a horizontal development within this vertical.
2) Knowledge develops vertically. Within this, single concepts develop horizontally.
3) Knowledge develops vertically. Within this, single concepts develop horizontally (to create a matrix). Source of knowledge has upward vertical development.
My theory of +1=?
Keep the best for your math _________________ _
"The old computing is about what computers can do. The new computing is about what people can do."
Ben Shneiderman 

Back to top



