WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: shairport, minidlna, mpd or mopidy for TC6?  (Read 25924 times)

Offline aprilmayjune

  • Newbie
  • *
  • Posts: 9
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #30 on: April 14, 2015, 01:27:09 AM »
Concerning Shairport-sync, wouldn't it be better if we could use Shairport on the Squeezeboxserver as an LMS plugin or a server source rather than re-invent the wheel to do all the same communication?

I fully agree.
This seems like a much better way. By doing so the LMS would take care of the sync and you would be able to play through LMS to all connected devices. Also the trouble with dual use of the sound card will be avoided as all will be played through LMS (and squeezelite in the case of piCorePlayer).

There is a recipe here, the only trouble seem to be related to the fact that the plug-in needs to be build for each architecture where the LMS is running:
http://forums.slimdevices.com/showthread.php?100379-Announce-ShairTunes-Plugin

Regards
Steen

I've been slowly moving all my little computers to LMS and squeezelite from Mopidy/MPD, but everyone I know still uses airplay (including me!) so I've been trying integrate both sync systems. I've more or less got squeezelite and shairport-sync nailed down on my one Pi and two bay trail linux boxes. Shairport-sync and shairport have an option that sends commands when you start (-B) and when you stop (-E) airplaying. So that's what I do. After my device is chosen, once I click play, shairport sends a command to turn off the squeezelite player, then the music will airplay. When I'm done, i.e. a few moments after clicking pause, shairport sends a command that turns the squeezelite player back on. Works pretty well.

I just ordered myself a raspberry pi a+ and thought I'd try picoreplayer, but I couldnt figure out where to even begin to get shairport-sync installed until I found this post. I thought I'd try the shairtunes plugin option for LMS mentioned above despite not liking the idea that airplay wouldn't work if LMS was off. But after going through the mentioned thread, I saw that no one has figured out how to get shairtunes plugin to play on more than one device at a time! In other words, no syncing at all! Unless I completely read the thread incorrectly...

So anyways, I think it would still be helpful to have shairport-sync that runs on tinycore just to get that airplay syncing functionality that LMS still is unable to provide.

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #31 on: April 14, 2015, 04:12:41 AM »
I've been slowly moving all my little computers to LMS and squeezelite from Mopidy/MPD, but everyone I know still uses airplay (including me!) so I've been trying integrate both sync systems. I've more or less got squeezelite and shairport-sync nailed down on my one Pi and two bay trail linux boxes. Shairport-sync and shairport have an option that sends commands when you start (-B) and when you stop (-E) airplaying. So that's what I do. After my device is chosen, once I click play, shairport sends a command to turn off the squeezelite player, then the music will airplay. When I'm done, i.e. a few moments after clicking pause, shairport sends a command that turns the squeezelite player back on. Works pretty well.

I just ordered myself a raspberry pi a+ and thought I'd try picoreplayer, but I couldnt figure out where to even begin to get shairport-sync installed until I found this post. I thought I'd try the shairtunes plugin option for LMS mentioned above despite not liking the idea that airplay wouldn't work if LMS was off. But after going through the mentioned thread, I saw that no one has figured out how to get shairtunes plugin to play on more than one device at a time! In other words, no syncing at all! Unless I completely read the thread incorrectly...

So anyways, I think it would still be helpful to have shairport-sync that runs on tinycore just to get that airplay syncing functionality that LMS still is unable to provide.

hi aprilmayjune ,

I have been playing with shairport.tcz on piCorePlayer and it seems to work well. I don't like your idea of having shairport a priority over squeezelite though.  ;D

Note that shairport.tcz has a lot of dependencies.

Rather than have a specific shairport install procedure, we are currently looking at a piCore extension installatiosn via the web interface.

I would recommend you initially use piCorePlayer1.18b on your RPi A+. Getting the wireless to work on piCorePlayer1.19 is problematic. The fix is done, just not available yet.

regards
Greg

Offline aprilmayjune

  • Newbie
  • *
  • Posts: 9
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #32 on: April 14, 2015, 09:01:46 AM »
hi aprilmayjune ,

I have been playing with shairport.tcz on piCorePlayer and it seems to work well. I don't like your idea of having shairport a priority over squeezelite though.  ;D

Note that shairport.tcz has a lot of dependencies.

Rather than have a specific shairport install procedure, we are currently looking at a piCore extension installatiosn via the web interface.

I would recommend you initially use piCorePlayer1.18b on your RPi A+. Getting the wireless to work on piCorePlayer1.19 is problematic. The fix is done, just not available yet.

