Let’s Get Down to Business: Making An App That Helps You Sing in The Shower

The shower is considered the last bastion of freedom from technology. The one place where you can collect your thoughts without the buzz and business of your electronic devices. The one place you can find relief from your notifications and distractions.

Well, I’m here to ruin that.

A week ago I went to HackNC with an idea for an app. Now, it may not connect the world like Facebook, it may not make the entirety of human knowledge a few mouse clicks away like Wikipedia, and it may not catalyse the switch to sustainable transportation like Tesla Motors is, but if you’re forgetful and you have a waterproof smartwatch it lets you sing in the shower.

It’s simple enough that it works with any device that displays textual notifications from your phone. It’s advanced enough that it works with any song that happens to be called “I’ll Make A Man Out Of You” from the original soundtrack of Mulan by Disney Pictures.

It was originally intended to be a Pebble app, and that was the smartwatch I tested it on when I wrote it, so you may find quirks if you use it with other wearables.

 

Alright, let’s dive into the code. It’s basically all boils down to one recursive asynchronous function. Recursive means, “Goes back and does it again with different parameters” and asynchronous mean “happening at a different time that everything else is happening”. The “different parameter” in my case was “the next index in the array containing the time and text for the next lyric.”

So I’ve basically got this huge call stack executing on the side that waits the amount of time between two lyrics and then sends you a notification containing the text of the next lyric when the time is up.

 

See, if you knew nothing about Android you wouldn’t think that this program would be as complicated as it is. The essential code itself isn’t that complicated and any Junior level CS1 student knows what a recursive function is. As a beginner hacker myself I’ve determined the hard part about hacking isn’t the programming, it’s the setup. If I had to break down my time working on the project hour by hour I’d say the meaty parts of the code only took about an hour to write once I figured out where to put them. The rest of the time it was really just setup, trying different API’s, and waiting for my code to compile. (Gradle!!!!!)

I had massive help from one of my friends I met at HackNC, Jeroen Goossens. It may very well have not even happened if it weren’t for his guidance and the fact that he lent me one of his HackWare laptops since my own laptop was taking up to 30 minutes to compile source code. Also, shoutout to my teammate, Jay. Even though I didn’t get to use any of his code, his work on the Pebble side of things allowed me to rule out a few options when figuring out how to implement this.

And that’s pretty much it! I’ve included a link to GitHub with the full codebase so feel free to take it and do whatever what you want with it.

 

You can find the code here: https://github.com/eric-smithson/shower/blob/master/app/src/main/java/com/example/eric/shower/MainActivity.java

You can find the writeup on Devpost here: http://devpost.com/software/shower-singer

You can find me on Twitter for Elon Musk retweets here: https://twitter.com/eric_smitti

 

(Psst, Come to Knight Hacks!)