The coolest thing ever
It’s fair to say that when you enter the office, it is criminal not to have a short intro theme blasted out on the stereo for all to enjoy. What an entrance. It sets the tone. It sets the mood. And the ladies love it.
Fortunately, thanks to a confluence of technology, we blew this case wide open last week at Cactuslab. We now have the DHCP server running a script when known devices join the network which plays personalised MP3 files via the Airport Express to the office stereo at ear-popping volume. When you walk into the office with your WiFi device in your pocket… boom.
The first piece of the puzzle is integrating with the DHCP server. I run our office’s DHCP server on a Linux server, and it turns out to be quite easy to execute a script when the DHCP server hands out a new lease. The DHCP server executes a shell script, which takes as an argument the hardware address of the new device.
on commit {
set clip = binary-to-ascii(10, 8, ".", leased-address);
set clhw = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
execute("/usr/local/sbin/dhcpevent", "commit", clip, clhw);
}
The script looks for an MP3 file matching the hardware address in a folder on the file server. If an MP3 is found the script attempts to play it on the office stereo using raop_play, which connects to the Airport Express via AirPlay. Bob’s your uncle.
#!/bin/sh HARDWARE=`echo "$3" | sed -e 's/:/-/g'` INTROSDIR=/data/cactuslab/share/intros AIRPORT_EXPRESS="10.1.10.135" INTRO="$INTROSDIR/$HARDWARE.mp3" if [ -f $INTRO ]; then raop_play $AIRPORT_EXPRESS $INTRO & fi
There are a few problems with this setup. Most annoyingly, if someone is already playing something on the stereo then your intro can’t play. We’re resolving this issue by adding a second, dedicated, Airport Express. The two Airport Expresses will run through a mixer. I think we’ll set the mix on the intros Express slightly higher, you know, so you can really feel it. I’ll update on the success of this later.
The biggest problem, however, is that it takes a while for your iPhone to jump onto the WiFi network. So sometimes it’s less of an intro and more of a reminder that you’ve already arrived. It’s still pretty cool. I have a feeling there’s a déjà vu issue when a device rejoins the network… but that could be changed with some more clever scripting.
I recommend keeping the intros to about 15 seconds and adding a fade-out to the end of the MP3.
Keep it classy, and please let me know if you attempt this!
-
kennewell liked this
-
matthewb liked this
-
mariovisic liked this
-
sawks liked this
-
haydenhunter liked this
-
sneak liked this
-
borz reblogged this from karlvr
-
karlvr posted this