Thursday, June 12, 2014

The original Super Mario Bros Theme... for Bass Drum!

Back in high school, marching band took up even more time than I spent on homework in any given week. Being a member of the drumline added yet another level of demands and responsibility -- but that's all part of what it takes to play on a line that, if memory serves me correctly, would have beaten the University of North Texas' drumline at PASIC's drumline competition in 2002 had we not been penalized for crossing the physical boundary lines of the competition at some point.  (Nevertheless, we still won among high schools.)  Even though it has been almost 10 years since I graduated high school, their drumline is still kicking butt and constantly taking top honors at every contest they enter.

In middle school, I discovered I had the ability to play along with songs by ear as long as I heard them emough times and knew how they went.  In 9th grade, the realization that I had perfect (or really darn good relative) pitch always fascinated the other band members; I was often tested with random notes or chords, and never failed to impress.  My drum instructor would even ask me for the pitches of the drums -- yes, drums have pitches too, especially timpani & bass drums!  (Now I will admit it's much harder to tell a snare drum's pitch, so usually I'd jokingly say it's a "Bang Flat.")

I also became married to the bass drum in marching band, and became well-known as the one who carried arguably the heaviest instrument on the field -- the 30" bass.  Only the tuba section or tenor drums came close in weight, and this group of players carried a special level of respect for each other.  As I played the 30" bass for my second, and then my third, year, I was used as an inspiration tool on the field (i.e. called out as an example by the directors & techs) to those who carried a lighter instrument yet whose marching technique was not as good.  One of the drum majors admitted to watching my feet to get the tempo on one of the songs we played --- Wow!!!  I thought they always watched the center snare drum player (who is usually the highest position or best player on the line) to get the time, so I took that as a very high honor.

Ok, enough gloating.  During that time, I also dabbled with music composition on the side (more on that in a future post perhaps ;), and found inspiration one football-game night when it sounded like the opposing team was playing a few bars from the Super Mario Bros. theme.  I thought to myself, "Why aren't we doing this?"  Over the summer, after the long, sweaty rehearsal hours, I brought my microphone to the drumline equipment room and took samples of most of the drums to make a drumline "SoundFont."  This soundfont was the basis for my experimentation in MIDI and composition of the Super Mario Bros. Theme for bass drum, which you will find below.

I then formally notated it using whatever version of Sibelius was around 10 years ago.  You're probably better off simply transcribing it for yourself from the image here, because me trying to find the actual Sibelius file along with installing some archaic software on hardware that has long since moved on, would likely be an exercise fraught with disappointments.

So, at last, here it is!

So, one note about reading this:

The score is written for 5 bass drums, with the biggest (lowest-pitch) one notated below the staff ( partially highlighted -- makes it easier to spot your notes), and the other drums are on each "space" on the staff in decreasing-size (increasing-pitch) order.  A note on the middle line (bass clef "D") means that all basses will play.  Thus, it's not the real notes of the Mario Bros. theme. 

Unfortunately, one of the bass drummers left the drumline right after I rolled this out, so we never got to play it.  You just can't do Mario very well with only four bass drums, so maybe it got passed down over the years and played by others.  I really don't know what happened with it since.  However, this copy still sits in a page protector in my marching music binder, which has pretty much remained untouched since I graduated.

For the record, the (C) 2004 is just for show.  It makes things look a little more official (which is cool to do when you're in high school), but it's more for posterity's sake than actually claiming any rights on anything.  You should know I'm way bigger into open-source and open sharing than copyrights anymore.

Thursday, June 5, 2014

Teaching Arduino to the lil' ones

Maybe you've figured out by now that I like to make blog posts on Thursdays.  I'll skip a week or two here & there if I don't have new content or anything prepared, but last Thursday, I simply forgot to post some of my "canned content" due to sheer exhaustion from a week culminating with teaching Arduino to a group of fourth-graders!

Making a Difference

You never know what opportunities will knock on your doorstep from demonstrating at various events around town, and of course, simply showing up to meet people could lead to that million-dollar introduction.  As such, we were invited to present LEDgoes at the Frisco Mini Maker Faire back in April, and were busy showing off this:

The maximum-length LEDgoes marquee, 64 panels, 8 feet long!

Area educators were on the prowl looking for fun things to engage their students, and one of them just happened to wander by our booth and inquire into the details of our project.  We mentioned the boards are based on Arduino microcontrollers, and that got the gears turning: she is looking to build curriculum for 4th & 5th-grade gifted/talented students around Arduino, microcontrollers, and programming.  We traded contact info, and eventually scheduled a date for... last Thursday.

It was a bit of an exhausting week for me anyway, as Stacy's car was broken and I needed to shuttle her everywhere too.  It's a good thing our office buildings are only about 1/2 mile apart, but she works different hours than I do and adjusting to her wake-up time was not easy.  However, I'm blessed to work at a company which allows for up to 4 paid volunteer hours per month, so I took advantage of these paid hours last Thursday to drive to the elementary school with some of my own gear to share and projects to amaze with.

I got a warm welcome from the students on the way in, and jumped in telling them a little bit about myself, what I do, what I'm interested in, and how I got there.  I showed them the completed "Inklings of a Project" that I posted here a while back and told them that even though it looks like all the LEDs are on, in fact only one LED among the 104 in the charlieplexed LED array are turned on at any given instant in time.  They were, of course, quite fascinated by this, plus by the tiny Bluetooth module I passed around among them (yes, I didn't need to tell these kids what Bluetooth was -- they are started early on technology these days!)  There were many more gasps of amazement when I told them to compare how fast you can see things change (less than 30 times a second, usually) to how fast the Arduino's chip can change things: up to 16 million times per second.  They were blown away by that, but told them that was nothing: the Asus Eee netbooks they all had in front of them ran much faster, up to a couple billion instructions per second!

