Forever.fm: Infinite Beat-matched Music

Forever.fm is [Peter]‘s combination of SoundCloud and The Echo Nest that plays a continuous stream of beat-matched music. The result is a web radio station that just keeps playing.

[Peter] provided a great write up on how he built the app. The server side is Python, using the Tornado web server and Tornadio2 + Socket.IO for handling live updates in the client. To deal with the challenge of streaming audio, he wrote a LAME interface for Python that handles encoding the raw, beat-matched audio into MP3 blocks. These blocks are queued up and sent out to the client by the web server.

Another challenge was choosing songs. Forever.fm takes the “hottest” songs from SoundCloud and creates a graph. Then it finds the shortest path to traverse the entire graph: a Travelling Salesman Problem. The solution used by Forever.fm finds an iterative approximation, then uses that to make a list of tracks. Of course, the resulting music is going to be whatever’s hot on SoundCloud. This may, or may not, match your personal tastes.

There’s a lot of neat stuff here, and [Peter] has open-sourced the code on his github if you’re interested in checking out the details.

Accelerometer-based game control using an iOS device courtesy of HTML5

This game of Space Invaders is played by tilting your iPhone to the left or right. It’s a demonstration of HTML5 used to link devices in-browser. The only setup that’s required is for the base device to load up a webpage, then the control device scans a QR code (or just types in a link) to connect with the game. You can give it a try right now if you want.

It only works with iOS devices but we believe that’s because mobile Safari has the ability to poll accelerometer data and other browsers do not. If this was using on-screen buttons rather than the tilt controls it would work on any device that implements HTML5. The connection is facilitated by Node.js and Socket.IO. The QR code that is generated by the host machine’s page includes a unique ID which allows the control device to link with it. Once loaded, commands from the controller are sent via Socket.IO to the node on the host machine.

As with this HTML5-based sensor data application, we think this method is important because it allows control without the need for a standalone application. We’re hoping to see a lot of this in embedded projects in the future. By serving data to a smart phone or other device you remove to need for a physical user interface in your projects, which means you can make great things while spending less.

[via Reddit]