├── alsa_sound-config ├── asound-onboard.conf └── asound-hifibarry.conf ├── Dockerfile ├── DockerfileRPI ├── mopidy-master.conf ├── docker-compose.yml ├── docker-compose-rpi.yml └── readme.md /alsa_sound-config/asound-onboard.conf: -------------------------------------------------------------------------------- 1 | pcm.!default { 2 | type hw 3 | card 0 4 | } 5 | ctl.!default { 6 | type hw 7 | card 0 8 | } 9 | -------------------------------------------------------------------------------- /alsa_sound-config/asound-hifibarry.conf: -------------------------------------------------------------------------------- 1 | pcm.!default { 2 | type hw 3 | card sndrpihifiberry 4 | } 5 | ctl.!default { 6 | type hw 7 | card sndrpihifiberry 8 | } 9 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | 3 | 4 | RUN useradd -ms /bin/bash snapcast 5 | RUN usermod -a -G audio snapcast 6 | 7 | RUN mkdir -p /tmp/sharesound ; chown -R snapcast:audio /tmp/sharesound ; chmod 0777 /tmp/sharesound 8 | VOLUME ["/tmp/sharesound"] 9 | 10 | USER snapcast 11 | 12 | RUN mkfifo /tmp/sharesound/snapfifo 13 | 14 | CMD ["true"] 15 | -------------------------------------------------------------------------------- /DockerfileRPI: -------------------------------------------------------------------------------- 1 | FROM sdhibit/rpi-raspbian 2 | 3 | 4 | RUN useradd -ms /bin/bash snapcast 5 | RUN usermod -a -G audio snapcast 6 | 7 | RUN mkdir -p /tmp/sharesound ; chown -R snapcast:audio /tmp/sharesound ; chmod 0777 /tmp/sharesound 8 | VOLUME ["/tmp/sharesound"] 9 | 10 | USER snapcast 11 | 12 | RUN mkfifo /tmp/sharesound/snapfifo 13 | 14 | CMD ["true"] 15 | -------------------------------------------------------------------------------- /mopidy-master.conf: -------------------------------------------------------------------------------- 1 | [local] 2 | enabled = false 3 | 4 | [file] 5 | enabled = false 6 | 7 | [http] 8 | hostname = 0.0.0.0 9 | zeroconf = Mopidy HTTP server on $hostname 10 | 11 | [mpd] 12 | hostname = 0.0.0.0 13 | enabled = true 14 | port = 6600 15 | password = 16 | max_connections = 20 17 | connection_timeout = 60 18 | zeroconf = Mopidy MPD server on $hostname 19 | command_blacklist = listall,listallinfo 20 | default_playlist_scheme = m3u 21 | 22 | [audio] 23 | output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/sharesound/snapfifo 24 | #output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/var/sharesound/snapfifo 25 | #output= audioresample ! audioconvert ! audio/x-raw,rate=44100,channels=2,width=16,depth=16,endianness=1234,signed=true ! wavenc ! filesink location=/var/sharesound/snapfifo 26 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | data: 4 | build: 5 | context: . 6 | volumes: 7 | - soundshare:/tmp/sharesound 8 | 9 | mopidy: 10 | image: nolte/mopidy:development 11 | expose: 12 | - 6600 13 | - 6680 14 | ports: 15 | - "6600:6600" 16 | - "6680:6680" 17 | # environment: 18 | # - GST_DEBUG=3 19 | depends_on: 20 | - snapserver 21 | - data 22 | volumes: 23 | - ./mopidy-master.conf:/var/lib/mopidy/.config/mopidy/mopidy.conf:ro 24 | - soundshare:/tmp/sharesound 25 | network_mode: "host" 26 | 27 | snapserver: 28 | image: nolte/snapcast-server 29 | depends_on: 30 | - data 31 | volumes: 32 | - soundshare:/tmp/sharesound 33 | command: "-s pipe:///tmp/sharesound/snapfifo?name=Radio" 34 | 35 | snapclient: 36 | image: nolte/snapcast-client 37 | links: 38 | - snapserver:snapserverhost 39 | depends_on: 40 | - snapserver 41 | devices: 42 | - "/dev/snd/:/dev/snd/" 43 | command: "-h snapserverhost" 44 | 45 | upmpdcli: 46 | image: nolte/upmpdcli:development 47 | depends_on: 48 | - mopidy 49 | command: "-h localhost -p 6600 -f mopidy" 50 | network_mode: "host" 51 | 52 | 53 | volumes: 54 | soundshare: 55 | -------------------------------------------------------------------------------- /docker-compose-rpi.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | 4 | data: 5 | build: 6 | context: . 7 | dockerfile: DockerfileRPI 8 | volumes: 9 | - soundshare:/tmp/sharesound 10 | 11 | mopidy: 12 | image: nolte/rpi-mopidy:development 13 | expose: 14 | - 6600 15 | - 6680 16 | depends_on: 17 | - snapserver 18 | ports: 19 | - "6600:6600" 20 | - "6680:6680" 21 | devices: 22 | - "/dev/snd/:/dev/snd/" 23 | volumes: 24 | - soundshare:/tmp/sharesound 25 | - ./mopidy-master.conf:/var/lib/mopidy/.config/mopidy/mopidy.conf:ro 26 | network_mode: "host" 27 | 28 | snapserver: 29 | image: nolte/rpi-snapcast-server:development 30 | volumes: 31 | - soundshare:/tmp/sharesound 32 | command: "-s pipe:///tmp/sharesound/snapfifo?name=Radio" 33 | 34 | snapclient: 35 | image: nolte/rpi-snapcast-client:development 36 | volumes: 37 | - ./alsa_sound-config/asound-hifibarry.conf:/etc/asound.conf 38 | links: 39 | - snapserver:snapserverhost 40 | depends_on: 41 | - snapserver 42 | devices: 43 | - "/dev/snd/:/dev/snd/" 44 | command: "-h snapserverhost" 45 | 46 | upmpdcli: 47 | image: nolte/rpi-upmpdcli:development 48 | command: "-h localhost -p 6600 -f mopidy" 49 | depends_on: 50 | - mopidy 51 | ports: 52 | - "1900/udp:1900/udp" 53 | - "1900:1900" 54 | network_mode: "host" 55 | 56 | volumes: 57 | soundshare: 58 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Audiostation Docker 2 | 3 | Network Audio Player with [Mopidy](https://www.mopidy.com/),[SnapCast](https://github.com/badaix/snapcast) and [upmpdcli](https://www.lesbonscomptes.com/upmpdcli/). 4 | 5 | Use [tkem/mopidy-dleyna](https://github.com/tkem/mopidy-dleyna) to load the Music from external Devices with [DLNA support](https://01.org/dleyna). 6 | Use [UPnP](https://wikipedia.org/wiki/Universal_Plug_and_Play) for receiving the Music from Mobile Devices ([BubbleUPnP](https://play.google.com/store/apps/details?id=com.bubblesoft.android.bubbleupnp)) or other clients. 7 | 8 | I am using a [HiFiBerry Digi+](https://www.hifiberry.com/products/digiplus/) as additional sound card for my RPI2. The RPI are connected with [TOSLink](https://en.wikipedia.org/wiki/TOSLINK) to my Denon Audio Revceiver 9 | 10 | To Start the docker Contaieners on RPI i use [hypriot](https://blog.hypriot.com/) as base System image. 11 | 12 | ## Starting 13 | 14 | Use for starting use on **RPI** 15 | ``` 16 | docker-compose -f docker-compose-rpi.yml up 17 | ``` 18 | 19 | and on classic **amd64** Systems 20 | ``` 21 | docker-compose -f docker-compose.yml up 22 | ``` 23 | 24 | after the containers are running you can open [http://localhost:6680](http://localhost:6680) and use the Mopdiy webfrontend. 25 | 26 | **don`t forget** Mopidy has a [HTTP JSON-RPC API](https://docs.mopidy.com/en/latest/api/http/) and can be integrated to [home-assistant.io](https://home-assistant.io/components/media_player.mpd/). 27 | 28 | **Tested Android UPnP Apps** 29 | 30 | - [BubbleUPnP](https://play.google.com/store/apps/details?id=com.bubblesoft.android.bubbleupnp), works so good that i bought the Full Version, and did not test more apps. 31 | 32 | ## Structure 33 | 34 | You can find the used Dockerfiles at the GitHub repositories: [docker-snapcast](https://github.com/nolte/docker-snapcast), [docker-mopidy](https://github.com/nolte/docker-mopidy) and [docker-upmpdcli](https://github.com/nolte/docker-upmpdcli) 35 | 36 | #### Used Dockerimages 37 | 38 | The Connection between the Moidy Container and the [SnapCast Server](https://github.com/badaix/snapcast) runs over a gstreamer fifo file, configured as output in Mopidy. 39 | 40 | ``` 41 | ... 42 | [audio] 43 | output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/sharesound/snapfifo 44 | ... 45 | ``` 46 | form [snapcast player setup ](https://github.com/badaix/snapcast/blob/master/doc/player_setup.md#mopidy) 47 | 48 | 49 | On Docker the fifo file will be create by a data container, all three containers share a [volume](https://docs.docker.com/compose/compose-file/#volumes) which contains the shared file. 50 | 51 | ##### Docker Hub Used Images 52 | 53 | **amd64** 54 | - https://hub.docker.com/r/nolte/snapcast-server/ 55 | - https://hub.docker.com/r/nolte/snapcast-client/ 56 | - https://hub.docker.com/r/nolte/mopidy/ 57 | - https://hub.docker.com/r/nolte/upmpdcli/ 58 | 59 | **armhf** 60 | - https://hub.docker.com/r/nolte/rpi-snapcast-server/ 61 | - https://hub.docker.com/r/nolte/rpi-snapcast-client/ 62 | - https://hub.docker.com/r/nolte/rpi-mopidy/ 63 | - https://hub.docker.com/r/nolte/rpi-upmpdcli/ 64 | --------------------------------------------------------------------------------