Posterous theme by Cory Watilo

A Rational Ruling for Irrational Songs?

Following up on my earlier posts regarding the Sound of Tau and iterations on that theme, a Federal Judge has ruled in the case of Erickson v Blake that Blake did not infringe on Erickson's copyright.  His song was sufficiently different from Erickson's and this was particularly interesting:

Copyright protects against the copying of original elements of an author’s work. It does not protect the copyright holder's goodwill, market status, or artistic success. It does not even protect the author's hard work in being the first to create a compilation of information otherwise available in the public domain. ... Mr. Erickson cannot use his copyright to stop Mr. Blake from employing the same idea—the transcription of the digits of pi to musical notes.

So, I guess I will not be able to sue Mr Blake into the ground for his blatent infringement of my Tau song.  I suppose I will need to keep my day job.  You can see his derivative Tau work here.

Facebook Friend Visualization

Over the weekend, I put together a map showing connections with my Facebook friends.  I thought I'd jot down how it came about.

Recently, I've been experimenting with the R programming environment.  It is a tool for statistical data analysis and can produce some really nice visualizations.  A few days back, I came across this tutorial from the Flowing Data website.  It shows how to plot great circle arcs between different airports and get results that look really nice with only a few lines of code.  In the tutorial, the author also mentioned the famous visualization that a Facebook engineer created to show how Facebook connections can trace the outline of civilization.   I wondered to myself if I might be able to do this for my facebook friends? 

First, how can I get my facebook friend's locations?  After some spelunking around the Facebook developer website, I found there is a Facebook Developer tool you can use without going through any extra developer registration steps.  You can grab your own data in a JSON format, which is a nice format to parse in a script.  Of course, the online tool is too limited to use to scrape all of your friends info by hand.  But, if you grab the access token from that site, you can get access to via the commandline...

curl https://graph.facebook.com/me/friends?access_token=<token>
curl https://graph.facebook.com/<friendid>?access_token=<token>

If I can do that on the commandline, then I can script this.

But, how can I translate locations like "Milwaukee, Wisconsin" to a latitude, longitude?  I have many friends in small cities, so I'll need a good database to do these lookups.  Googling found http://www.geonames.org/export/ has some datasets that look perfect for me.

At this point, it seems like I have all the information I need to accomplish this.  Now, it is just a matter of stitching it together.

First, a script to download the names & locations.  It just wraps the two http fetches from above in order to get the friend['location']['name'] from the JSON.  The first unexpected roadblock is unicode.  One of my friends has an accent in her name.  Printing it out is causing python to barf chunks.  [Thanks, Renée!  :-)] Unicode characters are not something I normally have to deal with, so it is back off to the python website for some help.  Unicode is just not very clear to me, but by adding friend['name'].encode('ascii','ignore') to that print statement, I was back up and running.

After this, I now I have a file that looks something like:

Sname Ename    Portland, Oregon
Kname Bname    None
Mname Zname    Orlando, Florida
Mname Bname    Kuala Lumpur, Malaysia
...

Someday, I'll need to make a stab at hand translating all those "None" locations to a real location, but for now I'll just ignore.  Since I only have a couple international friends, the world map isn't that interesting.  For now, I'll just restrict this map to the US.

Now for a stab at trying to get a pythonic way to translate those facebook locations into latitude, longitude.  I wish I could use the cities1000 on geonames.org file, but I have friends in smaller towns than that.  That US datafile is pretty huge--US.zip is 55M and expands to 265M.  Loading in that file takes more than a minute on my laptop.  I won't want to do this translation too many times.  After the fact, I realized that it has a gigantic amount of information I do not care about.  It has locations of schools, parks, etc.  I'll have to come back later & filter that out for future use. 

Now, on to the next hurdle to clean up and make states & countries match up across these two pieces of data.  Both need to translate to 2 letter codes (Oregon to OR, Malasia to MY, etc.).  More googling and I have some code to do that mapping.  Oh, then another few minutes removing more annoying unicode characters.

Finally, I have the data that I can work with.  A list of cities, how many friends in each and their latitude and longitude.

    San Jose,CA,US,7,34.07779,-117.77617
    Evansville,IN,US,1,37.97476,-87.55585
    Sierra Vista,AZ,US,1,31.55454,-110.30369
    ...

