[MOD]Replace shairport with shairport-sync (ios 9 compatibil

Suggestions/requests/ideas for RuneAudio core features and functions

[MOD]Replace shairport with shairport-sync (ios 9 compatibil

Postby nullomorph » 30 Sep 2015, 18:36

Recent ios 9 update from Apple broke AirPlay compatibility in RuneAudio. Unfortunately, shairport (which is included in RuneAudio) is not developed anymore, and no fix is available. Of several forks and derivatives, shairport-sync (https://github.com/mikebrady/shairport-sync) appears to be most active, and already has the fix required for compatibility with ios 9. It is also easy to install in RuneAudio, as there is a current package in Arch, however I lack the know-how to integrate it with the UI.
Here's how to make RuneAudio compatible with ios 9 for audio AirPlay function:
1. Disable airplay in the UI (in Settings)
2. Sync pacman, caution don't run the systemwide upgrade with -u!
Code: Select all
pacman -Sy

3. Install shairplay-sync
Code: Select all
pacman -S shairport-sync

4. Configure
Code: Select all
nano /etc/shairport-sync.conf
- it is pretty self-explanatory for basic configuration, and there is documentation at the shairport-sync site.
5. Start the shairport-sync service and test
Code: Select all
systemctl start shairport-sync

6. If all's well, enable the service at boot
Code: Select all
systemctl enable shairport-sync


That's it. There is only one issue (that was also present in the current shairport package) - AirPlay volume is much lower than in MPD, so if you use both, you have to keep adjusting the volume. Roughly, if you set MPD volume to 50% in RuneAudio, and set max volume on you iDevice, you get comparable output. No idea, if fixable.
Request to devs is thus to replace shairport with shairport-sync in future RuneAudio releases and integrate it with the UI. Shouldn't be hard to implement, and AirPlay functionality is important for many users (well, for me it is :P).
P.S. - first post here, obligatory thanks to the developers, great job!
nullomorph
 
Posts: 2
Joined: 30 Sep 2015, 18:15

Re: [MOD]Replace shairport with shairport-sync (ios 9 compat

Postby chuchuj » 14 Oct 2015, 22:42

I tried this tonight and shairplay-sync would not start. Can you share your configure file?

Thanks :D
chuchuj
 
Posts: 1
Joined: 14 Oct 2015, 22:39

Re: [MOD]Replace shairport with shairport-sync (ios 9 compat

Postby nullomorph » 16 Oct 2015, 16:52

I started from the file included in the distro, and then changed the parameters I thought I understood. Without the commented-out lines it boils down to this:
Code: Select all
general =
{
   name = "MyStereo";
   interpolation = "basic";
   output_backend = "alsa";
   mdns_backend = "avahi";
};

alsa =
{
  output_device = "default";
  mixer_control_name = "PCM";
};


Note, however, that this is a very basic setup, with just a Raspberry Pi and the onboard audio (no separate DAC). If yours is more fancy, you'll probably have to play with the alsa section. Run alsamixer to see, what you have available (mine has just "PCM"). The file included in the distro has helpful comments, but be careful when you edit, as the comments are long, and if you mess up with the line wrapping, you'll be in trouble. The comments start with "//"
nullomorph
 
Posts: 2
Joined: 30 Sep 2015, 18:15

Re: [MOD]Replace shairport with shairport-sync (ios 9 compat

Postby hansh64 » 06 Nov 2015, 14:36

Hi nullomorph,

Question: do I have to disable Airplay in the RuneUI? Is shairplay-sync an addition to the installed airplay or will it interfere with the installed feature?

Edit: ...I should read your step by step instructions...it's the first step...(stupid me) :?
hansh64
 
Posts: 31
Joined: 03 Jun 2015, 15:48

Re: [MOD]Replace shairport with shairport-sync (ios 9 compat

Postby popov » 09 Dec 2015, 23:30

Hi

Thank you for the topic, with Ios9 sharport wasn't working anymore.

So i spend a few time to install shareport-sync and integrated it on rune (not perfect...)

runeui is working for :

Activated / desactivated Airplay
changing name

I have an issue program on start and on stop : airplay_toggle
I still have strange message

Do to this:
Install shareport-sync as describe in the first post
I have to install gcc tobeable to start shareport

I modify shairport-sync.conf
with :
in General part
Code: Select all
general =
{
//   name = "Shairport Sync Player"; // This is the name the service will advertise to iTunes. The default is "Shairport Sync on <hostname>"
//   name = "Runeaudio-sync";
//   password = "secret"; // leave this commented out if you don't want to require a password
//   interpolation = "basic"; // aka "stuffing". Default is "basic", alternative is "soxr". Use "soxr" only if you have a reasonably fast processor.
   interpolation = "soxr"
   output_backend = "alsa"; // Run "shairport-sync -h" to get a list of all output_backends, e.g. "alsa", "pipe", "stdout". The default is the first one.
   mdns_backend = "avahi"; // Run "shairport-sync -h" to get a list of all mdns_backends. The default is the first one.
//   port = 5000; // Listen for service requests on this port
//    udp_port_base = 6001; // start allocating UDP ports from this port number when needed
//   udp_port_range = 100; // look for free ports in this number of places, starting at the UDP port base (only three are needed).
//   statistics = "no"; // set to "yes" to print statistics in the log
//   drift = 88; // allow this number of frames of drift away from exact synchronisation before attempting to correct it
//   resync_threshold = 2205; // a synchronisation error greater than this will cause resynchronisation; 0 disables it
//   log_verbosity = 0; // "0" means no debug verbosity, "3" is most verbose.
//  ignore_volume_control = "no"; // set this to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to.
ignore_voluem_control = "yes";
//  volume_range_db = 60 ; // use this to set the range, in dB, you want between the maximum volume and the minimum volume. Range is 30 to 150 dB. Leave it commented out to use mixer's native range.
};


in alsa
Code: Select all
alsa =
{
//  output_device = "default"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
//output_device = "hw:1,0";
mixer_control_name = "PCM"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
// mixer_device = "hw:0";
//  audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
//  audio_backend_buffer_desired_length = 6615; // If set too small, buffer underflow occurs on low-powered machines. Too long and the response times with software mixer become annoying.
};


Not sure this are the best choice.... But it's working

I modify :
run_sy_wrk ... just to use shareport-sync

Code: Select all
// start shairport
if ($redis->hGet('airplay', 'enable') === '1') {
    runelog("service: SHAIRPORT start",'');
    //sysCmd('systemctl start shairport');
    sysCmd('systemctl start shairport-sync');


and
Code: Select all
                    // start shairport
                    if ($job->action === 'start') {
                        runelog('service: SHAIRPORT start');
                        // start or re-start shairport service
                        if (isset($restart)) {
                            // sysCmd('systemctl restart shairport');
                            sysCmd('systemctl restart shairport-sync');
                        } else {
                            //sysCmd('systemctl start shairport');
                            sysCmd('systemctl start shairport-sync');
                        }
                        $redis->hSet('airplay', 'enable', 1);
                        // send notfy to UI
                        ui_notify_async('AirPlay', 'AirPlay feature enabled', $jobID);
                    }
                    // stop shairport
                    if ($job->action === 'stop') {
                        runelog('service: SHAIRPORT stop');
                        //sysCmd('systemctl stop shairport');
                        sysCmd('systemctl stop shairport-sync');
                        $redis->hSet('airplay', 'enable', 0);
                        // send notfy to UI
                        ui_notify_async('AirPlay', 'AirPlay feature disabled', $jobID);


i update runeaudio.php

with :
Code: Select all
    //$file = '/usr/lib/systemd/system/shairport.service';
    $file = '/usr/lib/systemd/system/shairport-sync.service';
    //$newArray = wrk_replaceTextLine($file, '', 'ExecStart', 'ExecStart=/usr/bin/shairport -w --name='.$name.' --on-start=/var/www/command/airplay_toggle --on-stop=/var/www/command/airplay_toggle -o alsa -- -d '.$acard->device);
    //$newArray = wrk_replaceTextLine($file, '', 'ExecStart', 'ExecStart=/usr/bin/shairport-sync -w --name='.$name.' --on-start=/var/www/command/airplay_toggle --on-stop=/var/www/command/airplay_toggle -o alsa -- -d '.$acard->device);
    $newArray = wrk_replaceTextLine($file, '', 'ExecStart', 'ExecStart=/usr/bin/shairport-sync -a '.$name.' -- -d '.$acard->device);   
    runelog('shairport.service :', $newArray);


as you for the moment no more on start on stop....

and :
Code: Select all
    sysCmd('systemctl daemon-reload');
    if ($redis->hGet('airplay','enable') === '1') {
        runelog('restart shairport');
        sysCmd('systemctl restart shairport-sync');
    }


and:
Code: Select all
    // update airplayname
    if ($redis->hGet('airplay','name') === $hn[0]) {
        $redis->hSet('airplay','name', $newhostname);
        if ($redis->hGet('airplay','enable') === '1') sysCmd('systemctl restart shairport-sync');
    }


and
Code: Select all
    // reset shairport starter script
    sysCmd('cp /var/www/app/config/defaults/shairport.service /usr/lib/systemd/system/shairport.service');
    sysCmd('cp /var/www/app/config/defaults/shairport-sync.service /usr/lib/systemd/system/shairport-sync.service');


I hope i don't miss something....Not an expert

Regards
popov
 
Posts: 53
Joined: 11 Oct 2014, 16:13

Re: [MOD]Replace shairport with shairport-sync (ios 9 compat

Postby bone330 » 22 Dec 2015, 21:28

I second the recommendation to switch to shairport-sync for use with iOS 9 devices. Works much better that way for me.
bone330
 
Posts: 2
Joined: 22 Dec 2015, 21:24

Re: [MOD]Replace shairport with shairport-sync (ios 9 compat

Postby hansh64 » 20 Jan 2016, 12:45

Hi,

Running shairport-sync using HifiBerry Digi+ (S/PDIF) or HDMI runs great. However trying to run it over USB to my USB DAC produces garbled sound or no sound at all.

Any thoughts?

Thanks,
Hans.
hansh64
 
Posts: 31
Joined: 03 Jun 2015, 15:48

Re: [MOD]Replace shairport with shairport-sync (ios 9 compat

Postby popov » 01 Mar 2016, 15:56

Hi

I don't have usb dac, i can't test :)
But i found this in shairport-sync site
Know issue with USB dac and Shairport-sync

https://github.com/mikebrady/shairport- ... HOOTING.md

Problem When using a USB DAC on a Raspberry Pi audio plays fine through other methods (such as through mpd, mopidy, mplayer or aplay) but when streamed to Shairport Sync regular dropouts or stutters are heard.

Possible Cause There is a suspicion (although this is not 100% confirmed) that this is a fun latency/timing issue related to a combination of
•The Raspberry Pi's ethernet itself being a USB device resulting in shared bandwidth/interrupts with USB DACs
•Shairport Sync continually checking the latency of the USB DAC to maintain synchronisation of audio
•Quirky USB DACs (already known to be problematic on the Raspberry Pi more info available here For more discussion on this issue see issue 167 or read on for the quick fix!


They change usb card rate, buffer ....

Regards
popov
 
Posts: 53
Joined: 11 Oct 2014, 16:13

Re: [MOD]Replace shairport with shairport-sync (ios 9 compat

Postby daymz » 14 Dec 2017, 15:08

Unfortunately, this update is no longer possible for Raspberry Pi 1 devices.

The current version of Shairport-Sync (as built in the repo) doesn't work with RuneAudio's ArchLinux version and libraries.
Because ArchLinux (the OS over which RuneAudio is built) uses a Rolling window for its repos, it's not possible to install an older version of Shairport-Sync, and doing a system-wide update (pacman -Syu) will break the entire installation (I even tried blocking all firmware- and raspberry-related updates).

And there hasn't been any update to RuneAudio for Rpi in over 3 years so I guess this is a dead issue.

Just wanted to give a heads-up to whoever may want to try this.

If you need Shairport-Sync like I do, I'm afraid you will have to look at another system. Bummer, I really love RuneAudio. I'll take a look at Pi MusicBox, seems to be a potentially interesting replacement.

EDIT: specified the update procedure doesn't work for Raspberry Pi 1, as janui and I found out later in the thread. I don't want readers to be misled by my original comment.
Last edited by daymz on 18 Dec 2017, 19:21, edited 1 time in total.
daymz
 
Posts: 19
Joined: 25 Feb 2015, 02:19

Re: [MOD]Replace shairport with shairport-sync (ios 9 compat

Postby janui » 14 Dec 2017, 17:59

HI daymz,

I have quickly tried installing shairport-sync on this image for PI 2/3 B: runeaudio-0-3-beta-for-raspberry-pi-t502-520.html#p23625 I used the command:
Code: Select all
pacman -Sy shairport-sync
The following packages were installed:
Code: Select all
shairport-sync 3.1.4-1
libconfig 1.7.1-1
I then checked the version of shairport-sync with the command:
Code: Select all
shairport-sync -V
and it returned:
Code: Select all
3.1.4-OpenSSL-Avahi-ALSA-pa-soxr-sysconfdir:/etc
Then I tried the command:
Code: Select all
shairport-sync
and it returned:
Code: Select all
Successful Startup
I have not had time to modify all the other files to complete the installation, but the basic package seems to be working. Maybe you could carry out the other tests, I don't have the time at the moment.

janui
User avatar
janui
 
Posts: 682
Joined: 20 Dec 2014, 12:55
Location: Ollanda

support RuneAudio Donate with PayPal

Next

Return to Feature request

Who is online

Users browsing this forum: No registered users and 0 guests