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.

15 thoughts on “Forever.fm: Infinite Beat-matched Music

  1. “beatmatched”

    I don’t think that word means what you think it means. There are many songs that can’t or shouldn’t be mixed because of tempo, key, and style differences.

    For example, I just heard it BLEND Adele – Skyfall into Tetris by Doctor P. Not even remotely a ‘mix’.

    For orchestral intro/outro songs or non-beat-oriented music, it’s pretty good.

    1. No, it *should* be beatmatched. That’s what the Echo Nest integration is for – it analyses tracks and provides extremely detailed information which includes things like tempo. So transitions should only be happening between tracks that are close in those respects.

      That said, generating a tracklist that perfectly minimises the differences between consecutive tracks would require solving the TSP – since you can’t do that, you occasionally get transitions that are less than perfect, as you noticed.

      1. I’m not trying to lessen the accomplishment – it is an extremely sleek site with a nice bit of kit on the backend. However, it should *NOT* be stated as ‘beatmatched’. It should be ‘blended’.

        I didn’t ‘occasionally get transitions that are less than perfect’. I got complete trainwrecks, constantly, every mix. I have yet to hear a single properly ‘beatmatched’ mix from this thing over several hours of listening.

        I’m not familiar with EchoNest, however, I am extremely familiar with audio analysis software. Audio analysis is not the most fun thing I have coded. I can attest that it is a PAIN in the ass to process audio frames, and as music varies so much between styles and songs, auto-matching never works for all music.

        I have been a DJ for about 12 years. I can say definitively that this is not proper beatmatching in any way. As far as I can tell, there is no alignment of the standard 8-beat divisions which DJs rely on to beatmatch, and there is no alignment of measures and parts of the song to avoid the ‘shoes in a dryer’ effect even if the tempos are made the same.

        1. Since you seem to have experience maybe you could tell us of any other software that does this better. The worst thing I can say is that the vocals mostaly badly “beatmatched”.

          Still it’s a wonderful automagical web radio..

  2. Not a hack. This is a business card masquerading as a free online service.

    Anyway, certain songs keep coming up and are obviously being used as “glue” in the playlist. That’s a kink that needs to be worked out, but it’s probably beyond the scope of the purpose of this piece of work.

  3. Complex programming resulting in software that effectively DJs like Paris Hilton. (pressing the sync button to cue the next song at the end of the previous track). Now if only you could have it pre-record its sets for large live performances, it could take on David Guetta as a Top DJ. All joking aside, it is pretty nicely done.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.