We Make Awesome Sh

Stylophone Helicopter Game

January saw 27 hackers descend on the French Riviera for a special 45
hour Music Hack Day. I brought a Stylophone along, and intended to use
it to make a game. If you don’t know what a Stylophone is, it’s a retro
toy that makes horrible noises:


So, I did some research, and figured I could detect pitch with the Web
Audio API. I hooked up a low pass filter, and an FFT, and stuff, and
tried to get a number for each key. I knew it was possible, because I’d
seen Craig Spence’s guitar tuner.
Annoyingly, the tone wasn’t as clean as I was hoping, and there was a
bit of overlap in the notes it detected from the low end to the high
end. I decided to just use the lower notes.

Then, I took a open-source helicopter game (you know, the kind where
you’re flying through a tunnel) and stripped out the existing controls.
I put in my pitch detection code, so that the first 5 notes of the
stylophone mapped to different heights.

Here’s a video of it kind-of working:

What worked:

It did detect pitch pretty well for the bottom half of the notes - so
long as it was a direct audio feed.

Using existing helicopter game code saved a lot of time, as the actual
game elements weren’t the point in this experiment.

What didn’t work:

The Stylophone is just a toy, and isn’t precise at all. I’m also pretty
sure the pitch changes with the battery level.

It seemed to work better with the audio plugged in. When I used the
speaker, it didn’t work nearly as well. Especially in a noisy room.

Stylophone needs to be tuned to a particular pitch (not ideal if you
expect other people to use it)


Was a lot of fun. Had a lot of the weekend spare, so moved onto
something else.

Give it a go, if you have a Stylophone to hand.

Recent Articles

comments powered by Disqus