Compare commits
2 Commits
fbb9ee57d8
...
509164ad5b
Author | SHA1 | Date | |
---|---|---|---|
|
509164ad5b | ||
|
fcd15ef0ea |
19
Dockerfile
Normal file
19
Dockerfile
Normal 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"]
|
57
README.md
57
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
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#! /usr/bin/python2.7
|
||||
"""
|
||||
Sends live audio analysis to the terminal.
|
||||
|
||||
@ -227,9 +228,9 @@ def m_spectrum(audio_data):
|
||||
#debug( 'spectrum_120:{} '.format(spectrum_120))
|
||||
#debug( 'spectrum_10:{}'.format(spectrum_10))
|
||||
#debug( 'rms:{}'.format(rms_avg))
|
||||
r.set( 'spectrum_120', json.dumps( spectrum_120 ) )
|
||||
r.set( 'spectrum_10', json.dumps( spectrum_10 ) )
|
||||
r.set( 'rms', "{}".format(rms_avg) )
|
||||
if len(spectrum_120): r.set( 'spectrum_120', json.dumps( spectrum_120 ) )
|
||||
if len(spectrum_10): r.set( 'spectrum_10', json.dumps( spectrum_10 ) )
|
||||
if rms : r.set( 'rms', "{}".format(rms_avg) )
|
||||
return True
|
||||
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
librosa==0.7.2
|
||||
librosa
|
||||
numpy
|
||||
pyaudio
|
||||
redis
|
||||
statistics
|
||||
|
Loading…
Reference in New Issue
Block a user