AirPlay / Spotify by Snapcast

  • Snapcast is available from the LibreELEC Add-ons repository. Install the Snapserver addon on one system and the Snapclient addon on all systems which should play. Then use AirPlay to stream to Snapcast.

    By default, the Snapserver addon is configured to stream AirPlay, but it can be configured to stream Spotify. Streaming Spotify requires that the Librespot addon is installed on the system which runs the Snapserver addon.

  • This is sad :(

    I thought I could use LE + Kodi as a MusicServer which can be controlled with Remote, WebIF or Android and stream/sync to other (LE-)devices with Snapcast-client in my house.

    Thx for explanation

  • heisenberg  inusasha  omprkashs  blueribb

    Here are previews of Snapclient/Snapserver for LibreELEC 9.0 for RPi2/3 that support streaming from Kodi.

    To stream from Kodi:

    1. In Add-ons/My add-ons/Services/Snapserver/Configure set Preset to Kodi
    2. In Settings/System/Audio set Audio output device to PULSE: Default or PULSE: Linux FIFO sink /tmp/snapfifo
    3. In Add-ons/My add-ons/Services/Snapclient/Configure increase Latency (600 somehow works here, your mileage may vary) in order to (attempt to) synchronise audio and video; this must be done for all Snapclients

    Remarks:

    • Sound quality feels inferior
    • Boot time feels longer
  • i have libreelec 8.0.2 version that is installed on intel nuc. right now i am strugling with multiroom audio system if do have any better solution then suggest me to play multiroom audio

  • Tested the preview version with LE9-Mihouse on RPi3:

    Works on Audio, can't get A/V-sync with Videos or Live-TV

    A/V-sync works with ALSA or Pi:HDMI sound-setting in Kodi-settings, but not with Pulse together with snapclient

    Thx so far!

    Will do further tests. Maybe I find a setting for A/V-sync

    Edit:

    Found "Audio Profiles" and JSON: enable/disable addon:

    If this works, then you could have something like this: (with a python(?)-script)

    -> Kodi plays Video, then Pi:HDMI or ALSA is used for perfect A/V-sync for e.g. LiveTV (Audio-profile 1)

    -> Kodi plays Audio (mp3, stream, ...) then Kodi switches to Pulse (Audio-profile 2) and enables Snapclient to distribute audio in perfect sync to other Snapclients. On "Stop", the Audio-profile is reset to #1

    This doesn't work for Musicvideos, but would be a beginning ...

    Edited 3 times, last by heisenberg (March 23, 2018 at 2:43 PM).

  • Tested the preview version with LE9-Mihouse on RPi3:

    Works on Audio, can't get A/V-sync with Videos or Live-TV

    A/V-sync works with ALSA or Pi:HDMI sound-setting in Kodi-settings, but not with Pulse together with snapclient

    Thx so far!

    Will do further tests. Maybe I find a setting for A/V-sync

    Is "Stop Snapclient on Kodi playback" set in the settings of the addon?

  • No, it wasn't enabled. If "Stop Snapclient on Kodi playback" is enabled, I can't get a frozen video-image on the screen and no Audio at all.

    The RPi seems to have only Bluetooth-audio for "Pulse". If no Snapclient is running, I get no sound.

    Pls have a look @ my edit above

  • Have you tried to set Latency to 600 in Snapclient settings? This somehow achieves a/V sync here.

  • Hello awiouy! First of all thank you for the work you are doing to get snapcast integrated into LibreELEC. It's really awesome!

    You mentioned that sound quality is inferior when using snapserver with Kodi and pulseaudio. I have been experimenting with snapcast a lot and I think I have a solution: In 'Settings' > 'System' you can set 'Output configuration' to 'Fixed'. Then set 'Limit sampling rate kHz' to '48.0'. Then set 'Resample quality' to 'High'.

    Sound quality should be better now as Kodi handles resampling the audio to 48kHz in high quality instead of leaving this task to pulseaudio.

    You could also leave the settings in Kodi alone and make pulseaudio use a better resampler:

    Pulseaudio [LibreELEC.wiki]

    With pulseaudio I usually set it to use the 'sox-vhq' resampler, this also sounds very good. I don't think there's a huge difference between Kodi's high quality resampler and pulseaudio's 'sox-vhq'.

    About A/V sync: You can easily get perfect sync across all snapclients. Just play a video and then go into the settings menu, then choose 'Audio settings' and then select 'Audio offset'. Set this to 'Ahead by 1.000s' and all your snapclients will be in sync with the video playback. No further configuration is needed on the clients this way.

  • Thank you for this information:

    1. resample-method = soxr-vhq in /storage/.config/pulse-daemon.conf.d/10-snapserver.conf improves sound quality

    2. Setting Audio offset to  Ahead by 1.000s easily achieves audio/video synchronisation

    I will see if I can add both to snapserver (and librespot)

    In the meantime both can be done manually

    I attach updated previews for RPi2