Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Controlling Spotify through Processing/Arduino

I am making a tangible controller for Spotify (like the one from Jordi Parra, http://vimeo.com/21387481#at=0) using an Arduino microcontroller.

I have a Processing sketch running which does all the calculations with the data from the Arduino. I want this Processing sketch to be able to control different options in Spotify like: Next, Previous, Play/Pause, Volume Up/Down, Shuffle.

Right now I use an extra Arduino Leonardo which simulates key presses while AutoHotKey listens to those and sends them to Spotify. It does not work very well and I only have limited options.

I would love to get rid of that extra Arduino while getting more control. I am working on a Windows thing so Apple script won't work (for me).

Is there a possibility to control the Spotify app from Processing? Or is it possible to use the library to create a new Spotify app in Processing?

Many thanks in advance!

Paul

like image 769
Paul Groenendaal Avatar asked Nov 28 '12 10:11

Paul Groenendaal


1 Answers

Disclaimer: I work at Spotify

Right now there is no cross-platform way to control the Spotify application. On Linux, Spotify will respond to dbus commands, which means that a bit of hacking could send play/pause/next/previous. I have heard that it is also possible to control Spotify on Mac OSX via applescript, but I'm not 100% certain about this. A quick google search for "control spotify mac os x applescript" produced some interesting results, though I'm not sure how current or relevant any of them are. As for Windows, I'm not sure if/how one would control the application at all.

Otherwise, your best bet would be libspotify, for which you would need to write a Processing library to communicate with it. Based on a bit of quick research, it seems that Processing libraries are written in Java, which means you'd either need to use a wrapper such as jlibspotify or hand-roll your own JNI wrapper for libspotify.

I'm not sure how current jlibspotify is, given that they are wrapping a rather old version of the library. If you do any libspotify hacking it is better done in C/C++ with a minimal JNI wrapper, but all of this may be way more work than you are intending for this project.

like image 166
Nik Reiman Avatar answered Sep 30 '22 11:09

Nik Reiman