# «The Sounds of Fibonacci» by henk.lasschuit

on 16 Mar'14 16:37 inPisano Periods for the numbers 2 to 1000 converted to sounds

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

/*s.boot; a=Thesounds ofFibonacciIntheFibonacci-sequence every term is found by adding the two previous terms:0,1,1,2,3,5,8,13.....Ifyou divide the terms of theFibonacci-sequence by any given number and note the remainder, you will find a repeating sequence called thePisanoPeriod(LeonardoPisanowas the real name ofFibonacci):2:0,1,1,0,1,1,0,1,1,0...3:0,1,1,2,0,2,2,1,0,1,1,2,0,2,2,1...Thisis great, because you can simply turn aPisanoPeriodinto sound!Forthe number2the period has a length of3and using a sampling rate of44100thiswill result in a tone of14700Hz, which is within audible range (if you are young enough).ThePisanoPeriodfor the number1000is roundabout1500, which will give you a tone of about30Hz, well within audible range.Anyterm of thePisanoPeriodfor a given number can be found by adding the two previous terms of thatPisanoPeriod, divide it by the given number en note the remainder.That's nice, because you don't have to work with the enormous numbers of the originalFibonacci-sequence.AnyPisanoperiod will contain1or2or4zeros.Thisidea was inspired bythisvideo: http://www.youtube.com/watch?v=Nu-lW-IfyecTheFibonacci-sequence can be found in theOnlineEncyclopediaofIntegerSequences: http://oeis.org/as well as the sequence of lengths of theA000045PisanoPeriodfor different numbers: http://oeis.org/*/A001175Array.new(14700000);//array for storingc=1000sounds each with a duration of1/3of a secondArray.newClear(14700)//array for storingc.put(1sound with a duration of1/3of a second0,0); c.put(1,1); ( for (2,1000, {argj;// voor j=for (2t/m1000, divisors2,14699, {argi; c=c.put(i, (c[i-1]+c[i-2])%j)}); c=2*(c+0.5)/j-1;//normalise,for (thiswill but the values conveniently between -1and10,14699, {argi; a=a.add(c[i])});// a.add(c); will not work: a will contain an array in each cell in stead of a numberc.put(0,0);//c.put(thisis necessary after normalising1,1); }); )//a=a.add(thiswill take a few seconds0);//to avoid glitches when switching the sound of.b=Italso prevents nasty effects when playing the sounds repeatedlyBuffer.loadCollection(s, a); x = {PlayBuf.ar(1, b,BufRateScale.kr(b), loop:0) }; x.play; x.free; b.free; a.free;

descendants

full graph
reception

cool