Rothchild
10-10-2016, 19:10
If you don't like tinkering with your Pi this post isn't for you, there will be references to editing system files and other such scary and mystical practices. Also, much of what I've ended up with is probably possible with one of the 'vanilla' audio distros such as Moode or Volumio, but my preference is for the road less travelled in these matters, this is DIY digital audio.
What I've ended up with a Pi that not only runs my much loved Subsonic media server platform (allowing me native playing of my FLAC files on my home system and streaming of those files at rates up to 320kBs across the internet using either a phone app or simply in a web browser) but also Spotify (albeit with a premium account) with a nice interface on my local machine (next step is to work out a streaming option for this)
I've shown snaps of Subsonic before but for reference this is what Spotify looks like in a web browser served by the Pi
http://i1314.photobucket.com/albums/t575/elkhanos/Screenshot%20from%202016-10-10%20193728_zpsslihqotv.png
This is the 'spotmop' interface, you can also browse and play your local files with it too
http://i1314.photobucket.com/albums/t575/elkhanos/Screenshot%20from%202016-10-10%20193829_zps5ezlajkx.png
This aspect of my recent developments is not of itself all that clever, I simple followed the instructions on the mopidy website: https://www.mopidy.com/ added the Mopidy Repository to my DietPi install and installed Mopidy (and the Spotify and SQLite plugins) I also installed python-pip so I could install the Spotmop interface.
Edit /etc/mopidy/mopidy.conf to taste and I'm up and running with Mopidy and Spotify.
However, there's a couple of problems. Namely that my Sabre DAC (using the HifiBerry driver) has no mixing function and ALSA is a single client tool. Either Mopidy or Subsonic would work but not both!
Dmix to the rescue!
Dmix is an ALSA plugin that allows for multiclient use of ALSA following a combo of guides found online I ended up with a working solution.
Firstly edit /boot/config.txt (or on a dietpi system /Dietpi/config.txt) and add the line: dtoverlay=i2s-mmap
Then edit /etc/asound.conf The config that worked for me was the one found towards the bottom of the page here: https://wiki.gentoo.org/wiki/ALSA (under the heading 'Soundcard only available for one application')
I determined my sound card number and subdevice number with a quick aplay -l and edited that section of the file to suit, I also amended the sample rate to 44100 because all my files are at that sample rate and I didn't want any more 'messing' with the stream that absolutely necessary.
A quick reboot and we're all up and running I can now switch between apps using Subsonic for local files and Spotmop for Spotify and so on (as a side note I've really not got on with Mopidy's implementation of MPD as I can't get it to play nice with GMPC, my preferred non-phone client, and this configuration allows me to install and run a 'proper' instance of MPD alongside Mopidy for Spotify.
So my current setup is a Pi2 running Mopidy and Subsonic in to my 'big rig' and my old Pi1 running Mopidy and MPD (which is much lighter on processor than Subsonic) in my second system. I also have the Pi2 running Samba etc so I can load files in to it and then that drive is mounted by a Samba client in to the Pi1 with an rsync backup routine so each evening any changes to the main drive are mirrored to the second drive keeping them both up-to-date and backed up.
If you want to try this on your own Pi and need any pointers just let me know and I'll do what I can to help.
What I've ended up with a Pi that not only runs my much loved Subsonic media server platform (allowing me native playing of my FLAC files on my home system and streaming of those files at rates up to 320kBs across the internet using either a phone app or simply in a web browser) but also Spotify (albeit with a premium account) with a nice interface on my local machine (next step is to work out a streaming option for this)
I've shown snaps of Subsonic before but for reference this is what Spotify looks like in a web browser served by the Pi
http://i1314.photobucket.com/albums/t575/elkhanos/Screenshot%20from%202016-10-10%20193728_zpsslihqotv.png
This is the 'spotmop' interface, you can also browse and play your local files with it too
http://i1314.photobucket.com/albums/t575/elkhanos/Screenshot%20from%202016-10-10%20193829_zps5ezlajkx.png
This aspect of my recent developments is not of itself all that clever, I simple followed the instructions on the mopidy website: https://www.mopidy.com/ added the Mopidy Repository to my DietPi install and installed Mopidy (and the Spotify and SQLite plugins) I also installed python-pip so I could install the Spotmop interface.
Edit /etc/mopidy/mopidy.conf to taste and I'm up and running with Mopidy and Spotify.
However, there's a couple of problems. Namely that my Sabre DAC (using the HifiBerry driver) has no mixing function and ALSA is a single client tool. Either Mopidy or Subsonic would work but not both!
Dmix to the rescue!
Dmix is an ALSA plugin that allows for multiclient use of ALSA following a combo of guides found online I ended up with a working solution.
Firstly edit /boot/config.txt (or on a dietpi system /Dietpi/config.txt) and add the line: dtoverlay=i2s-mmap
Then edit /etc/asound.conf The config that worked for me was the one found towards the bottom of the page here: https://wiki.gentoo.org/wiki/ALSA (under the heading 'Soundcard only available for one application')
I determined my sound card number and subdevice number with a quick aplay -l and edited that section of the file to suit, I also amended the sample rate to 44100 because all my files are at that sample rate and I didn't want any more 'messing' with the stream that absolutely necessary.
A quick reboot and we're all up and running I can now switch between apps using Subsonic for local files and Spotmop for Spotify and so on (as a side note I've really not got on with Mopidy's implementation of MPD as I can't get it to play nice with GMPC, my preferred non-phone client, and this configuration allows me to install and run a 'proper' instance of MPD alongside Mopidy for Spotify.
So my current setup is a Pi2 running Mopidy and Subsonic in to my 'big rig' and my old Pi1 running Mopidy and MPD (which is much lighter on processor than Subsonic) in my second system. I also have the Pi2 running Samba etc so I can load files in to it and then that drive is mounted by a Samba client in to the Pi1 with an rsync backup routine so each evening any changes to the main drive are mirrored to the second drive keeping them both up-to-date and backed up.
If you want to try this on your own Pi and need any pointers just let me know and I'll do what I can to help.