Git Product home page Git Product logo

ledfxdocker-virtual's Introduction

Docker Pulls Docker Image Size (latest by date) Docker OS/ARCH Docker OS/ARCH

This is fork from LedFxDocker

LedFxDocker

A Docker Image for the latest developement branch of LedFx.

Introduction

Compiling LedFx to run on different systems is difficult because of all the dependencies. It's especially difficult on a Raspberry Pi (building LedFx on ARM takes over 2 hours). This image has everything built for you, and it can get audio from a Snapcast server or a named pipe.

Supported Architectures

This image supports x86-64and arm . Docker will automatically pull the appropriate version.

Setup

docker-compose.yml

version: '3'

services:
  ledfx-virt:
    image: spirocekano/ledfx-virt
    container_name: ledfx-virt
    hostname: ledfx-virt
    environment: 
      - HOST=host.docker.internal
      - FORMAT=-r 44100 -f S16_LE -c 2
    network_mode: host
    volumes:
      - ./ledfx-config:/root/.ledfx
      - ~/audio:/app/audio
    devices:
      - /dev/snd:/dev/snd

Volumes

Volume Function
/root/.ledfx This is where the LedFx configuration files are stored. Most people won't need to change anything here manually, so feel free to use a named volume.
/app/audio This folder contains a named pipe called stream that you can write audio data to. This can be connected to Mopidy, FFmpeg, system audio, or more. See Sending Audio for more information. This volume doesn't need to be set if the FORMAT environment variable isn't set.

Environment Variables

Each variable corresponds to a different input method. One of the two variables must be set to send audio into the container (or you can set both).

Variable Function
HOST This is the IP of the Snapcast server. Keep in mind that this IP is resolved from inside the container unless you use host networking. To refer to other docker containers in bridge networking (the default for any two containers in the same compose file), just use the name of the container. To refer to 127.0.0.1 use host.docker.internal.
FORMAT This variable specifies the format of the audio coming into /app/audio/stream. It can use any of the options defined in aplay. The example shown above corresponds to 44100hz, 16 bits, and 2 channels, the default for most applications.

Sending Audio

The trickiest part of using this image is getting audio into it. Dealing with audio device drivers is pretty painful; so much so that I spent 20 minutes getting LedFx installed and 50 hours squashing audio bugs. Don't worry, that work has already been done, so here are three approaches to get audio into the container:

Snapcast

Snapcast is a server for playing music synchronously to multiple devices. This image can act as a snapclient device and connect to a snapserver simply by setting the HOST environment variable, but you need to get audio into Snapcast too.

Fundamentally, Snapcast's server gets its audio from a named pipe. This is where option two comes in; you can send audio directly into this image using its named pipe. Snapcast is useful if you have multiple speakers you want to connect to, you already have a snapserver, or you want to send audio from a separate device and have it play in both LedFx and over the system speaker out (phone -> raspberry pi running Snapcast and LedFx -> speakers).

Named Pipe

This is a great approach if you just want to play system audio or if you're connecting it to some other audio service, and you don't need the extra bloat from Snapcast. Because this image receives data just like a snapserver, any tutorial you find for getting audio into a snapserver will work with this image. Setup of audio players/server provides instructions on how to connect Mopidy, FFmpeg, PulseAudio, Airplay, Spotify, VLC, and more.

To play system audio, you could use Docker's --device flag or use FFmpeg to record system audio and send it to the pipe.

If you want to use a method not mentioned here or one that doesn't have an explicit named pipe option, your easiest method would probably be playing the audio on the system; then use a tool like FFmpeg or PulseAudio to record the system's audio and send it to the container.

Support Information

  • Shell access while the container is running: docker exec -it ledfx-virt /bin/bash
  • Logs: docker logs ledfx-virt

Todo

  • Add a Mopidy example
  • Add an example using --device
  • Check if a direct connection to the PulseAudio server works. Example.

Building Locally

If you want to make local modifications to this image for development purposes or just to customize the logic:

git clone https://github.com/spiro-c/LedFxDocker.git -b Virtuals
cd LedFxDocker
docker build -t spirocekano/ledfx-virt .

ledfxdocker-virtual's People

Contributors

buzztiaan avatar dependabot-preview[bot] avatar jptrsn avatar renovate-bot avatar shirommakkad avatar spiro-c avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ledfxdocker-virtual's Issues

Wrong version number?

Thank you for this docker container, it saved me a lot of time and hassle! :)

I was just wondering which version of ledfx it is? In my setup it says 1.0.0, this can't be right?

Screenshot_20220921_155838

Issue connecting Snapcast

Hello I have Mopidy and Snapcast running in docker and wanted to get this LedFx container setup to work with them but am having a couple of issues.

My Mopidy has an audio output that is
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! filesink location=/tmp/snapfifo

From what i can tell this LedFx container is looking for an output in a file called stream. So if i change the Mopidy out to
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S32LE ! filesink location=/tmp/stream

LedFx can access that, however that then renders my snapcast unavailable as it is wanting snapfifo.

So my question is how would i get this all working together, what files do i need to edit to have this all work in sync. If this is a mopidy config file setting, and someone has an example i can look at that would be great. I'm just a little confused at how this all works together.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

docker-compose
docker-compose.yml
dockerfile
Dockerfile
  • python 3.9-slim-buster
Dockerfile.venv
  • python 3.9-buster
github-actions
.github/workflows/master.yml
  • actions/checkout v2
  • docker/setup-qemu-action v1
  • docker/setup-buildx-action v1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.