tag:blogger.com,1999:blog-20682029714673757812017-04-07T20:10:20.115+10:00Sequential SoundsBits and pieces of algorithmic music generated using Java and the JFugue music programming library.Michael Bedwardhttp://www.blogger.com/profile/17736007204837985875noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-2068202971467375781.post-13277697295598950372008-05-23T18:24:00.008+10:002008-05-23T20:07:02.949+10:00The Padovan SequenceThis is a relative of the much better known Fibonacci sequence. According to <a href="http://en.wikipedia.org/wiki/Padovan_sequence">this Wikipedia article</a> the sequence is relatively recent which seems surprising for something so simple. It is named after the architect and author Richard Padovan, although he attributes it to the Dutch architect Hans van der Laan, about whom, I have to admit, I know nothing.<br /><br />In the Fibonacci sequence, each term (after the first couple) is the sum of the previous two terms. We can denote this as:<br /><pre><br />Fib(n) = Fib(n-1) + Fib(n-2)<br /></pre><br />The Padovan sequence is a simple variation on this:<br /><pre><br />P(n) = P(n-2) + P(n-3)<br /></pre><br />So the first few members of the sequence, after arbitrarily setting the initial terms to 1, are:<br /><pre><br />1 1 1 2 2 3 4 5 7 9 12 16 21 28 37 49 65 86<br /></pre><br />Self-similarity rears its head here... If you look at the differences between terms, starting with P(6) - P(5), you will find that they form the Padovan sequence.<br /><br />To make Padovan music we can take advantage of another way of generating the sequence using an <a href="http://en.wikipedia.org/wiki/L-system">L-system</a> which I'll define as follows:<br /><ol><li>Take the three notes G, A, B.</li><li>Begin the progression with G.</li><li>Follow the rules G -> A; A->B; B->GA</li></ol><br /><i>(note: I'm using GAB here rather than the more usual ABC, so that I can be lazy with my JFugue code and stay in the same octave)</i><br /><br />Applying these rules the sequence builds like this:<br /><pre><br />G<br />A<br />B<br />GA<br />AB<br />BGA<br />GAAB<br />ABBGA<br />BGAGAAB<br /></pre><br />The length of the note sequence at each stage is:<br /><pre><br />1 1 1 2 2 3 4 5 7<br /></pre><br />which is the Padovan sequence.<br /><br />Here's what it sounds like, rendered using JFugue and arranged with two voices, one just behind the other. Self-similarity in the sequence results in the voices falling into step every so often. Keen listeners will also notice that I've exercised a little artistic licence and set the duration of the Bs to be twice that of the Gs and As.<br /><embed src="http://emilythecamel.com/datapages/soundfiles/padovan1.mp3" autostart="false" loop="false" controls="console" height="62" width="250"></embed>Michael Bedwardhttp://www.blogger.com/profile/17736007204837985875noreply@blogger.com0tag:blogger.com,1999:blog-2068202971467375781.post-59276077149916007562008-04-16T22:25:00.014+10:002008-04-18T12:55:15.861+10:00The Golden String<div style="text-align: left;"><span style="font-size:100%;">Here is a short piece of music generated using the Golden String - a binary sequence that starts out as 101011011010... and continues on forever (as these things tend to).<br /><embed src="http://emilythecamel.com/datapages/soundfiles/golden1.mp3" autostart="false" loop="false" controls="console" height="62" width="250"></embed><br />One way to build up the sequence looks like this:</span><br /><ol><li>1<br /></li><li>10</li><li>101</li><li>10110</li><li>10110101</li><li>1011010110110101</li></ol><span style="font-size:100%;">Steps 1 and 2 are given; after that the sequence at each step grows by joining the sequences at the two preceding steps. As the sequence grows, the ratio of the number of 1s to the number of 0s approaches the Golden Section (~ 1.618), a number that pops up in nature, geometry and artistic composition. The sequence is also fractal, meaning that it appears similar when examined at a range of scales. You can even lop bits off the front and still get back to the original sequence !<br /></span><br /><span style="font-size:100%;">You can find a much better explanation of the Golden String, and its many properties on <a href="http://www.mcs.surrey.ac.uk/Personal/R.Knott/Fibonacci/fibrab.html">this page</a>, part of Ron Knott's stupendously encyclopedic Fibonacci web site.<br /><br />To generate the piece I mapped the binary sequence to musical notes in two ways. Firstly, a simple mapping of 1s and 0s to low pitches to provide a background rhythm. The second mapping is a bit more interesting. The sequence was progressively read as seven-digit chunks (ie. chunk 1: positions 1-7 / chunk 2: positions 2-8 etc.). It turns out that only eight unique chunks of length seven can be found in the Golden String. I sorted these, treating them as binary numbers, and mapped them to notes in the A major scale (not for any deep mathematical or compositional reasons, I just like A major).<br /></span><br /><span style="font-family:courier new;">0101101 => A</span><br /><span style="font-family:courier new;">0110101 => B</span><br /><span style="font-family:courier new;">0110110 => C#</span><br /><span style="font-family:courier new;">1010110 => D</span><br /><span style="font-family:courier new;">1011010 => E</span><br /><span style="font-family:courier new;">1011011 => F#</span><br /><span style="font-family:courier new;">1101011 => G#</span><br /><span style="font-family:courier new;">1101101 => A (next octave)</span><br /><span style="font-size:100%;"><br />Using JFugue, I set two instruments to play these mapped notes in the piece, one starting slightly behind the other.<br /></span><br />Daniel Cummerow, a web-pioneer of algorithmic music, has also based a piece on the Golden String, using quite a different approach for the mapping. You can listen to it <a href="http://www.geocities.com/Vienna/9349/recursion.html#golden">here</a>.<br /><br /></div>Michael Bedwardhttp://www.blogger.com/profile/17736007204837985875noreply@blogger.com0