The quick reader will note that the city of San Jose is not really at that latitude and longitude.  I discovered this later when I found some connections into Southern California that I wasn't expecting.  I'll have to look into being more careful with parsing that large dataset of locations.  For now, I just cleaned this and an errant Mountain View location by hand.

After I added headers, now I can slurp that file into R with read.csv().

Following along with the tutorial code, it worked!  Well,almost...seems the lines going to the east coast seem to be a bit west of their actual location.  I found that the example missed an important parameter (addStartEnd=TRUE) that would cause the last segment of the arc to be dropped.  Earlier tutorial code has this, but the later code dropped it.

After all that I was finally able to draw the connections that I wanted to draw.  Here it is:

Friends

That sure was more work than I thought it would be, with a few detours I wasn't expecting, but I did get what I wanted.  It isn't a great example of how "fun" and "easy" programming can be, though.  Rather, it is a lesson of how difficult it can be to do simple things. 

Update:  New version with a better color scheme, points for locations and a bit of aggregation for cities that are close to each other to gather people into the most populated city.

Screen_shot_2012-01-14_at_9

Seoul, Korea. 1965 & 2011

When we travelled to Seoul, we carried with us a few photos that my dad took in 1965.  We tried to make it back to some of the same spots that he took photos and we had some success.  We made it to the Gyeongbokgung (Gyeong Bok Palace) and were able to recreate a few of Dad's photos.

Stairsoldandnew800sharp

Stepping back from the previous picture, here is a larger panorama of the palace. 

Gongbokmergeboth800

I combined two photos from Dad to get the top picture.  The overlap wasn't as apparent before I got there and took note of the missing building in the background.  Our tour guide, Kiki, pointed out the building and the matching photos.  That building in the past was a controversial Japanese General Goverment Building that was built during the occupation of Korea.  It was demolished & removed in 1995.

Now you can see all sorts of modern buildings much further away.  Where that building was is now another palace gate & courtyard surrounding the capital.  While we were there, they did a changing of the guard ceremony in that courtyard.

[edit: attempting to publish this again]

Gameduino Sound of Tau

My first Gameduino creation is a beat box program. It allows you to control the number of beats and adjust the tempo now. What better way to try it out than by plugging in the first 32 digits of Tau?

(download)

The code for the beat box is at http://bitbucket.org/rallen/rabeats if you are interested.

Don't forget--Tau Day is coming up!

One More Scoundrel

With the latest resignation announcement by Senator Ensign, I've updated my spreadsheet of Congressional Resignations here:

http://spreadsheets.google.com/ccc?key=0AmVaLTr0TuSEdG4tRkstQWE1VW94dlFzQkU4Vk85b1E

On the Summary tab, you'll find a rollup of the information:

* Since 1989, the Republicans have pushed ahead and now have a 1 resignation lead over the Democrats, 10 vs. 9 for what I am calling "dishonorable" reasons.

* Half (5 or 50%) of Republican dishonorable resignations were due to sexual activity or allegations.  This latest Ensign resignation is complicated because apparently there was an affair, but since that leaked out well before the resignation, I'm not calling this the primary reason.  I may change my mind as facts are revealed.

* It remains that the majority (6 or 67%) of Democratic dishonorable resignations were money-related.

My source for resignations is http://www.rollcall.com/politics/casualtylist.html and Wikipedia for the reasons.  Often, I had to do a bit more googling when the reasons were not clear, but hopefully I've captured the primary reasons.

So far, I've only gone back to the 101st Congress (1989-1990).  Over time, I may add more data.  If you want to help, just format the data as I have in this spreadsheet and send it on.

Continuing Irrationality

This week I continued along the path of the piano arrangement I started last week with the "Fibonacci" piece.  I like the ambient feel and wanted to both polish that piece and explore a bit more with the Square Root of 2 and also use Tau for this type of 2-part piano arrangement.  If you like ambient (Brian Eno) music, you might like these.

