From f9eef5bd7c6c4b0a98eadfc8da8aec3aa41b7624 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Sat, 26 Jun 2021 15:46:02 +0100 Subject: [PATCH 01/14] Update README.md --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 76492318..d670abf9 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,15 @@ More About What Works What You Need --- -* A Raspberry Pi 3 or better is needed. At present, Shairport Sync will not run successfully on an original Pi or a Pi Zero. +* A Raspberry Pi. See table below for tested devices, feel free to open an issue or pull request if you have Shairport Sync working on a device not listed here! * [`NQPTP`](https://github.com/mikebrady/nqptp) is needed and must be run as `root`. It will use ports `319` and `320`, normally reserved for [PTP](https://standards.ieee.org/standard/1588-2008.html) clocks. If you are using PTP clock services for something else, you can't install [`NQPTP`](https://github.com/mikebrady/nqptp) and so you can't use Shairport Sync.(FYI, most computers do not have a PTP clock running -- instead, they may use a [Network Timing Protocol (NTP)](http://www.ntp.org) service to keep the system clock synchronised with world time. However, as noted above, macOS _does_ use a PTP clock to support AirPlay 2.) +| Tested | Native Hardware Status | Docker Status | +|---------------------|------------------------|---------------| +| Raspberry Pi 4 | Working | Working | +| Raspberry Pi 3 | Working | Working. | +| Raspberry Pi Zero W | Untested | Working but since the Pi Zero is low powered, issues can arise fairly quickly when trying to run additional programs. Total CPU usage sits at around 75% when using Shairport Sync.| + Guides --- * A brief guide to building Shairport Sync for AirPlay 1 is available at [BUILDFORAP1.md](https://github.com/aillwee/shairport-sync/blob/development/BUILDFORAP1.md). From 7258944be8f87e69d4b9c8c93336e944c68aa876 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Sat, 26 Jun 2021 15:46:48 +0100 Subject: [PATCH 02/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d670abf9..7e6ebd83 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ What You Need | Tested | Native Hardware Status | Docker Status | |---------------------|------------------------|---------------| | Raspberry Pi 4 | Working | Working | -| Raspberry Pi 3 | Working | Working. | +| Raspberry Pi 3 | Working | Working | | Raspberry Pi Zero W | Untested | Working but since the Pi Zero is low powered, issues can arise fairly quickly when trying to run additional programs. Total CPU usage sits at around 75% when using Shairport Sync.| Guides From 530e078a5fcc6e96ae785a0f063d860c63fd2bba Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Sun, 27 Jun 2021 22:13:14 +0100 Subject: [PATCH 03/14] Documentation updates (WIP). --- README.md | 10 +++++----- documentation/Example Setups.md | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 documentation/Example Setups.md diff --git a/README.md b/README.md index 7e6ebd83..6966cce6 100644 --- a/README.md +++ b/README.md @@ -41,11 +41,11 @@ What You Need * A Raspberry Pi. See table below for tested devices, feel free to open an issue or pull request if you have Shairport Sync working on a device not listed here! * [`NQPTP`](https://github.com/mikebrady/nqptp) is needed and must be run as `root`. It will use ports `319` and `320`, normally reserved for [PTP](https://standards.ieee.org/standard/1588-2008.html) clocks. If you are using PTP clock services for something else, you can't install [`NQPTP`](https://github.com/mikebrady/nqptp) and so you can't use Shairport Sync.(FYI, most computers do not have a PTP clock running -- instead, they may use a [Network Timing Protocol (NTP)](http://www.ntp.org) service to keep the system clock synchronised with world time. However, as noted above, macOS _does_ use a PTP clock to support AirPlay 2.) -| Tested | Native Hardware Status | Docker Status | -|---------------------|------------------------|---------------| -| Raspberry Pi 4 | Working | Working | -| Raspberry Pi 3 | Working | Working | -| Raspberry Pi Zero W | Untested | Working but since the Pi Zero is low powered, issues can arise fairly quickly when trying to run additional programs. Total CPU usage sits at around 75% when using Shairport Sync.| +| Device | Native | Docker | Notes | +|---------------------|----------|----------------|-------| +| Raspberry Pi 4 | Working | Working | | +| Raspberry Pi 3 | Working | Working | | +| Raspberry Pi Zero W | Untested | Mostly working | Since the Pi Zero is low powered, issues can arise fairly quickly when trying to run additional programs, this currently includes quickly changing the volume repeatedly. Total CPU usage sits at around 75% when using Shairport Sync. Updates to Shairport Sync could make this better or worse. | Guides --- diff --git a/documentation/Example Setups.md b/documentation/Example Setups.md new file mode 100644 index 00000000..f87ead00 --- /dev/null +++ b/documentation/Example Setups.md @@ -0,0 +1,20 @@ +Example Setups +=== + +Amazon Echo Devices +--- +Since some Amazon Echo devices have either a 3.5mm input or can be used as a bluetooth speaker, Shairport Sync can be connected allowing you to Airplay to these speakers. Currently using the 3.5mm jack is the most reliable method - bluetooth connectivity can have an unreliable delay. Check first to see if your Echo device supports either of these. Volume control of the Echo device can be added via Home Assistant and a MQTT broker. Below goes through some example setups. +### _Raspberry Pi --> Echo 3.5mm Input_ +* Set the Echo device to use the 3.5mm jack as an input. +* Via the Shairport Sync config, set the correct `output_device` and `mixer_control_name` for your configuration. Likely to be +`output_device = "hw:1";` and `mixer_control_name = "Headphone";`. +* At this point, you should be able to hear music via the Echo. Remember that so far, the volume of the Echo and Shairport Sync are _independent_. If you prefer, you can disable any volume control in Shairport Sync by setting `ignore_volume_control = "yes";`. +* Amazon Echo devices appear to add a bit of latency, currently this is thought to be 0.12 seconds. This can be countered by setting the following: `audio_backend_latency_offset_in_seconds = -0.12;`. This was measured _very_ crudely using Audacity so could be wrong. If anyone is able to determine the latency more accurately, please open an issue or pull request so these documents can be updated. +* You should now be able to use your Echo device in sync with other AirPlay devices! + +### _Raspberry Pi --> Echo as Bluetooth Speaker (Docker Version)_ +* + +### _Raspberry Pi --> Echo with Volume Control_ +* Before continuing with volume control via Home Assistant, please note that currently only one way volume control is tested - Shairport Sync to the Echo device. This means if the volume of the Echo is changed (e.g. by voice control or by the physical controls on the device), this will not be reflected in the volume of Shairport Sync and will be overwritten the next time Shairport Sync's volume is changed. +* This setup requires Home Assistant and a MQTT broker. The basic idea is that Shairport Sync sends a MQTT message containing the new volume amount to the MQTT broker when the volume is changed, this is then picked up by Home Assistant (which is monitoring the MQTT broker). Home Assistant will then send a command to the Amazon Echo device to change the volume. From a86955c0cefccef1b15f8f801d633225e5b45185 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Tue, 29 Jun 2021 10:41:59 +0100 Subject: [PATCH 04/14] Added libgcrypt --- BUILDFORAP2.md | 2 +- docker/Dockerfile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BUILDFORAP2.md b/BUILDFORAP2.md index a33f8e7c..ab340075 100644 --- a/BUILDFORAP2.md +++ b/BUILDFORAP2.md @@ -55,7 +55,7 @@ First, install the packages needed by Shairport Sync: ``` # apt-get install build-essential git xmltoman autoconf automake libtool \ libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev libglib2.0-dev \ - libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev + libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt ``` (Note: if you don't want the `D-Bus` interface, you may omit `libglib2.0-dev`.) diff --git a/docker/Dockerfile b/docker/Dockerfile index 9393f072..59121716 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -110,7 +110,8 @@ RUN apk add \ libuuid \ ffmpeg \ libsodium \ - libplist + libplist \ + libgcrypt RUN rm -rf /lib/apk/db/* From fb3fb4e7d3bd1c7fb0d4dd197d3d145b0cef6831 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Tue, 29 Jun 2021 11:10:40 +0100 Subject: [PATCH 05/14] Test. --- BUILDFORAP2.md | 2 +- docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILDFORAP2.md b/BUILDFORAP2.md index ab340075..e044c865 100644 --- a/BUILDFORAP2.md +++ b/BUILDFORAP2.md @@ -55,7 +55,7 @@ First, install the packages needed by Shairport Sync: ``` # apt-get install build-essential git xmltoman autoconf automake libtool \ libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev libglib2.0-dev \ - libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt + libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt-dev ``` (Note: if you don't want the `D-Bus` interface, you may omit `libglib2.0-dev`.) diff --git a/docker/Dockerfile b/docker/Dockerfile index 59121716..02136803 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -111,7 +111,7 @@ RUN apk add \ ffmpeg \ libsodium \ libplist \ - libgcrypt + libgcrypt-dev RUN rm -rf /lib/apk/db/* From dda067298d7935d33ee90932b82a8ef165a8b300 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Tue, 29 Jun 2021 12:51:45 +0100 Subject: [PATCH 06/14] Test. --- BUILDFORAP2.md | 2 +- docker/Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BUILDFORAP2.md b/BUILDFORAP2.md index e044c865..ab340075 100644 --- a/BUILDFORAP2.md +++ b/BUILDFORAP2.md @@ -55,7 +55,7 @@ First, install the packages needed by Shairport Sync: ``` # apt-get install build-essential git xmltoman autoconf automake libtool \ libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev libglib2.0-dev \ - libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt-dev + libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt ``` (Note: if you don't want the `D-Bus` interface, you may omit `libglib2.0-dev`.) diff --git a/docker/Dockerfile b/docker/Dockerfile index 02136803..d3997e54 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -93,7 +93,7 @@ RUN make -j RUN make install # Shairport Sync Runtime System: -FROM alpine:3.12 +FROM alpine:3.8 RUN apk add \ alsa-lib \ @@ -111,7 +111,7 @@ RUN apk add \ ffmpeg \ libsodium \ libplist \ - libgcrypt-dev + libgcrypt RUN rm -rf /lib/apk/db/* From 432e0876c5aaf40fac416e6eb9f735482a21b3be Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Tue, 29 Jun 2021 12:55:29 +0100 Subject: [PATCH 07/14] Revert. --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index d3997e54..59121716 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -93,7 +93,7 @@ RUN make -j RUN make install # Shairport Sync Runtime System: -FROM alpine:3.8 +FROM alpine:3.12 RUN apk add \ alsa-lib \ From f91efd77d252e6665abcc44f246d7d1a4bf2f292 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Tue, 29 Jun 2021 13:03:55 +0100 Subject: [PATCH 08/14] Test. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 541ec999..07c71c91 100644 --- a/configure.ac +++ b/configure.ac @@ -390,7 +390,7 @@ if test "x$with_airplay_2" = "xyes" ; then PKG_CHECK_MODULES([libplist], [libplist-2.0 >= 2.0.0],[CFLAGS="${libplist_CFLAGS} ${CFLAGS}" LIBS="${libplist_LIBS} ${LIBS}"],[AC_MSG_ERROR(AirPlay 2 support requires libplist 2.0.0 or later -- search for pkg libplist-2.2.0 or later!)]) fi PKG_CHECK_MODULES([libsodium], [libsodium],[CFLAGS="${libsodium_CFLAGS} ${CFLAGS}" LIBS="${libsodium_LIBS} ${LIBS}"],[AC_MSG_ERROR(AirPlay 2 support requires libsodium -- libsodium-dev suggested)]) - AC_CHECK_LIB([gcrypt], [gcry_control], [], [AC_MSG_ERROR([Airplay 2 support requires libgcrypt -- libgcrypt-dev suggested])]) + AC_CHECK_LIB([gcrypt], [main], [], [AC_MSG_ERROR([Airplay 2 support requires libgcrypt -- libgcrypt-dev suggested])]) # PKG_CHECK_MODULES([libgcrypt], [libgcrypt],[CFLAGS="${libgcrypt_CFLAGS} ${CFLAGS}" LIBS="${libgcrypt_LIBS} ${LIBS}"],[AC_MSG_ERROR(AirPlay 2 support requires libgcrypt -- libgcrypt-dev suggested)]) # AC_CHECK_LIB([sodium], [sodium_init], ,[AC_MSG_ERROR([AirPlay 2 support requires libsodium -- libsodium-dev suggested])]) AC_CHECK_LIB([avutil],[av_malloc], [], [AC_MSG_ERROR([Airplay 2 support requires libavutil -- libavutil-dev suggested])]) From d4b453538ea2e0bdfb69d15ffa63ef7bee170fe9 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Tue, 29 Jun 2021 13:13:58 +0100 Subject: [PATCH 09/14] Try this just in case. --- configure.ac | 2 +- docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 07c71c91..541ec999 100644 --- a/configure.ac +++ b/configure.ac @@ -390,7 +390,7 @@ if test "x$with_airplay_2" = "xyes" ; then PKG_CHECK_MODULES([libplist], [libplist-2.0 >= 2.0.0],[CFLAGS="${libplist_CFLAGS} ${CFLAGS}" LIBS="${libplist_LIBS} ${LIBS}"],[AC_MSG_ERROR(AirPlay 2 support requires libplist 2.0.0 or later -- search for pkg libplist-2.2.0 or later!)]) fi PKG_CHECK_MODULES([libsodium], [libsodium],[CFLAGS="${libsodium_CFLAGS} ${CFLAGS}" LIBS="${libsodium_LIBS} ${LIBS}"],[AC_MSG_ERROR(AirPlay 2 support requires libsodium -- libsodium-dev suggested)]) - AC_CHECK_LIB([gcrypt], [main], [], [AC_MSG_ERROR([Airplay 2 support requires libgcrypt -- libgcrypt-dev suggested])]) + AC_CHECK_LIB([gcrypt], [gcry_control], [], [AC_MSG_ERROR([Airplay 2 support requires libgcrypt -- libgcrypt-dev suggested])]) # PKG_CHECK_MODULES([libgcrypt], [libgcrypt],[CFLAGS="${libgcrypt_CFLAGS} ${CFLAGS}" LIBS="${libgcrypt_LIBS} ${LIBS}"],[AC_MSG_ERROR(AirPlay 2 support requires libgcrypt -- libgcrypt-dev suggested)]) # AC_CHECK_LIB([sodium], [sodium_init], ,[AC_MSG_ERROR([AirPlay 2 support requires libsodium -- libsodium-dev suggested])]) AC_CHECK_LIB([avutil],[av_malloc], [], [AC_MSG_ERROR([Airplay 2 support requires libavutil -- libavutil-dev suggested])]) diff --git a/docker/Dockerfile b/docker/Dockerfile index 59121716..6228aff1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -95,7 +95,7 @@ RUN make install # Shairport Sync Runtime System: FROM alpine:3.12 -RUN apk add \ +RUN apk -U add \ alsa-lib \ dbus \ popt \ From 9152c4a6a61547a5eb756578573fc75347895700 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Tue, 29 Jun 2021 13:14:52 +0100 Subject: [PATCH 10/14] Now try this. --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6228aff1..98a624ec 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -111,7 +111,7 @@ RUN apk -U add \ ffmpeg \ libsodium \ libplist \ - libgcrypt + libgcrypt-static RUN rm -rf /lib/apk/db/* From 123dc2e451294cac36583d3371285286d37e2679 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Tue, 29 Jun 2021 16:54:47 +0100 Subject: [PATCH 11/14] Please work. --- docker/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 98a624ec..91df6232 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -27,7 +27,8 @@ RUN apk -U add \ xxd \ libressl-dev \ openssl-dev \ - libplist-dev + libplist-dev \ + libgcrypt-dev # ALAC Build System: FROM builder-base AS builder-alac @@ -110,8 +111,7 @@ RUN apk -U add \ libuuid \ ffmpeg \ libsodium \ - libplist \ - libgcrypt-static + libplist RUN rm -rf /lib/apk/db/* From 91934188d7b20252db88807e72561515ae5106e0 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Tue, 29 Jun 2021 16:58:29 +0100 Subject: [PATCH 12/14] Update readme. --- BUILDFORAP2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILDFORAP2.md b/BUILDFORAP2.md index ab340075..e044c865 100644 --- a/BUILDFORAP2.md +++ b/BUILDFORAP2.md @@ -55,7 +55,7 @@ First, install the packages needed by Shairport Sync: ``` # apt-get install build-essential git xmltoman autoconf automake libtool \ libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev libglib2.0-dev \ - libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt + libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt-dev ``` (Note: if you don't want the `D-Bus` interface, you may omit `libglib2.0-dev`.) From 105f642952f0ea465755f8c92184bc62f4d5ed7b Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Tue, 29 Jun 2021 16:59:16 +0100 Subject: [PATCH 13/14] Update readme. --- documentation/Example Setups.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/documentation/Example Setups.md b/documentation/Example Setups.md index f87ead00..7ce6f658 100644 --- a/documentation/Example Setups.md +++ b/documentation/Example Setups.md @@ -13,8 +13,9 @@ Since some Amazon Echo devices have either a 3.5mm input or can be used as a blu * You should now be able to use your Echo device in sync with other AirPlay devices! ### _Raspberry Pi --> Echo as Bluetooth Speaker (Docker Version)_ -* +* WIP ### _Raspberry Pi --> Echo with Volume Control_ * Before continuing with volume control via Home Assistant, please note that currently only one way volume control is tested - Shairport Sync to the Echo device. This means if the volume of the Echo is changed (e.g. by voice control or by the physical controls on the device), this will not be reflected in the volume of Shairport Sync and will be overwritten the next time Shairport Sync's volume is changed. * This setup requires Home Assistant and a MQTT broker. The basic idea is that Shairport Sync sends a MQTT message containing the new volume amount to the MQTT broker when the volume is changed, this is then picked up by Home Assistant (which is monitoring the MQTT broker). Home Assistant will then send a command to the Amazon Echo device to change the volume. +* WIP From db580c26dc082c986d085038b0969beba13b8525 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Tue, 29 Jun 2021 21:07:26 +0100 Subject: [PATCH 14/14] Added libgcrypt to runtime image too. --- docker/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 91df6232..40822505 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -111,7 +111,8 @@ RUN apk -U add \ libuuid \ ffmpeg \ libsodium \ - libplist + libplist \ + libgcrypt RUN rm -rf /lib/apk/db/*