AutoSyncHost/readme.md

86 lines
2.6 KiB
Markdown
Raw Normal View History

2024-06-26 15:02:12 +02:00
# AutoSyncHost
## Description
2024-06-26 15:05:42 +02:00
### An automatic midi host application that sends midi sync commands to other MIDI devices connected via USB.
2024-06-26 15:02:12 +02:00
2024-06-26 15:05:42 +02:00
This python script is intended to run headless on a raspberry pi but can run on any other python able device as well.
2024-06-26 15:02:12 +02:00
2024-06-26 15:05:42 +02:00
The output is filtered so the host doesn´t receive sync signals from the members and thus not causing midi loops.
2024-06-26 15:02:12 +02:00
2024-06-26 15:05:42 +02:00
*Notes,CCs and other messages are not handled currently.*
2024-06-27 19:03:03 +02:00
## Installation
- SSH into PI
### Get repository
2024-06-26 15:02:12 +02:00
- pull from repository with `git clone https://git.raise-uav.com/Hermes/AutoSyncHost.git`
2024-06-27 19:03:03 +02:00
- 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`
2024-06-26 15:02:12 +02:00
- `pip install python-rtmidi`
2024-06-27 19:03:03 +02:00
- '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.
2024-06-26 15:02:12 +02:00
## 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.
2024-06-27 19:03:03 +02:00
### 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*
2024-06-26 15:02:12 +02:00