I also finally rediscovered the processing in the Master Track of Garage Band.  I'm using the "Starry Night" Ambient reverb & echo.  This seems to give the sound a much needed ethereal quality.  Before, I thought they were too sparse.  It might be a bit too much, though.  We'll see how it works as I re-listen.

(download)
(download)
(download)

 

Tau, again.

I should be finishing my taxes.  But, I played with more irrational number music instead.

Since last time, I've crossed the number sequences from e, pi, tau, the square root of 2, the square root of 3 and even the Fibonacci sequence with several different scales: major, minor, major pentatonic, minor pentatonic.  They all make interesting melodies for a starting point.  Today, I picked the Fibonacci sequence in A minor pentatonic to play with.

I wanted to create something a bit more "ambient" than "classical".  With two sequences of prime number length--17 and 13 played against each other with repeats also generated from the Fibonacci sequence, the result is what follows.  At this point, I'm pretty pleased with it.  We'll see how it fares on tomorrow's listen.

(download)

I did a bit of rearrangement to the earlier "Sound of Tau" post.  I changed the instruments around, added a bit of dynamics and I'm feeling "okay" about how it is turning out.  I'm much happier with the Fibonacci arrangement above.

(download)

The Sound of Tau

I recently ran across a two independent ideas from surfing the web that I've synthesized together into some music I'll be sharing here.

The first thing I found on the web was a video by Michael John Blake called "What Pi Sounds Like"[1].  I was very impressed with his arrangement.  I thought it was a creative and fun piece.  A few days later, when I looked again for the piece, I noticed that a copyright infringement claim had been made by Lars Erikson.  Turns out, Lars had had the same idea for creating a melody as Michael had, but did it nearly twenty years ago in 1992 with his "Pi Symphony"[2]

After my initial gut-reaction of "you can't copyright pi!", I have since come to the conclusion that Lars does have a legitimate basis for claiming infringement.  No matter how you create a melody, if you were the first one to create it, you deserve some protection.  Of course, I am not a lawyer, so take that opinion for what it is worth.

Personally, I very much hope they work out some arrangement where they both can perform their music.  The two pieces are so different that they should be able to co-exist, find independent audiences and serve to co-promote each other.

The other thing I found on the web is "The Tau Manifesto"[3] published in 2010 by Michael Hartl.  If you consider pi to be the "circle constant", he makes a case for using 2π  rather than π when we discuss that "circle constant".  The greek letter τ   (tau) is his suggestion and I think he has some nice points to consider.  Now, in an interesting parallel, Bob Palais created an article called "Pi is Wrong!"[4] in 2001, well before Michael put his site up.  He made the same points that Michael made, but tried to use a new symbol that apparently has not been very successful.  Looking at his website, it appears he has now decided to support the τ movement.

So, what might happen if this Tau Manifesto is realized?  Well, the constant

    τ = 6.2831853 07179586 47692528 67665590 ...

could be as important as π someday.  Putting these two ideas together, it seemed clear that I should look into making some music just like Mr Erikson & Mr Blake.

I started with the values above, but instead of using a major key, it seemed like a minor fit better to my ear.  Choosing C minor, I mapped 1 to C, 2 to D, 3 to E, 4 to F, 5 to G, 6 to A, 7 to B, 8 to C, 9 to D and 0 to E.  I have a python music library called ramu[5] that I've been working on and I used that to produce the basic 32-note melody.

I sent the notes into GarageBand, arranged different scaled versions across a variety of orchestra instruments and produced the following piece that I'm calling "Tau Arrangement 1".  I'm relatively satisfied with it for just a couple hour's work.  Clearly it could be made better with more dynamics and more experimentation and I will probably work to do so.  But, in the interest of seeing if I might've gotten here first, I'm putting it out there today (3/19/2011) for the world to hear.  I hope you like it.

(download)

Links:

[1] Michael John Blake on Youtube:  http://www.youtube.com/user/michaeljohnblake

[2] Lars Erikson's Pi Symphony website:  http://www.pisymphony.com/

[3] The Tau Manifesto: http://tauday.com/

[4] Pi is Wrong!: http://www.math.utah.edu/~palais/pi.html

[5] Ramu python music library:  http://code.google.com/p/ramu/