The truly smart ones can explain anything to anyone...

Then began the fun part: there is an awful lot that needs to be explained to anyone just starting to learn this stuff, whether you're in fourth grade or even an adult looking for a new hobby.  I needed to explain the basics of inputs & outputs on the chip, and how these could be used to read & write data in & out of sensors, lights, or any other electronic widget you can imagine.  These kids probably had not been exposed to the concepts of electricity yet (i.e. voltage & potential), so I had to carefully explain how the pins behave, and why they do what they do.  The first time I tried explaining electronics to them, I got back puzzled looks across the room -- oh no, time to reformulate!  I paused for a couple moments and picked another analogy that would resonate better.  Forget about declaring the pins as inputs & outputs: think of them like light switches on the wall.  You can flip them on & off as fast as you want.  The chip can flip the switch, or another device you connect to the chip can flip the switch.  Their faces started lighting up, and so I knew I could proceed.  The awkward "What?  I don't get it." phase was over.

Now that the chip had been discussed, it was time to demonstrate how the chip would "toggle the light switch."  The kids opened up the Arduino IDE and loaded the simple "Blink" example.  I walked them through each line of the code, told them what setup() and loop() does, and then had to explain what a loop was.  (Actually, the teacher would sometimes jump in and walk the kids through a brief exercise to help shed light on some of these concepts, and the loop was one of them.)  Then, I noticed that Blink has some simplistic use of variables, which I'm sure the students would not learn about in math for many years, so I phrased the line "int ledPin = 13" as "the secret word for 13 is LEDPIN; LEDPIN means 13".  Once we walked through the code, I had them load it onto the Arduino Unos, and soon, all of them were getting it to blink.

Afterward, I decided to do a little more advanced exercise in variables with them, and engage them further by finding exactly what blink rate can be set before the LED appears to be on constantly.  I solicited a name for the variable from among the students, and an initial value.  At this point, I needed to explain microseconds to them, as the argument for the delay() function is in milliseconds and they hadn't been introduced to these scientific-notation prefixes yet.  To check their understanding, I picked some random values and asked them if the light would blink on & off faster or slower than 1 second, and they seemed to get it.  Once we had our variable in place and the value, I had them replace delay(1000) with delay(waitTimer), and experiment with different values of waitTimer to see at what point the LED would appear to be solidly on.  They got it down to about 15 milliseconds before it appeared to be solid.

Soon thereafter, the students wanted to experiment with longer delays -- one group tried to set it as 1 billion.  I told them that wasn't likely to yield the result they expected, and then tried to explain the concept of binary to them in order to convey why the chip can only store numbers up to a certain value.  I even emphasized that in my field, you don't need to know a lot of advanced math like calculus; just knowing how to count in different number systems and your Powers of Two go a long way.  For instance, the maximum value for an "int" number on an Arduino Uno is 32,767, or 2^15, because the 16th bit is reserved for the sign (+/-).  Any number beyond 32767 would suffer from aliasing, and possibly become negative, due to two's complement.  (I didn't dare attempt to explain two's complement to them. :-P)  To put this in a base-ten perspective, say the largest number you can hold is 9999 (four places), and you provide it 106531: the system is only going to remember 6531 (the first four places).  Later on, for the teacher, I explained how the 16th bit in the binary number representing 1 billion is in fact a 1, thus the processor interpreted that number as some negative value and the kids did not see any delay whatsoever.

At this point, some of the kids had to go off to lunch.  Bummer.  Some brought theirs back to continue, and then I showed them how to wire up another LED in series with the blinking LED so they could begin to understand the layout of a breadboard.  Now I had to teach them which side of an LED is the anode, and which is the cathode, so they could wire Pin 13 into the anode and Ground into the cathode.  One of them put the jumpers in backwards, so I simply flipped around the LED on the board and showed them that was perfectly valid too.  Voila!

Well, that was about it.  I felt like we could have pressed on with more material, but realized they'd probably had enough; what I had already showed them would probably be enough for them to think about for the whole summer.

However, that's not the end of the story: to save you from a bunch of interruptions, I omitted all the times when the kids would blurt out some tangentially-related questions during my talk, including "What college did you go to?", "How much money do you make?", and "What other types of Arduinos are there?"  Many times, these questions were tempting to answer, and would lead me down some long tangent; I had to be careful to stay on-topic.

Finally, as standardized testing was over, the teachers pretty much had free reign over the kids to cover additional material, give them extra recess time, or whatever suited their fancy.  Some of the kids seemed to be in "summer break" mode already, and really wanted to play the Cookie Clicker game.  As I was chatting with the teacher over lunch (including a quip that these kids will probably replace me at work in 15 years), it came out that I played percussion in high school and had fast hands; the kids caught onto this, and soon I was recruited to click on everyone's cookies.  (I was wondering why the kids were talking about buying grandmas, which apparently you can do in this game with so many cookies, and quipped to the teacher that whatever this site is needs to be added to the school proxy's blacklist. :-P) It was a darn shame that I couldn't put my test automation skills to work here: as someone who is now doing Web UI testing for a living, I could have written them a really good script to click on that cookie faster than they could ever dream.  Sadly, the IT permissions on these computers prevent them from installing any new software.

On the way out, the kids presented me with this neat booklet containing thank-you letters thanking me for spending time with them to teach Arduino.  It was a sweet gesture that a couple of them actually brainstormed, created, and put together for me.  I also told the teacher to devote some time to teaching them how to count in base 2 so they'll be better prepared for my explanations on why certain things happen, and possibly when it comes time to read & write values from & to entire output ports on the ATmega chips.