Red Five reporting in

Posted on 14th December 2010 in Something Daily

The semester is over. I mean, I still have finals to take in the next two weeks, but I don’t really have to go to any of my classes anymore apart from those. I’m free, sort of. I can do what I want now, which largely involves blogging and gaming. But that’s not all! I do other stuff too, sometimes! More on that later.

As I mentioned yesterday, I only got four hours of sleep Sunday night due to mitigating circumstances, so I was, as predicted, completely toasted by the end of yesterday. I was essentially falling asleep during our film mix session, and I actually did upon trying to watch a skate video with London when I got home. Actually, we were both totally exhausted. We went to bed at eleven, which was awesome. I really need to do that a bit more often. It feels so good today, like I can stand up and face the problems of the day like a champ (for example, the ridiculous 20 degree weather this morning that had my fingers falling off inside my gloves). It’s ok though, I have a rad rocking awesome pea coat, a sweater, gloves and a scarf. Problem solved. We’ll be presenting our film mix tonight at the class, and I’m hoping it goes smoothly. Unfortunately I can’t post it here, because it’s part of a larger project that’s not mine. But instead, here is a photo of my completed electronics project!

That’s my MIDI controller, “Red Five”! It’s an Arduino and a PC board encased in a tin Star Wars lunchbox that I found at a comic book store on St. Mark’s. In auto mode, it sends out a constant stream of MIDI note-on messages, with pitch, rate, and note length determined by the knobs. Also, every time it sends a note, the Death Star blinks. In manual mode, it’s the same except that instead of sending a constant stream of MIDI notes, notes are only sent while the blue button is pressed. The cables coming out of it are a USB (for power) and a MIDI connector (for data). I’m also going to look into using a normal wall wart for power instead of a USB cable – it seems a bit annoying to have to have a computer present whenever this thing is used. But yeah, it’s rad, and it actually works exactly as I intended it to, unlike last semester’s fiasco of a “Darth Compressor”. I’ve tested it with PureData notein patches as well as my Alesis Ion – the latter is especially cool because of all the physical sound controls it has that let you warp the synthesis in crazy ways.

The great thing about this project is that, since it only generates commands and not actual audio, I can connect it to any old instrument with a MIDI in and demonstrate it for people. As long as that particular instrument sounds cool, people will assume that “Red Five” is the one making the cool sounds, when in reality it’s essentially just “telling” the instrument what to do. Maybe I shouldn’t have mentioned that here. Never mind, there is no “should”, anyway.

I just got another letter from my good friend Monica, who’s doing a gap year in France, so I’m going to go write her back. As an epilogue to this sweet Tuesday morning post, I would like to share with you the current state of the paper recycling bin in our apartment.

Failing is better than not trying, but success is better than both

Posted on 13th December 2010 in Something Daily

Hi there. Let me just begin by giving a heads-up to Jen Barbosa for being an awesome person. We hung out two nights ago until way too late at night and it was quite nice. Actually we hang out often (and it’s quite nice then too). I just wanted to say thanks for being my rad friend, Jen.

Last night ended up being awesome once again – much better than expected. All around, the Upright Citizens were funnier than last week, although there were still a handful of jokes that I was embarrassed to be laughing at. It was probably a result of some of the weird, weird stories that the show started off with. They start each show by asking the audience what they did over the weekend, and last night’s stories were kind of crazy. There was one about a homeless guy who walked into a Starbucks and started setting up his clothes on individual chairs around one of the tables, and was subsequently vomited upon by a man who ran into the store. There was also a semi-pro wrestler/dominatrix in the audience who told this crazy story about a mansion she visited to do a “session” – it was just nuts. But the show itself was fantastic, as was the rest of my evening. I didn’t get to sleep until 2:30, though, as my roommate had a guest. I had to get up this morning at 7 for class, so I can expect to be pretty toasted in a few hours. I’m thinking seriously about not going to my 5 PM class – it’s finals week. Come on.

Today will involve the last stages of my electronics project design. Yesterday I finished the prototyping process and soldered the circuit to a PC board. It works fine, first try. Not really a big deal or anything, I’m just awesome at soldering. Circuits are scared of me. I also got some knobs to fit on top of my potentiometers from Radio Shack, and stopped by the St. Marks comic store for another Star Wars lunchbox to use as an enclosure. The first one (last semester) had Darth Vader on it, so this one has Luke, Leia, Han Solo, and Obi-Wan, of course. I’ll be drilling a bunch of holes in it this morning, and hopefully not hurting myself too badly with the power tools. I’m actually going to go start that right now.

