SOmusic = music + social networks + Bluemix

Share this post:

This post is an introduction to a pet project I’m working on from time to time – it runs on Bluemix and it’s cool 🙂 If you can’t wait to read the article, you can try the SOmusic app.

A bit of background

Back in 2000s after Apple came out with the iPod, we started to have a lot of music in the palm of our hand, ripped from our CDs, bought from online MP3/AAC stores—or don’t lie to ourselves, downloaded from the Internet. With mobile devices and the low cost of storage like SD cards, our smartphones replaced iPod-like devices. During this (r)evolution, music consumption changed too. Companies like Spotify, Deezer, Beats Music, and TIDAL now offer, for a price, a large music streaming catalog. An infinitely larger number of tracks than you could fit in the largest iPod available today.

SOmusic scans social networks and tells me what people are listening to. If it is popular it might be good—or not.

Social networking is another trend that has changed how we consume information. You find an interesting video/image/article/meme, you share it on Twitter with some hashtags, your followers notice, retweet, favorite, others find this content too and that’s it, the topic is trending, the site with the article goes down—it got slashdotted as they said in the past.

Back to music; there was a time when you would tell your friends face-to-face or over the phone or by email about this new band you heard on the radio. Today, you can still do that of course, but in addition and instead of sharing this with your immediate circles, you can share on your social network—and if you were actually listening to the song on your streaming you can usually just share a link to this song to Twitter, Facebook and others. This is where SOmusic comes in, with a mission: Scan social networks and tell me what people are listening to. If it is popular it might be good—or not.

Enough said, let’s get in the gory details of how this thing is built! That’s probably the main reason you came here anyway.

Tools of the trade

The first version of SOmusic was built in a day, the result of a rainy, boring day where nothing was going in the right direction (it happens).

Having developed with Java for years (both for work and on the side here and here), I decided to build the app as a Liberty webapp – although I was tempted by Ruby on Rails (having some experience with it on another music related project). And so I started with Eclipse for the Java development,  the nicely built Bluemix plug-ins, Textmate for the webpage/javascript/css, Chrome, and of course the command line!

High level architecture

SOmusic architecture

  • collect queries the IBM Insights for Twitter service, looking for references to music links. It stores the resulting tweets into a IBM Cloudant database. In its current implementation, SOmusic searches for Spotify links – yes, I’m a premium subscriber to Spotify.
  • identify processes this database and resolves music links into song title, artist name, album title and album cover. It uses the Spotify Web API.
  • statistics aggregates data by day.
  • ranking makes the aggregated data available to the front-end in JSON.

Components collect/identify/statistics are triggered every once in a while and do not know about each other— the goal here is to be able to deploy them in multiple apps so to be scale à la microservices (although I’ve not deployed them that way yet). The triggering is done by a Quartz scheduler, embedded in the Liberty webapp; it does the job.

With no surprise, the front-end used Bootstrap, jQuery and a few plugins (Masonry, handlebars, Moment.js, jQuery Hotkeys). Masonry is responsible for the Pinterest-like layout and resize flow. Bootstrap makes the UI responsive to window size changes and smaller devices (or larger devices I should say as Bootstrap now defaults to mobile).

I’ll stop there for today. Obviously there are other aspects I’d like to share about how powerful it is to have access to historical and enriched Twitter data, how great it is that you can develop locally, and then push to GIT in Bluemix DevOps, have a build triggered and your app automatically redeployed. And also what type of improvements I’d like to put SOmusic (like country specific ranking, or SOmovies, SOtvshows, SObooks, SOso, etc). But I’ll save that for another post.

Offering Manager - IBM Cloud

More stories
May 1, 2019

Two Tutorials: Plan, Create, and Update Deployment Environments with Terraform

Multiple environments are pretty common in a project when building a solution. They support the different phases of the development cycle and the slight differences between the environments, like capacity, networking, credentials, and log verbosity. These two tutorials will show you how to manage the environments with Terraform.

Continue reading

April 29, 2019

Transforming Customer Experiences with AI Services (Part 1)

This is an experience from a recent customer engagement on transcribing customer conversations using IBM Watson AI services.

Continue reading

April 26, 2019

Analyze Logs and Monitor the Health of a Kubernetes Application with LogDNA and Sysdig

This post is an excerpt from a tutorial that shows how the IBM Log Analysis with LogDNA service can be used to configure and access logs of a Kubernetes application that is deployed on IBM Cloud.

Continue reading