Can Shairport coexist with LMS+Squeezelite?

Having issues with your DietPi installation, or, found a bug? Post it here.
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Can Shairport coexist with LMS+Squeezelite?

Post by Sciamano »

I have installed all three (LMS, squeezelite and Shairport) on the same raspberry pi, but I can't seem to make Shairport work: I can connect to it but I have no audio output.
The RPi is equipped with a USB sound card, which is correctly configured (via asound.conf) and it works correctly with squeezelite.
Any suggestions? :)
Thanks
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Can Shairport coexist with LMS+Squeezelite?

Post by Fourdee »

ALSA with 'hw' is only capable of playing 1 output stream at a time, unless, you enable software mixing (dmix) for the soundcard. See here for asound.conf:
http://www.alsa-project.org/main/index. ... undrc#dmix
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Can Shairport coexist with LMS+Squeezelite?

Post by Sciamano »

I know that, but I am not playing two output streams at the same time.
Unless squeezelite sort of "seizes" the sound card for itself.
I'll try disabling squeezelite and see if this way shairport works.
I'll report my findings :)
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Can Shairport coexist with LMS+Squeezelite?

Post by Sciamano »

Ok, disabling squeezelite makes shairport work.
I'm not savvy enough to set up dmix, so I guess I'll just stay with squeezelite.
It would have been a good way to stream Spotify though.
Janis
Posts: 28
Joined: Sun Oct 30, 2016 10:42 am

Re: Can Shairport coexist with LMS+Squeezelite?

Post by Janis »

I have the same problem.

Shairport can nicely coexist with Roon bridge and play successfully when Roon is not streaming, but not with Squeezelite.

Can be Squeezelite configured to release the ALSA hw, when not playing?

Is there other more smart alternative to Squeezelite to play Squeezebox on DietPi?
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Can Shairport coexist with LMS+Squeezelite?

Post by Sciamano »

As Fourdee explained above, it can be done by enabling software mixing in ALSA.
I will look into it as soon as I find the time, hoping it is not beyond my skills/capabilities.

Another way to achieve this is by installing MPD server / Mopidy and Shairport... I have tried and it works, but with some limitations that make me prefer LMS / Squeezelite over this solution because:
- I couldn't find a way to make MPDroid (the Android app to manage the MPD server) work properly.
- Overall the system is too slow
- TuneIn radio stations cannot be set as favorites for easy access to them

I might try to optimize the system in order to check if it becomes more responsive and to overcome those limitations (there are lots of plugins that might help), but it seems to me that LMS is a much better project overall.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Can Shairport coexist with LMS+Squeezelite?

Post by Fourdee »

Asound.conf for dmix as default device.
Make sure you remove any custom soundcard definitions you have added in squeezelite and shairport.
Copy and paste all, then reboot:

Code: Select all

cat << _EOF_ > /etc/asound.conf
pcm.!default {
    type plug
    slave.pcm "dmixer"
}

pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 44100
    }
    bindings {
        0 0
        1 1
    }
}

ctl.!default {
    type hw
    card 0
}
_EOF_
Above is for card 0, so, if your card is 1 (eg: Odroid HiFi Shield), use this one:

Code: Select all

cat << _EOF_ > /etc/asound.conf
pcm.!default {
    type plug
    slave.pcm "dmixer"
}

pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:1,0"
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 44100
    }
    bindings {
        0 0
        1 1
    }
}

ctl.!default {
    type hw
    card 1
}
_EOF_
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Can Shairport coexist with LMS+Squeezelite?

Post by Sciamano »

Since I am using a USB sound card, I used the second version, but it's not working.
Squeezelite player does not show up as an available player connected to the LMS server.
Also, shairport won't play any music.

Here is my /etc/asound.conf

Code: Select all

pcm.!default {
    type plug
    slave.pcm "dmixer"
}
 
pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:1,0"
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 44100
    }
    bindings {
        0 0
        1 1
    }
}
 
ctl.!default {
    type hw
    card 1
}
I have also tried adding "device 0" at the end, but the result hasn't changed.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Can Shairport coexist with LMS+Squeezelite?

Post by Fourdee »

Sciamano wrote:Since I am using a USB sound card, I used the second version, but it's not working.
Squeezelite player does not show up as an available player connected to the LMS server.
Also, shairport won't play any music.
Whats the result of?:

Code: Select all

aplay -l
Does the following sound test work? (ctrl+c to stop):

Code: Select all

speaker-test -c 2 -D hw:1,0
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Sciamano
Posts: 264
Joined: Sat Oct 15, 2016 12:18 pm
Location: Italy

Re: Can Shairport coexist with LMS+Squeezelite?

Post by Sciamano »

Result of 'aplay -l':

Code: Select all

card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
I can't post the results of the speaker test because at the moment I'm not physically present where the Raspberry Pi is. :)
Post Reply