regards
Greg

Greg,

Haha, I prefer using squeezelite over shairport-sync also, but tell that to a significant other when all she wants to do is play music quickly from her iphone. Airplay passes the girlfriend/wife test. iPeng and web ui is still a hard sell.

Squeezelite, for some reason, hogs the sound card even when not in use. That's the main reason I need to turn it off.

If you were to add the shairport install as a picore extension via webface, i think the shairport-sync fork (if available as tcz) would be a better choice basically because the original shairport is no longer being maintained. As James Laird says, he doesn't even use it himself anymore.  Not to mention, it has that really great syncing feature. Regular shairport does tend to drift after a while. Picoreplayer would be the ultimate streamer then!

Is wireless an issue with just the A+ and picoreplayer 1.19 or picoreplayer 1.19 in general? I tested it on my Raspberry PI B and the wireless seemed to work ok.

Thank you!

Offline aprilmayjune

  • Newbie
  • *
  • Posts: 9
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #33 on: April 16, 2015, 06:28:54 PM »
Installed shairport.tcz on my A+ and I'm having some strange problems. After a while, the Airport player will disappear from ios and itunes selector. On my other pi, it usually just means that shairport crashed, but on the A+ shairport it is still running! Another strange thing too is that the airplay device will appear disconnected from itunes (orange airplay icon instead of blue) while the music is still playing through the A+! When I uncheck the device, it disappears from the list. Then the final strange thing is the device will randomly reappear.

Offline lykkedk

  • Full Member
  • ***
  • Posts: 182
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #34 on: April 20, 2015, 02:44:27 PM »
Hi here.

I am playing with this shairport plugin for my squeezelite player.

I see, that when i use the .asound solution, for sharing both LMS server stream, and airplay, the CPU usage goes higher.

Look below:

Around 48% CPU usage with "default/.asoundrc"
/home/tc/squeezelite/squeezelite-armv6hf -z -a 80  4  -n PlayBox -m xxxxxxx 5E -s 192.168.1.1xx

Around 8% COU usage with "hw:CARD=D20"
/home/tc/squeezelite/squeezelite-armv6hf -z -a 80  4  -o hw:CARD=D20 -n PlayBox -m xxxxxxx 5E -s 192.168.1.1xx

Well, i was thinking that if it was possible to identificate, wheather some media connect to shairport, then i can kill squeezelite with my D20 CARD, and start it with default(.asoundrc) CARD. -This way, CPU will only be high when shairport is actually used.

Any hints  :o Rgds; Jesper.

Offline aprilmayjune

  • Newbie
  • *
  • Posts: 9
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #35 on: April 24, 2015, 12:10:21 PM »
Hi here.

I am playing with this shairport plugin for my squeezelite player.

I see, that when i use the .asound solution, for sharing both LMS server stream, and airplay, the CPU usage goes higher.

Look below:

Around 48% CPU usage with "default/.asoundrc"
/home/tc/squeezelite/squeezelite-armv6hf -z -a 80  4  -n PlayBox -m xxxxxxx 5E -s 192.168.1.1xx

Around 8% COU usage with "hw:CARD=D20"
/home/tc/squeezelite/squeezelite-armv6hf -z -a 80  4  -o hw:CARD=D20 -n PlayBox -m xxxxxxx 5E -s 192.168.1.1xx

Well, i was thinking that if it was possible to identificate, wheather some media connect to shairport, then i can kill squeezelite with my D20 CARD, and start it with default(.asoundrc) CARD. -This way, CPU will only be high when shairport is actually used.

Any hints  :o Rgds; Jesper.

Shairport allows you send commands before and after shairport starts working. I'm assuming for situations like yours.
 
I do something similar to this in the init.d file:
Code: [Select]
/usr/sbin/shairport -d -a "My Airplay" -w -B "echo 'xx:xx:xx:xx:xx power 0' | socat tcp:10.0.1.XX:9090 -" -E "xx:xx:xx:xx:xx power 1' | socat tcp:10.0.1.XX:9090 -" -- -d hw:0
Fill in your MAC address and LMS ip address.

