From 509164ad5bef6e8b1053deba1ad91118253ee476 Mon Sep 17 00:00:00 2001 From: alban Date: Tue, 10 Nov 2020 22:52:47 +0100 Subject: [PATCH] [enh] Adds dockers --- Dockerfile | 19 ++++++++++++++++ README.md | 57 +++++++++++++++++++++++++++++++++++------------- requirements.txt | 4 +++- 3 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3abf3e9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.8-slim +LABEL name=redilysis version=0.1 + +WORKDIR /opt +RUN apt update +RUN apt install -y --no-install-recommends build-essential\ + gcc\ + pkg-config\ + python-dev\ + portaudio19-dev\ + libsndfile1\ + alsa-utils\ + pulseaudio +RUN pip3 install librosa numpy pyaudio redis statistics + +COPY . . + +# Start the main process. +CMD ["python", "./redilysis.py", "-L"] diff --git a/README.md b/README.md index 7fc35b1..35156de 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,45 @@ Redilysis sends audio analysis to a redis server. The idea is to share a single audio analysis to many Visual Jockey filters, in our case for lasers. +### Requirements and installation + +You need: +* python 2.7 / 3+ +* an audio card +* a redis server + +#### Custom install on Linux + +Note that it will almost certainly fail on Debian 9/10/11. This is due to mandatory LLVM's version when compiling the numba library for librosa. + +``` +apt install -y --no-install-recommends build-essential gcc pkg-config python-dev portaudio19-dev libsndfile1 pulseaudio +pip3 install librosa numpy pyaudio redis statistics +git clone https://git.interhacker.space/tmplab/redilysis.git +cd redilysis +python redilysis.py --help +``` +You will need to have pulseaudio and a local redis server. + +#### With Docker + +Here is an example. It is a dirty method, but it works :) + +``` +docker run -it \ + -e NUMBA_CACHE_DIR=/tmp \ + -e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \ + -v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native \ + -v ~/.config/pulse/cookie:/root/.config/pulse/cookie \ + --group-add $(getent group audio | cut -d: -f3) \ + protonphoton/redilysis:latest \ + python redilysis.py -i 172.17.0.1 +``` + +Two things here: + +1. We are using here the `172.17.0.1` IP address to connect to the redis server. Change according to your needs. +2. The dirty part: Docker uses pulseaudio through your personal user and environment variables... ### Redis Keys and Contents for end users @@ -136,21 +175,6 @@ Examples are given based on previous values for redis keys. * etc. until you have ```f(i) > bpm_sample_interval``` -### Requirements and installation - -* python 2.7 -* audio card -* redis server - -To be honest, in my experience installation on Debian 9,10,11 is a mess, due to mandatory LLVM's version when compiling the numba library for librosa. - -```python -sudo apt install python-pyaudio python -git clone https://git.interhacker.space/tmplab/redilysis.git -cd redilysis -pip install -r requirements.txt -python redilysis.py --help -``` ### Running redilysis: Common parameters @@ -233,4 +257,7 @@ It attempts to detect beats based on audio "jumps" in intensity and energy. To correct a well-known error called the "octave error" where the detected tempo is twice/half or thrice/third of the real tempo, you can use the Min/Max BPM. When the calculated tempo is outside of the range, it will attempt to find more legitimate values. +# License + +Released under the GPLv3 License diff --git a/requirements.txt b/requirements.txt index 792ecf0..2cb0cdd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ -librosa==0.7.2 +librosa +numpy +pyaudio redis statistics