I tried drawing a “hawk woman” last night, but then I realized that I suck at drawing. That was the end of that. Instead, I ate a large quantity of Kit Kat, played some New Mario Wii and watched Arrested Development.

Life Electronic

Posted on 12th December 2010 in Something Daily

Yesterday and today were both very much electronics-themed. I went in to Steinhardt (again!) at 11 AM yesterday to help a classmate with her final project. I thought helping her was going to be pretty easy, but it ended up being a big pain due to the lack of barebones MIDI equipment available on the 8th floor. I spent about 2 hours banging my head against a wall over the apparent absence of MIDI note reception by the Arduino, finally managing to pinpoint the problem. I think it has to do with the fact that the MIDI controllers available were sending more than just note messages. Either way, she thought I was quite helpful and took me out to lunch – a place called Cafetasia that has a lot of different types of Asian food. I got something called Gyo-Za and it was nuts. Not that it actually contained nuts, but it was just awesome. Crazy delicious and covered in soy sauce. Also, this was around 3:30 PM. So once again, I succeeded in spending most of my day in the Music Tech department. That’s why I’m staying far, far away from that place today.

Also, last night was the Charlie Brown christmas special viewing in our room! I made everyone hot chocolate and we watched the special…it was awesome. It’s great to have everyone together like that, and I liked feeling like the “mom” of the situation, as odd as that may sound.

I woke up at around 9:30 this morning and got immediately to work on finishing my own electronics project, which is due on Thursday. I had originally intended to use a multiplexer to increase the possible number of controls for MIDI note sends, but upon trying it again this morning I sort of got over that idea. So I got some knobs and a PC board, as well as another star wars lunchbox to use as a case, and soldered the whole thing in about half an hour. Once again: first try, no mistakes. I’m pretty much the man at soldering. I don’t know if you knew. So apart from putting the whole circuit in its enclosure, I’m done with the project. And after that, it’s just a few more final exams and I’m good to go. I was expecting to work on this project all day, but now I have time to do whatever (that is, play TF2!). Good times. And I’m going to the Upright Citizens again tonight, hopefully it’s as good as it was last week, if not better.

How to learn Java in 9000 easy steps

Posted on 19th October 2010 in Something Daily

It’s hard to match the feeling of solving a difficult programming problem, especially after it’s been an obsession for far longer than would seem appropriate. Having learned a big portion of what I know about programming through trial and error, I’m certainly used to this type of issue popping up – you know, the kind where it seems so obvious that there theoretically exists a solution, but what that solution is is so completely beyond you.

Like last weekend when I learned how to load fonts into a Java app (a game I’m working on involving dinosaurs in space). It’s a sweet 8-bit videogame type font that I found on a free fonts site, very cool looking. After finding some example code from the Sun (now Oracle?)  demo pages and adapting it to my needs, my program was completely laggy and using about 20% of the CPU time. I tried moving the method that loaded the font, I tried saving the font in a Font variable, but kept hitting a wall when I tried to show paintComponent() the font data.

As I’ve learned time and time again through hours of  smashing my head against things, procrastinating, and eating too much chocolate, the surefire way to solve one of these issues is to start thinking like a computer. (I guess I don’t do this enough as it is, maybe I should have played with Legos more when I was little). But upon going line-by-line through the changes I’d made to the program since the CPU-destroying slowdown had begun, I discovered another previously unknown quirk of paintComponent() and the Timer class. As it turns out, my getFont() method was in the body of my main GamePanel class, outside the constructor and right next to paintComponent() (the GamePanel constructor contains the main Timer I use for animation, which uses repaint()). As a result, my getFont() was being called once per frame (!!!) which was causing the font data to be re-grabbed from the disk forty times every second. So apparently the Timer does that to methods that are on the same hierarchical level as paintComponent(). Who knew? Not me. But I moved getFont() to a completely separate .java file and that solved the problem immediately. And it took about 45 minutes to figure that out. Needless to say, that was the last problem I attacked that night.

That’s a pretty typical coding session for me. To summarize:

  1. Find the simple solutions to a bunch of problems that seemed impossible last session
  2. Gain confidence and decide to tackle a big new area of the app
  3. Quickly run into new, seemingly unsolvable problem
  4. Try at least five different approaches to solving the problem
  5. After about 90 minutes of this, close computer and play Super Mario World
  6. Repeat

Check out these pictures from the set of The Empire Strikes Back. Very cool.