When you airplay something, it sends the power 0 command through socat (which you'll need to install). This powers off the squeezelite player which releases the dac/soundcard. After you're done airplaying (a few moments after you pause the music), squeezelite will turn back on. Now you won't need to mix the sound. I don't set .asoundrc on my Pi. I just tell shairport and squeezelite to look at the dac/sound card directly.

-B is used for the command when you begin airplaying.
-w waits before the command above to complete before airplaying
-E is used for the command after you're done airplaying

Offline aprilmayjune

  • Newbie
  • *
  • Posts: 9
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #36 on: April 24, 2015, 01:05:32 PM »


Shairport allows you send commands before and after shairport starts working. I'm assuming for situations like yours.
 
I do something similar to this in the init.d file:
Code: [Select]
/usr/sbin/shairport -d -a "My Airplay" -w -B "echo 'xx:xx:xx:xx:xx power 0' | socat tcp:10.0.1.XX:9090 -" -E "xx:xx:xx:xx:xx power 1' | socat tcp:10.0.1.XX:9090 -" -- -d hw:0
Fill in your MAC address and LMS ip address.

When you airplay something, it sends the power 0 command through socat (which you'll need to install). This powers off the squeezelite player which releases the dac/soundcard. After you're done airplaying (a few moments after you pause the music), squeezelite will turn back on. Now you won't need to mix the sound. I don't set .asoundrc on my Pi. I just tell shairport and squeezelite to look at the dac/sound card directly.

-B is used for the command when you begin airplaying.
-w waits before the command above to complete before airplaying
-E is used for the command after you're done airplaying


I just wanted to edit my previous post, but doesn't look like I can. Anyways, the following part of the shairport init.d may not work. I'm not sure why. the quotes? how socat terminates?

Code: [Select]
echo 'xx:xx:xx:xx:xx:xx power 0' | socat tcp:10.0.1.XX:9090 -

The way I do it on my pi is put the command in bash scripts and put that script locations in the begin (-B) and end (-E) sections. I didn't want to overcomplicate it, but I guess did.



Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #37 on: April 24, 2015, 06:04:56 PM »


Shairport allows you send commands before and after shairport starts working. I'm assuming for situations like yours.
 
I do something similar to this in the init.d file:
Code: [Select]
/usr/sbin/shairport -d -a "My Airplay" -w -B "echo 'xx:xx:xx:xx:xx power 0' | socat tcp:10.0.1.XX:9090 -" -E "xx:xx:xx:xx:xx power 1' | socat tcp:10.0.1.XX:9090 -" -- -d hw:0
Fill in your MAC address and LMS ip address.

When you airplay something, it sends the power 0 command through socat (which you'll need to install). This powers off the squeezelite player which releases the dac/soundcard. After you're done airplaying (a few moments after you pause the music), squeezelite will turn back on. Now you won't need to mix the sound. I don't set .asoundrc on my Pi. I just tell shairport and squeezelite to look at the dac/sound card directly.

-B is used for the command when you begin airplaying.
-w waits before the command above to complete before airplaying
-E is used for the command after you're done airplaying


I just wanted to edit my previous post, but doesn't look like I can. Anyways, the following part of the shairport init.d may not work. I'm not sure why. the quotes? how socat terminates?

Code: [Select]
echo 'xx:xx:xx:xx:xx:xx power 0' | socat tcp:10.0.1.XX:9090 -

The way I do it on my pi is put the command in bash scripts and put that script locations in the begin (-B) and end (-E) sections. I didn't want to overcomplicate it, but I guess did.

hi aprilmayjune,

Thanks for posting your findings.

Here is the simplest command I can think of to do what you are suggesting.

Code: [Select]
shairport -B "echo pause | nc 192.168.1.xxx 9090" -E "echo play | nc 192.168.1.xxx 9090" &
192.168.1.xxx=your LMS IP

regards
Greg

Offline lykkedk

  • Full Member
  • ***
  • Posts: 182
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #38 on: April 25, 2015, 04:21:54 AM »
Thanks...

I will look into it  :)

So, could you perhaps, make a followup on this, so it would be easier to archive  8)

Anyway, i use .asoundrc while i am puzzling with bluetooth streaming. -Havent actually got any sound yet, but bluez4 is working.

Greg Erskine :
Do you and Steen use a persist /usr/local/etc/asound.conf in piCoreplayer, or nothing at all ?

Rgds; Jesper.

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #39 on: April 25, 2015, 04:50:19 AM »
Do you and Steen use a persist /usr/local/etc/asound.conf in piCoreplayer, or nothing at all ?

hi lykkedk,

We just use a simple /etc/asound.conf. I am not sure it is really needed in most cases.

Code: [Select]
pcm.!default {
type route
slave.pcm hw
}

We have been investigating a more complex asound.conf for mono, channel muting and channel swapping but it hasn't made it into the piCorePlayer yet.

regards
Greg

Offline lykkedk

  • Full Member
  • ***
  • Posts: 182
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #40 on: April 25, 2015, 04:56:01 AM »
Thanks... Greg




Sent from my iPhone using Tapatalk

Offline aprilmayjune

  • Newbie
  • *
  • Posts: 9
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #41 on: April 26, 2015, 10:09:11 AM »

hi aprilmayjune,

Thanks for posting your findings.

Here is the simplest command I can think of to do what you are suggesting.

Code: [Select]
shairport -B "echo pause | nc 192.168.1.xxx 9090" -E "echo play | nc 192.168.1.xxx 9090" &
192.168.1.xxx=your LMS IP

regards
Greg

Hi Greg,

I use the "power 0" / "power 1" commands because squeezelite locks out the alsa dac/soundcard completely for squeezelite use only when it's the on state from what I've noticed. Power 0 sends two commands in sequence, power off then pause (or stop based on your settings). On raspbian, I was using nc but I noticed something weird. When running the command using echo piped to nc, it would power off the squeezelite but not do the second step of pausing. nc terminates before it has a chance to do the second step. I've tried adding the wait parameters, but nothing seemed to work. I had to eventually use the pylms perl script thing to send commands to lms.

I found later that nc isn't even available in tce. And installing pylms seemed like it would be a pain in picoreplayer. This is when I found socat. socat actually runs the power 0 completely before terminating. I still have to do it from a bash script though. I tried removing the single quotes, but still doesn't work.


Offline lykkedk

  • Full Member
  • ***
  • Posts: 182
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #42 on: April 26, 2015, 12:02:01 PM »
Hi...

Quote
I still have to do it from a bash script though. I tried removing the single quotes, but still doesn't work.

Could you care to share them bash / sh scripts here... I am in for making something simmilair, and would like to see, how you do it ?

Rgds; Jesper.

Offline aprilmayjune

  • Newbie
  • *
  • Posts: 9
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #43 on: April 26, 2015, 06:18:40 PM »
Hi...

Quote
I still have to do it from a bash script though. I tried removing the single quotes, but still doesn't work.

Could you care to share them bash / sh scripts here... I am in for making something simmilair, and would like to see, how you do it ?

Rgds; Jesper.

No problem. It's more or less what I tried putting in the init.d script, but in the script it seems to work. I place this file in a /home/pi/scripts and call this one squeezeoff.sh. I create a similar one but with power 1 and call it squeezeon.sh.

Replace with your MAC address and LMS server ip.
Code: [Select]
#!/bin/sh

(echo "xx:xx:xx:xx:xx:xx power 0") | socat tcp:10.0.1.xx:9090 -

Then..
Code: [Select]
sudo chmod 755 /home/pi/scripts/squeezeoff.sh


Then in the init.d I use a line similar to this:
Code: [Select]
/usr/sbin/shairport -d -a "My Airplay" -w -B "/home/pi/scripts/squeezeoff.sh" -E "/home/pi/scripts/squeezeon.sh" -- -d hw:0

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: shairport, minidlna, mpd or mopidy for TC6?
« Reply #44 on: April 26, 2015, 07:12:01 PM »

hi aprilmayjune,

Thanks for posting your findings.

Here is the simplest command I can think of to do what you are suggesting.

Code: [Select]
shairport -B "echo pause | nc 192.168.1.xxx 9090" -E "echo play | nc 192.168.1.xxx 9090" &
192.168.1.xxx=your LMS IP

regards
Greg

Hi Greg,

I use the "power 0" / "power 1" commands because squeezelite locks out the alsa dac/soundcard completely for squeezelite use only when it's the on state from what I've noticed. Power 0 sends two commands in sequence, power off then pause (or stop based on your settings). On raspbian, I was using nc but I noticed something weird. When running the command using echo piped to nc, it would power off the squeezelite but not do the second step of pausing. nc terminates before it has a chance to do the second step. I've tried adding the wait parameters, but nothing seemed to work. I had to eventually use the pylms perl script thing to send commands to lms.

I found later that nc isn't even available in tce. And installing pylms seemed like it would be a pain in picoreplayer. This is when I found socat. socat actually runs the power 0 completely before terminating. I still have to do it from a bash script though. I tried removing the single quotes, but still doesn't work.

hi aprilmayjun,

Thanks for the information on socat, I'll keep it in mine if I have a problem with nc.

The command I posted in the earlier post works fine. The audio stream from squeezelite stops and the shairport streams starts and visa versa. I must admit I have only tested it on analog out though. What is the extra requirement for using the power command?

nc has always been available in the version of piCore that I have used. No extra software to load. It's part of busybox.

regards
Greg