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.

Python Script Lets You Monitor Multiple Serial Devices At Once

Not knowing what’s going on inside of your electronics projects can make it quite difficult to get the bugs out. [John] was bumping up against this problem when working on wireless communications between several devices. At just about the same time his friend came up with a script with lets you monitor multiple serial devices in one terminal window.

We’re used to using minicom, a Linux package that does the job when working with serial connections of all kinds. But [John] is right, we’re pretty sure you can only connect to one device per minicom instance. But [Jim’s] Python serial terminal (available in this git repository) allows you to specify multiple devices as command line arguments. You can even use wildcards to monitor every USB connection. The script then automatically chooses a different color for each device.

The image above is from [John’s] wireless project. Even without any other background this shows how easy it is to debug this way rather than tab back and forth between windows which gets confusing very quickly.

LED Fun And Light Painting With The PyMCU

pymcu-led-pov-writing

Recently [Richard] at [pyMCU] was nice enough to send me one of their units to try out. As featured here before, this little board allows you to control physical things using your computer and the Python programming language. After evaluating it and making a LED blink, there were a couple other LED projects I wanted to try.

The first idea was to make a LED chaser. This was quite simple, using a little code and plugging in a few LEDs. From this, since you can make the LEDs chase each other, then in the right sequence it should be able to be used to display images using long-exposure photography. Be sure to check out the video after the break of this 10 LED chaser/light bar being assembled.

The results of this LED light bar experiment were really cool, writing some simple text and image with 10 LEDs. Considering the low component count, this is one of the simplest light bar builds that we’ve seen. Programming was simple as well, since the computer using Python does all the processing of the drawing as well as physically turning the LEDs on and off. Of course this setup isn’t without its limitations, having to be connected to a computer being the most obvious. Continue reading “LED Fun And Light Painting With The PyMCU”

LEDs Fade To The Music Using A Python Filter

This little LED rig fades in time to music. The hardware itself is quite simple, some LEDs connected to the PWM pins of an Arduino. But the signal processing is happening on a computer using a Python script.

Many of the projects we see which pulse lights to music use the MSGEQ7 chip to perform hardware processing on the audio signal. But since [Zolmeister] is using a computer to play his tunes he took a different route. His Linux box uses PulseAudio to handle sound. This allows him to record from the audio playback which provides an internal source for the pyAudio package. His Python script saves snippets of the streaming audio to .wav files. I then normalizes the volume level and uses the amplitude to set a PWM value before deleting the sample and moving onto the next. These values are pushed to the Arduino at 115200 baud to achieve the results seen in the video after the break.

Continue reading “LEDs Fade To The Music Using A Python Filter”

Hacked Kobo Becomes A Weather Display

The Kobo e-reader has been hacked for a while now. It’s pretty easy to enable telnet access by modifying some files. Once [Kevin] was able to telnet into the device and draw to the display, he created the Kobo Wifi Weather Forecast. This hack was inspired by the Kindle weather display that we discussed in the past, but this version runs entirely on the Kobo.

The weather report software is written in Python using the pygame library. After loading the software package onto a Kobo, a few commands are run over telnet to set up Python and run the display. Since Python and pygame run on the Kobo, it allows for direct access to the e-ink display.

There’s a lot of possibilities for a internet connected e-ink device running custom graphics code. It’s asking to be turned into any kind of display you can imagine. What ideas do you have for a custom e-ink display? Let us know in the comments.

The Python Programming Language For Physical Hacking

We see projects here all the time that blend computing with the real world. Some people are naturally stronger on the mechanical end of things, whereas some are better with electronics or coding. All three specialities can be needed depending on your project. If your weakness lies in making a computer do your bidding, I might suggest that the Python language is a good one to learn.

I’ve been going through Learn Python the Hard Way, which is offered for free online, or you can pay for it if you so choose. I’ve published my thoughts on lessons 1-10 and 11-20 so far. As a mechanical engineer with limited (but not totally nonexistent) programming skills, it’s been an excellent experience so far.

If you’re wondering if Python is a good language to learn if you’d like to participate in [HAD] style projects, why not check out the following projects featured here:

Or just do a search of [HAD], and you’ll find many other projects for inspiration. If you’ve got a Python project to share, be sure to tell us about it in the comments!

Hackathon Results In The Facebook Book

[Jeremy Blum] and [Jason Wright] pose with their project at the end of a 24 hour hackathon. The Facebook headquarters in New York City held the event as part of their Summer of Hack program. As an homage to the hosts, the hacking duo decided to create a physical book and populate it with the virtual Facebook. And what do you call such a creation? The Face(book)^2.

The video after the break gives the best overview of the hardware, but here’s the gist of it: They started with the largest hardcover book they could find, hollowing out its pages to house their own hardware. When you open the book it calls back to a computer over an Xbee link with a request for data. The python script on the computer pulls the newest from a Facebook feed, sending it back to the book to be displayed. There is a graphic LCD and four character LCDs built in for this purpose. There’s also an accelerometer which is used for detecting page turns when the cover is jostled. The rest of the interactivity is provided by a few tactile switches mounted next to the smaller LCD screens for navigation and the ‘like’ feature.

Continue reading “Hackathon Results In The Facebook Book”