Testing Spotifyd on Ubuntu VM

A project log for Spotify Box Light

A device that can stream Spotify

PeroPero 10/20/2021 at 08:250 Comments

Spotifyd is a program that enables streaming Spotify remotely, like you do on  a Chromecast. It can run as a daemon service, or a normal program. After building and installing it on my Ubuntu virtual machine, it is very important to have a configuration file stored in `~/.config/spotifyd/spotifyd.config`. You need a Spotify premium user number, password, and comment out the commands you dont use, like the command that gets executed after the song is skipped. Also, the proxy server should be commented out. 

It is important to setup the backend option properly, as well. I thought it was "alsa", but it only worked with "pulseaudio". Make sure to check what is allowed by typing `spotifyd --help`.  I was figuring out for days what was wrong when the error about "not being able to write to pulseaudio" was all over the console. 

If you want to run it as a normal program, for dev purporses, just type `spotifyd --no-daemon`. It should connect succesfully and display:
    Loading config from "/home/pero/.config/spotifyd/spotifyd.conf"
    No proxy specified
    Using software volume controller.
    Connecting to AP ""
    Authenticated as "1116304529" !
    Country: "AT"
Now you can check on your smartphone Spotify app if the device is visible and can you connect to it. 

Funny enough, if I run compiled-by-me version, than it recognize alsa normally. Pre-compiled binary, downloaded from release shelf only works with `pulseaudio`. No idea why is that so. 
In any case, I managed to bring the strem to work when I commented out these lines in .config file:
    `device = "alsa_audio_device"`,  and 
    `control = "alsa_audio_device"`

Now spotifyd works both as daemon and a "normal" program. Cool.