back to the beginning

FreeBSD 12.0 Spotify

Last updated: 2019-02-24

Spotify: Here be dragons...

One thing I really wanted to get working was Spotify.

Spotify has no official client for FreeBSD and it refuses to run in a web browser.

So no problem, I'll run it in a virtual machine.

The VirtualBox package doesn't produce audio from an Ubuntu virtual machine. No problem, someone said that you could build it with pulseaudio to make it work. It didn't for me.

Bhyve doesn't produce audio from an Ubuntu virtual machine. No problem, there is an audio patch for it. I rebuilt it with the patch and still failed to get audio.

There is a program called spotifyd in the ports that registers your computer as a speaker that you can play to. Downloading that package requires you get the freshest ports.

Warning: If you build it yourself, make sure you already have rust installed (among other things). Otherwise, their is a lot of building for a small package!

Now you can run Spotify in an Ubuntu virtual machine (doesn't matter now which kind) because the audio pipes through spotifyd.

Setup spotifyd

Note: spotifyd only works with paid spotify accounts

You need to create a configuration file at ~/.config/spotifyd/spotifyd.conf

[global]
username = yourspotifyusername
password = yourspotifypassword
backend = portaudio
device = /dev/dsp
#mixer = PCM
#volume-control = softvol
#onevent = command_run_on_playback_event
device_name = bsd
bitrate = 320
cache_path = /home/darren/.spotifycache
volume-normalisation = true
normalisation-pregain = -10

These are my settings. You might want a different bit rate, your audio device might be different, and you certainly might need a different cache_path.

If you have trouble finding the correct device see here.

My FreeBSD audio is hda4 but the device for spotifyd is /dev/dsp because it uses portaudio.

It must be run as root. Make sure the time is set properly in your virtual machine or it might not work.

back to the beginning

Something need fixing? Contact me: