Wired and Wireless Versions
There are two versions of for a wired setup, and a bluetooth wireless setup. The wired setup uses a single Raspberry PI zero which collects EEG data and sends MIDI messages over the USB:MIDI converter to the synthesizer. This is problamatic, as there is potential for a lot of noise which can effect the signal from the EEG electrodes. Considering the EEG singal is in the range of a millionths of a voltage, any noise can disrupt the signal and make it unusable. Therefore, a pair of python scripts for a wireless version have been provided. The msc_client.py is run on the raspberry pi which handles the MIDI messages, so can sit on the table away from the user. The msc_server.py is run on the rapsberry PI zero with the Pinaps, being worn by the user.
Hardware
In our setup, we used the following equipment
* Roland AIRA SYSTEM-1 PLUG-OUT Synthesizer - https://www.roland.com/us/products/system-1/
* USB to Midi cable - https://www.amazon.co.uk/Interface-OIBTECH-Upgrade-Professional-Converter/dp/B07FQSFMRZ
* Raspberry pi Zero - https://www.amazon.co.uk/Raspberry-Pi-Zero-Wireless-Essentials/dp/B06XCYGP27
* Pinaps - https://www.blino.io/product-page/pi-zero-eeg-hat
Additionally, for the wireless version, a Raspberry PI Model 3 B is used manage sending MIDI messages to the synthesizer. Any raspberry PI should be able to take the place of this though, as long as it supports Bluetooth.
Software
This project involves the installation of exisiting python packages and python scripts which run on either the single wired Raspberry PI, or the pair of Raspberry PIs in the wireless setup.
The python software packages involved in this project include the following: EEG Pinaps (http://docs.blino.io), serial port interfacing (https://github.com/mido/mido) and for the wireless versions PyBlueZ (https://github.com/pybluez/pybluez).
These packages are used in the python script which is run on the Raspberry PI zero with the Pinaps. The wireless setup involves two python scripts addtionally using PyBlueZ for bluetooth.
For the full set of instructions on setting up and running the this project as designed. See the guide section.
Python Code
Let's dive into the python code of the wired setup. The wireless setup follows the same design here but breaks the python code into two scripts and involves the management of a bluetooth connection. These details will not be covered here but are available in the source code for inspection: https://github.com/Harri-Renney/Mind_Control_Synth/tree/master/wireless_version
Constants
A number of constants are defined globally as:
# Constants CTRL_LFO_PITCH = 26 CTRL_LFO_RATE = 29 MIDI_MESSAGE_PERIOD = 1
The first to constants preceded by CTRL are control constants for the Roland low frequency pitch and rate/speed respectively. The values for these indices are found in the Roland control numbers are documented in the SYSTEM-1 Midi document: https://www.roland.com/uk/support/by_product/system-1/owners_manuals/
The MIDI_MESSAGE_PERIOD is the time in seconds between updating the Roland synth with new conrol parameters. Currently set to one second.
Mido
Setting up Mido on the USB port with an initialization...
Read more »