Can I Do That? Music in Tableau
I often think about unusual things I’d like to try to create in Tableau. These ideas tend to be a little “out there” and have little to no practical value whatsoever. However, I still like to make an attempt at these ideas because I love to push the boundaries of what’s possible in Tableau. And, even though what I’m creating may not seem to have many real-world use cases, there is still value in building them; I always learn something along the way and, hopefully, some of you who read my posts and view my work may learn something as well. In addition, our community is really amazing and often a technique which may seem to have limited practical value can be re-purposed or reinvented in a way that makes it very practical. And, if all of that fails, then at least we’ve all had a little fun along the way. All that being said, my next two blog posts (including this one) will address two such ideas that seemingly have no practical value, but were fun and challenging.
Can We Make Music in Tableau?
We’ll start today with music. I recently started wondering if it would be possible to make music in Tableau. I had an idea of a piano that allows you to hover over each key to play the sound of that key. And, by doing that, you could potentially play some music (or at least some very basic music). Because Tableau doesn’t natively play sounds, my only option would be to use Tableau’s Web Page object and URL actions to play individual online sounds for each key. Luckily, I was able to find individual mp3 sounds of each key on www.freesound.org. I then built a data set with a row for each key and with the URL of each sound. I then visualized the keys in Tableau as a bar chart, coloring the keys white and black as appropriate. Then, using a URL action on hover, I “played” each sound clip. While you can’t play full blown songs, you can play simple single-key songs. As a kid, I remember playing Mary Had a Little Lamb this way so I tried it and it works! Here are a few examples of songs you can try: 5 Easy Piano Songs
After finding some success with the piano, I thought it would be fun to add a couple of other instruments. So, I found sounds for a drum set and for a guitar. For the drums, I used the Interworks Drawing Tool for Tableau to trace polygons for each drum and cymbal. And, for the guitar, I did the same but instead of polygons, I drew lines for each string. The URL actions were then applied when hovering over a drum/cymbal or a guitar string.
Here’s the final visualization. Click on the image to interact with it. And, if you make any music using it, I’d love to hear about it!!
Using the API
Before I wrap this post, I do want to point out that others have done way cooler things with music in Tableau than me. One of the finalists in the 2017 Tableau JavaScript API Hackathon was Gyula Laszlo, who created a dynamic drum sampler. It’s really quite amazing, so I’d definitely suggest that you check it out here. Be sure to watch the video and follow the link to the interactive visualization.
Ken Flerlage, February 10, 2018
no sound
ReplyDeleteGood post
ReplyDelete