-
Notifications
You must be signed in to change notification settings - Fork 67
(Outdated) Manual installation
This is the manual installation, which was replaced by the automatic installation script.
-
Manual Setup
- Download and install dependencies
- Setup Microphone
- Install Music LED Strip Controller (MLSC)
- Add MLSC to the autostart.
Note: You do not need to do the Manual Setup if you already used the Automatic Setup Script.
- Update packages:
sudo apt-get update
sudo apt-get upgrade
- Install Audio Driver
sudo apt-get install libatlas-base-dev portaudio19-dev
- Install Python
sudo apt-get install python3
- Install required Python modules:
Install Pip:
sudo apt-get install python3-pip
Upgrade Pip to the newest version:
pip3 install --upgrade pip
Install Numpy (Offers a lot of mathematical functions and matrix manipulation. This version is required because 1.16 has a memory leak when using queues.):
sudo pip3 install -I numpy==1.17.0
Install Cython (Required to build the rpi_ws281x. module):
sudo pip3 install cython
Install Scipy (Offers a gaussian filter.):
sudo pip3 install scipy==1.3.0
Install Flask (The web server component.):
sudo pip3 install flask
Install PyAudio (Offers the audio input stream, which will be processed.):
sudo pip3 install pyaudio
Install coloredlogs:
sudo pip3 install coloredlogs
Install Flask_Login:
sudo pip3 install Flask_Login
Install Jinja2:
sudo pip3 install Jinja2
Install environs:
sudo pip3 install environs
Install waitress:
sudo pip3 install waitress
- Build and install the rpi_ws281x module.
Select a place where you want to build the module. /share
is used by default.
Create a new directory:
sudo mkdir /share
Navigate to the directory:
cd /share
Install Git:
sudo apt-get install git
Install the dependencies for rpi_ws281x module:
sudo apt-get install build-essential python3-dev scons swig
Ensure you are in the /share
directory and clone the repository:
sudo git clone https://github.com/jgarff/rpi_ws281x.git
Move inside the cloned repository and build the project:
cd rpi_ws281x
sudo scons
The Terminal output should look like this:
Move inside the python
directory and install the python module:
cd python
sudo python3 setup.py install
Plug-in your USB microphone.
Create/edit /etc/asound.conf
using Nano or any other preferred editor:
sudo nano /etc/asound.conf
Write the following text to /etc/asound.conf
:
pcm.!default {
type hw
card 1
}
ctl.!default {
type hw
card 1
}
In Nano, you can save changes by pressing "Ctrl+X", "Y" and "Enter".
Set the USB device to be the default device by editing /usr/share/alsa/alsa.conf
:
sudo nano /usr/share/alsa/alsa.conf
Enable the Default Card:
Change
defaults.ctl.card 0
defaults.pcm.card 0
To
defaults.ctl.card 1
defaults.pcm.card 1
Disable unused interfaces:
Change
#
# PCM interface
#
# redirect to load-on-demand extended pcm definitions
pcm.cards cards.pcm
pcm.default cards.pcm.default
pcm.sysdefault cards.pcm.default
pcm.front cards.pcm.front
pcm.rear cards.pcm.rear
pcm.center_lfe cards.pcm.center_lfe
pcm.side cards.pcm.side
pcm.surround21 cards.pcm.surround21
pcm.surround40 cards.pcm.surround40
pcm.surround41 cards.pcm.surround41
pcm.surround50 cards.pcm.surround50
pcm.surround51 cards.pcm.surround51
pcm.surround71 cards.pcm.surround71
pcm.iec958 cards.pcm.iec958
pcm.spdif iec958
pcm.hdmi cards.pcm.hdmi
pcm.dmix cards.pcm.dmix
pcm.dsnoop cards.pcm.dsnoop
pcm.modem cards.pcm.modem
pcm.phoneline cards.pcm.phoneline
To
#
# PCM interface
#
# redirect to load-on-demand extended pcm definitions
pcm.cards cards.pcm
pcm.default cards.pcm.default
pcm.sysdefault cards.pcm.default
#pcm.front cards.pcm.front
#pcm.rear cards.pcm.rear
#pcm.center_lfe cards.pcm.center_lfe
#pcm.side cards.pcm.side
#pcm.surround21 cards.pcm.surround21
#pcm.surround40 cards.pcm.surround40
#pcm.surround41 cards.pcm.surround41
#pcm.surround50 cards.pcm.surround50
#pcm.surround51 cards.pcm.surround51
#pcm.surround71 cards.pcm.surround71
#pcm.iec958 cards.pcm.iec958
#pcm.spdif iec958
#pcm.hdmi cards.pcm.hdmi
#pcm.dmix cards.pcm.dmix
#pcm.dsnoop cards.pcm.dsnoop
#pcm.modem cards.pcm.modem
#pcm.phoneline cards.pcm.phoneline
Reboot:
sudo reboot
Navigate to the /share
directory:
cd /share
Clone the repository:
sudo git clone https://github.com/TobKra96/music_led_strip_control.git
Using a systemd
service, each time Raspberry Pi reboots, MLSC will run.
Stop MLSC if it is still running.
- Create a file
mlsc.service
in/etc/systemd/system/
:
sudo touch /etc/systemd/system/mlsc.service
- Add the following to the created
mlsc.service
file:
[Unit]
Description=Music LED Strip Control
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/share/music_led_strip_control/server
ExecStart=python3 main.py
Restart=on-abnormal
RestartSec=10
KillMode=control-group
[Install]
WantedBy=multi-user.target
- Run the following commands to enable and start MLSC:
sudo systemctl daemon-reload
sudo systemctl enable mlsc.service
sudo systemctl start mlsc.service
- Reboot:
sudo reboot
- Check if the service is running:
sudo systemctl status mlsc.service
MLSC should now restart on reboot.
To remove the service from autostart, run the following commands:
sudo systemctl stop mlsc.service
sudo systemctl disable mlsc.service
Note: The WorkingDirectory
specified in the service is /share
. If you did not change anything during the installation, the service should work without issues.