[enh] Adds dockers

This commit is contained in:
alban 2020-11-10 22:52:47 +01:00
parent fcd15ef0ea
commit 509164ad5b
3 changed files with 64 additions and 16 deletions

19
Dockerfile Normal file
View File

@ -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"]

View File

@ -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

View File

@ -1,3 +1,5 @@
librosa==0.7.2
librosa
numpy
pyaudio
redis
statistics