Talks

Archaeopteryx: A Ruby MIDI Generator

Help us caption & translate this video!

http://amara.org/v/FGki/

GoRuCo 2008

00:00:13.120 Okay, so if you've read the program or seen it on the website, you may have noticed that one of the things I bragged about regarding my presentation is that it was going to consist entirely of code. Now, you may actually notice that this is a lie, which means that I am a liar. However, I did a presentation that consisted entirely of code a couple of months ago, and although it went well, it was kind of nerve-wracking. So this is actually to make life easier for me. Before I go further, let me just check the audio... okay, this is okay. So, really quickly, this is a prosumer application called Reason, and this application is for making music. I'm actually just throwing in a quick sound check.
00:00:49.840 So, having checked that, I found out that by changing this number, I can change the beat, which is nifty. However, it’s not that fantastic; it’s just a beat over and over again. But you can change it a little by doing something else. And if you pay attention, you'll notice that it’s actually quite different than it was a few moments ago, which was achieved with a relatively small number of changes. I felt a little obligated to at least start off with a little code, and there will be more code a little later. But right now, let me just turn this off. So yes, I'm a liar, but I am going to show you a bunch of Lambda and Ruby. However, I'm actually going to start off by showing you pictures of a techno party in Los Angeles. What makes this interesting is that it starts with a laptop, and if you kind of watch these pictures, you'll see laptops in a lot of them. You also see people partying and having fun, which is interesting because as geeks and programmers, we can say to each other, 'Dude, this is going to be a wicked party. I'm going to bring my laptop.' It used to be the case that this was a very unusual thing to say.
00:02:25.879 The reason I bring this up is that if you look at the pictures of this party, you can see that many more people today can say, 'Dude, this is going to be a wicked party. I'm going to bring my laptop.' And you can even say, 'Dude, this is going to be a wicked party. That guy is going to bring his laptop,' and it actually makes sense, where in the past it might not have. So, my name is Giles Bowkett. Here I am with a laptop, here I am at a party. If you spend a lot of time reading blogs, one thing that people blog about often is the question of what programmers are. This question comes from the idea that some people have suggested or proposed that a programmer is a type of artist. Now, if you've read the Gang of Four, you know that you need to favor composition over inheritance. So, it might be more reasonable to say that a programmer has an artist somewhere inside. Regardless, this is an old idea; this is Kai's power tools from 1992. It looks very cheesy, but at the time, it was a very innovative piece of software—groundbreaking. The guy who made it was called Kai Krauss, and he said that he thought that the ongoing process of creating software, adjusting it, and making new versions was like performance art that played out over the months.
00:04:39.919 He said, 'Fundamentally, software is performance art.' It’s kind of a strange thing to say. Zed Shaw did a podcast recently where he described Mongrel as an art project. Hopefully, a lot of you have heard Steve Jobs' saying, 'Real artists ship.' This idea goes back much further than that. For example, Leonardo da Vinci was widely renowned as one of the greatest artists alive during his time; he also did these anatomical studies and made major contributions to science. His drawings were not just done for the sake of making pretty pictures; they were also for purposes of understanding things like bone structure. This was 500 years ago, and it was a big deal. However, even though Leonardo was a real artist in some cases, he did not ship. For instance, this is a hang glider he designed; he was not able to find anybody in 1500 to build it. This is a bridge he designed in 1502, which he was also not able to find anybody to build. Interestingly, someone built it in 2001 using his designs, and it worked.
00:07:26.920 Now, if we want to judge this bridge by the standard of 'release early, release often,' we have to consider it a failure. But I wouldn’t say that that was a failure for Leonardo da Vinci; I would say it was a failure of Leonardo da Vinci's time because that was a failure of wasted genius. They didn’t have the ability to leverage his brilliance, even though it was there. So, Leonardo was, in a sense, a hacker, and in a very literal sense, he was a painter. This inspired a book called 'Hackers and Painters,' which is really the champion of the idea that programmers are artists. It was put together by Paul Graham, who had previously written two technical books on Lisp that were very good. He announced that he was creating a dialect of Lisp called Arc. He made this announcement in 2001 and released it in 2008, and the world did not care. He was outraged and absolutely shocked—he couldn't believe that people did not see how wonderful Arc was. So, he created the Arc Challenge again in 2008.
00:10:38.760 The challenge was to build something that does what my code does and make it as small as my code is. He argued that 'tinniness is power' and that Arc is unbelievably great, the best language ever. Jim Weirich, who made Rake and Ruby Jams, took code that he had written with Chad Fowler in 2005 and defeated the Arc Challenge about three days later, using continuations. To be fair to Paul Graham, the idea of using continuations on the web in that way was his idea. But I personally think you still have to give him a grade of failure, and the reason is that real artists ship. That’s the moral of the story: if you have a really cool idea, don’t wait seven years to release it because the code that Jim wrote, which defeated the Arc Challenge, was based on Seaside, which derived ideas from Paul Graham. If he had released it when he thought of it, the world might have been less bored.
00:13:10.159 Additionally, this is the only website built on Arc that I know of—news.ycombinator. The server software fails catastrophically when the load gets high, so, again, it’s a fail. By which I mean 'fail,' or in other words, 'fail.' But this actually breaks my heart because the way Arc was described—the way Paul Graham spoke about it and wrote about it—was beautiful. It was this beautiful idea. So, in honor of that beautiful idea, which did not actually happen, I’ve given my code 'Archaeopteryx' the nickname AR Mars, which obviously is short for Archaeopteryx. Archaeopteryx is a Ruby MIDI generator, and that’s the code that I was just showing you.
00:15:00.000 Now, what’s MIDI? MIDI is the lingua franca for digital music. If you've got software that creates music or hardware that creates music designed after about 1979, it’s guaranteed to have MIDI in it. In some cases, this even applies to things like your iPhone. It is the common language for all digital music. It was created in the 80s and stands for Musical Instrument Digital Interface. There’s a gem for it in Ruby; it doesn’t do live MIDI like I was just doing; it does MIDI files. It’s called midi-libs. I got this thing in 2005 and combined it with some continuations code from Jim Weirich, which I obtained from the Ruby Way. I then adapted it to feed fractals to the MIDI, which allowed me to create music with it. That music was cool, but it was too freaking weird, and I’m going to give you an example so that you can see just how weird it really was.
00:17:25.760 Now, I was able to repurpose it later to generate ambient music, which didn’t sound quite so weird, but it did sound boring. Ambient music is just like 'whoosh,' which is cool, but it didn’t really captivate my imagination. So, I kind of set it aside. Then I was working for the guys who started the company Heroku. I was working at the company they had before, and one of them told me that the other had built something really interesting for Burning Man. It essentially had a database of MP3s; the MP3s were tagged, and it had some beat-matching software in C. What you would do is take this thing to your tent at Burning Man, turn a button, click to turn it on, and then just leave it running. It generates music mixes on the fly for hours. It was a real-time automatic robot DJ. I thought it was awesome, and he should do something with it. However, he thought of it as something silly, basically for fun.
00:23:20.000 I'm sorry to say this, but although I respect him, it’s cool that he had a fun project; if you refer to Archaeopteryx as a project for fun, you may get slapped! Here's an illustration of what may happen: I’m not even kidding; I’m not going to slap Ryan Davis, but it could happen to you! The reason is that real artists ship. So, let’s put that aside now. Ryan works for a company called Engine Yard, which if you’re into Ruby, you probably know about and respect because they are very cool. Engine Yard recently received an infusion of venture capital, which they are investing in open source. What’s interesting is that Benchmark Capital invested in Engine Yard; they also invested in JBoss, MySQL, and Springsource. All these companies do open-source development and make money on technical support.
00:26:54.360 So, what Engine Yard is doing with this venture capital investment is open-source development, making money through hosting and scaling. The Benchmark strategy for open source is that open source enriches the ecosystem; you use it to build the market, and then you provide services against that market. Now, it’s perfectly reasonable to wonder what this has to do with Leonardo da Vinci. Leonardo da Vinci worked in a time when he worked as an engineer for money; he would build things, and people would pay him. But as an artist, he was part of a system called patronage. What you would do is have a noble patron who would fund your living expenses, and then you would draw or paint for them; implicit in this agreement was that you would make them look like the best-looking people for miles. That has a relationship to venture capital, and I’ll get into that in a moment.
00:30:06.000 I was in San Francisco during the dot-com boom; there were a lot of startups, and it was cool. People were saying, 'Dude, startups! It’s an adventure!' The weird thing is, I wanted to be in on that adventure, but I didn’t have the patience for it. It’s strange to think that you don’t have patience for an adventure. Adventures require courage, but realistically, to make the venture capital thing work, you have to get stock options, and that takes four years. I’m skeptical because my benchmark for adventure is… I’ve slid downhill in the snow during blizzards, fell down a waterfall, and I once got arrested—admittedly for speeding tickets. I was even threatened by gang bangers; my brother came to visit me in a gang banger neighborhood, and he got shot at. When I left high school, I wanted to be a writer, so I found the cheapest neighborhood in Chicago so I could live there cheaply and write.
00:35:38.680 The cheaper your neighborhood, the more likely you are to encounter danger. But nobody was hurt; I’ve been to illegal raves in foreign countries. At one point in New Mexico, there were bear droppings outside my front door. There was a brief period when I carried a .357 Magnum at night because a cougar was in the area. My parents were building a house, and they had a guy helping them who was attacked by a rattlesnake. He killed it with a shovel and they threw it on the barbecue. Living in Santa Fe near my family was great; you could visit. But they were in my business. They said to me, 'We don’t want to be bored in retirement.' So I showed up to make their lives wonderful, and they said, 'Oh, we just threw a rattlesnake on the barbecue; would you like some tea?'
00:40:11.160 Other things that happened in that area: coyotes tried to eat my dog, and there was a psycho who threw rocks at my dad until I threatened him with a piece of rebar. One time, I spun out and did a 180 at 80 mph on a mountainside during rush hour traffic in Los Angeles on the 101. I used to climb a tree to get on the garage roof and jump off for fun. So here comes venture capital: they said, 'You need to spend four years sitting at a desk,' and I thought, 'Really? Why? Because it's an adventure!' I don’t have a high opinion of venture capitalists; I think of them as weasel-brained muppets. But the reality is they’re not fools; they’re liars. Why do they tell us this story? It brings us back to patronage; it’s a system where you employ artists to make wealthy people look good, just like venture capitalists hire programmers to build useless things.
00:44:20.680 In either case, it's artists employed to make wealthy people look good. There’s only one significant change in 500 years, which is they’ve added an escape clause—the IPO. If you get extraordinarily lucky, you can make so much money that you become an investor too, and you don’t have to spend your whole life being the investor's pet monkey. Some of this explains things about Google. When you go to work for Google, what do they do? They buy you toys. When a giant corporation spends tons of money on toys, it must mean they have an economic interest in their employees thinking and acting like children. If we get to be the children, they get to be the Daddy. Implicit in that relationship is the idea of, 'It’s my money. I’m the boss.' That’s fine; you’ve got to have a boss, and it can be good money to build cool stuff, but there’s a problem with the whole thing. Leonardo da Vinci was one of the greatest celebrities of his time; a king bragged that when Leonardo died, he held him in his arms.