2.6 KiB
AutoSyncHost
Description
An automatic midi host application that sends midi sync commands to other MIDI devices connected via USB.
This python script is intended to run headless on a raspberry pi but can run on any other python able device as well.
The output is filtered so the host doesn´t receive sync signals from the members and thus not causing midi loops.
Notes,CCs and other messages are not handled currently.
Installation
- SSH into PI
Get repository
- pull from repository with
git clone https://git.raise-uav.com/Hermes/AutoSyncHost.git
- Alternatively download directly from page via download zip and extract into a folder.
Preparation
Install Python and pip if they are not already installed. You can use the following commands to install them:
sudo apt-get update
sudo apt-get install python3 python3-pip
Create Environment
Navigate to the directory where you cloned the repository. For example:
- One directory below the AutoSyncHost directorys like
/home/pi
python3 -m venv AutoSyncHost
source AutoSyncHost/bin/activate
Install Packages
pip install mido
pip install python-rtmidi
- 'sudo apt-get install libjack-jackd2-dev' (Might be necessary if error occurs)
Start Program
cd AutoSyncHost
python ashost.py
App is running and waiting for a device playing. You need to restart the script if new devices have been connected. If oyu got the systemd service running you need to restart the PI.
Usage
- First MIDI device that sends a midi "start" command becomes the host everybody listens to.
- After hitting stop, ASH has an assigned host and all devices are in sync when pressing play again.
- Pressing "stop" three times will unbind the host from its duties and restart the app and assignment.
Notes
It is especially interesting for devices that don´t have a physical MIDI port like the OP-Z or OP-1.
Make it a service
This will start the script automatically after the pi has started and will restart it.
Create a ashost.service file in /etc/systemd/system
sudo nano /etc/systemd/system/ashost.service
[Unit]
Description=AutoSyncHost service
Wants=network-online.target
After=network.target network-online.target
[Service]
Type=simple
Restart=always
ExecStart=/bin/bash /home/maxi/Desktop/start.sh
RestartSec=5
TimeoutSec=60
RuntimeMaxSec=infinity
PIDFile=/tmp/mydaemon.pid
[Install]
WantedBy=multi-user.target
- Save and exit with CTRL -O, Enter, CTRL X
sudo systemctl daemon-reload
sudo systemctl enable ashost.service
sudo systemctl start ashost.service
sudo systemctl status ashost.service
The status command should show a running service*