Sunday, November 2, 2008

Rickroll Detector

Some people evidently don't understand when a meme is dead, or deserves to die. Rickrolls have been around for far too long and have even been picked up by the mainstream media. It's just not really funny anymore.

Today I was kind of bored and made this in a few hours. It's a system for checking if a link is a rickroll. You provide a URL, then some audio analysis is done, and the result is a plot showing whether or not it was a rickroll. What's nice is that it will also detect spin-offs like Barak-roll, scary roll, and so on.

How it works:
A Launchorz script directs what happens.
First, your audio is muted automatically.
Then, behind the scenes, the url is opened in Firefox. The program Total Recorder is used to capture the audio played by the webpage.
The page is closed after 15 seconds of capturing audio.
The audio is saved as a wav file in a temporary location, and your audio is unmuted.
Then, a MATLAB script is used to analyze the audio.
The audio is normalized to approximately the same volume.
Then, the cross-correlation is taken between a reference Rickroll audio and the recorded audio.
If there are peaks in the cross-correlation above around 200, then it is likely the page contained a Rickroll.

Results: After adjusting of parameters in the MATLAB code, the results are pretty good.

"Warning: rick-roll detected"


"Safe: no rick-roll detected"


Kylie Minogue's "I Should Be So Lucky".

(The mostly-evenly spaced peaks correspond with the steady beat in the music.) The results would probably be even better if the comparison was done in frequency, instead of in time. But I'm not about to waste any more time than the few hours I put into this.

Here's the script I used but it needs Launchorz, MATLAB, and the shareware program Total Recorder.

No comments: