Spotify on foobar2000

Update as of 6/25/2017: It's half way through 2017 and Spotify still hasn't announced anything new about libspotify, so I think it's safe to assume they're not going to do anything about it for a while. That means that the life of foo_input_spotify, at least for the foreseeable future, relies on finding a capable alternative to libspotify.

Unfortunately, all the ones I know of are abandoned or can't be used. spotify-websocket-api and node-spotify-web would work, but they're both in languages that you can't write foobar2000 plugins in (Python and Node, respectively) and they seem abandoned anyhow.

The best bet for foo_input_spotify is librespot (thanks to @aqua_rar on Twitter for linking this to me). It's a fully capable, as far as I know, reverse-engineered Spotify client. This means, of course, that there's a risk that this project will get hit with a C&D when Spotify notices, which I believe is what happened to despotify. For those of us who could care less, however, there's a bigger problem: librespot is written in Rust.

This isn't as big of a deal as if it was written in Python, or Node, or in fact most other languages. Rust and C++ both compile to native code and can, in theory, interface with each other. As far as I know, this has to be done manually, going through and writing an interface yourself - though there's some projects like rusty-cheddar and rustcxx which could make it easier.

But this means that there's the possibility that foo_input_spotify could be rewritten to work past the death of libspotify. Further research is required.

Update as of 1/25/2017: This post seems to be getting more attention than I expected, so I'd like to clear some things up. First, I'm not the developer of this plugin! The real developer abandoned it in 2011, and the updates to libspotify, foobar2000, and Windows in the interim left the plugin broken. I did fix it up, but pretty much all I did was update the libraries involved and update the project for Visual Studio 2015. The true credit goes to Chris West for creating the plugin.

Secondly, This plugin will almost certainly not survive the year. As I mention in this article, Spotify has discontinued Libspotify, and states that it will be shut down some point this year. It hasn't happened yet, and for all I know it could happen at the end of the year, but this plugin's days are numbered. Our only hope is that Spotify claims that they'll be releasing a replacement desktop API to replace Libspotify. This hasn't happened yet, and it might not happen before Libspotify is shut down. But as far as I know, there's nothing anyone who doesn't work at Spotify can do about this.

Finally, I've added a link to a fork of my fork of a fork of the original project. This fork is by a far more experienced foobar2000 developer than I, and it's probably what you're going to want to go with. This developer also recognizes that this plugin may be a lost cause thanks to Spotify's poor API management, but at least there's album art now!

End of update

Spotify recently ended its partnership with Musixmatch, meaning the lyrics feature of Spotify has been removed. I can get lyrics anywhere I want, but how am I going to get lyrics synced to the songs I'm playing in Spotify?

Their web API doesn't expose any features for this. MPRIS was a dead-end - it's only for the Spotify client on Linux, and it's barely supported and possibly not working at that. So there's no way that I could find of retrieving song details from their native client - and my only other option was finding a way to play Spotify on a different client that has better plugin support.

My first stop was foobar2000, a music player almost legendary for the amount of customization it offers. And, lucky enough, there's already a plugin available for Spotify URIs in foobar2000. Just one major problem: it hasn't been updated in almost five years, and it crashes foobar2000 when you launch it.

Good news: I got it working, and you can do it too!

You will need a Spotify premium account for this.

The Easy Way

Update as of 1/25/2017: It looks like someone named Holger Stenger has been working on their own fork of this plugin. Though it's pretty recent, they've already made a lot of improvements and it's clear they've got a greater handle on foobar2000 component development than I do. Check out the source and download builds here!

Old version: (1.5MB). Open up foobar2000, go to File > Preferences, and click "Install..." in the bottom right. Select the zip. Click apply, restart, and head on down to Usage!

The Hard Way

Don't trust me? Ok, sure, whatever. But you're going to need to get yourself a copy of Visual Studio 2015 (don't worry, it's free). Once you've done that, download source code of the foo_input_spotify module linked before (or click here). Once you've done that, you'll need to download the latest foobar2000 SDK, found here. Extract it into the foobar-sdk folder in the source code you just downloaded, so that the sdk-readme.html file in the SDK is in the location foobar-sdk/sdk-readme.html, relative to the source code.

Now, you'll need to download the libspotify binary. Here's a problem: you can't download it anymore! Since the Spotify apparently doesn't understand the benefit of allowing third party developers to extend your service, they've discontinued libspotify, removed all downloads, and haven't provided a direct replacement. Honestly.

Don't worry, though, the Internet Archive is here to save what jerk developers won't. If you head over to the old libspotify page on, you can download the most recent binaries. You'll be looking for the third on the list, the Win32 libspotify binary. Download that and extract it into the libspotify folder in the source code, so that the README file is at libspotify/README.

Now you're ready to get compiling! Open up foo_input_spotify.sln in Visual Studio 2015, build the solution, and... hey, what's with all these errors?

For whatever reason, the solution doesn't seem to compile correctly, at least for me. So you're going to need to do a bit of project reconfiguration.

  • Cannot open include file: 'windows.h': for me, the include directory for the Windows SDK is in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include. Go to the properties for foo_input_spotify, and under C/C++ -> General, add the path to the SDK to the "Additional Include Directories" field.
  • Cannot open include file: 'ctype.h': the C Runtime Library is located in C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt for me. Put this path in the same place you put the path to the Windows SDK (remember to include a semicolon between the paths!)
  • Cannot open input file '..\libspotify\lib\spotify.lib': I guess libspotify.lib used to be named something different in the version this guy was using? Go to the properties for foo_input_spotify, go to Linker -> Input, and in the "Additional Dependencies" field, change ..\libspotify\lib\spotify.lib to ..\libspotify\lib\libspotify.lib
  • mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in cred_prompt.obj: Once again in the project properties for foo_input_spotify, go to C/C++ -> Code Generation, and change the value to "Multi-threaded" or "Multi-threaded Debug".

Here's one more thing you might need to do - I'm not sure. If it doesn't work, you could try changing the API key in key-930.c in the foo_input_spotify source. You can get an API key here. I'm not sure if you need to do this, as I replaced the API key with mine when I downloaded it.

Now, it should build correctly. Almost there! The built component is in foobar2000/user-components/foo_input_spotify, relative to the source code. Take libspotify.dll from the libspotify folder and copy it to this folder. Then, copy this folder to %AppData\foobar2000\user-components. Once you start/restart foobar2000, it should be enabled!


Open up foobar2000 and go to File > Add Location (or press Ctrl-U). This will bring up the "Add Location" menu. Take a spotify URI from the official client, like spotify:track:5IRkM1WyCMDXPnabEeqz5i or spotify:user:communistpancake:playlist:2jYKvcXFolpUexOaOX3r7h. This should add the track(s) to your playlist. You can also search using spotify:search:<term>, like spotify:search:dead kennedys. This will add the first twenty results to your playlist, which isn't the best way to search - I recommend using the official client or the web client and just copying the URLs.

The first time you use the API, it'll ask you for your Spotify credentials, which are saved securely to the Windows credential store. Remember - you need a Spotify premium account for this!


Right - the original purpose of this.

What I found was the best is to just download this plugin, which displays a pane with lyrics synced to the song's current position. It looks for local lyrics though, so it's only useful with this plugin, which fetches lyrics from a variety of sources.

That's it. Good luck, and have fun!