/midihacks

Code for retuning MIDI streams

Primary LanguagePython

Code here should work for retuning a MIDI keyboard
to 29-note equal temperament.
Functionality and usability will hopefully improve.


To run this on Linux:

1. Make and activate a virtualenv with a recent Python3

2. Run "pip install rtmidi"

3. From "aconnect -i" and "aconnect -o" to see the MIDI devices

4. Run "python rthack $IN $OUT" where
   $IN is part of the name of a device from "aconnect -i" and
   $OUT is part of the name of a device from "aconnect -o"
   You can also run "python rthack" and use "aconnect" as usual.
   Some devices are visible to aconnect but not rtmidi
   to make things a bit more interesting.


To run this on a BBC micro:bit:

1. Find a MIDI UART adapter for the micro:bit

2. Connect MIDI in to pin 1 and MIDI out to pin 2

3. Flash "midibit.py" to the micro:bit (e.g. uflash midibit.py /media/sdb)

4. Copy "midi.py" and "retune.py" over (e.g. ufs put midi.py; ufs put retune.py)

5. Reset the micro:bit

6. Press button A (the one on the left)

7. This should be relaying and retuning now

8. Press button A again to get the serial terminal back


To run this on an ESP8266 board:

1. Find a MIDI UART adapter

2. Connect MIDI in to "RX" and MIDI out to "TX"

3. Connect a switch (the panic button) between the 3V line and pin 15.

4. Copy "espmidi.py", "midi.py" and "retune.py" over.  e.g.:
    * Activate your Python3 virtualenv
    * pip install adafruit-ampy
    * ampy -p /dev/ttyUSB0 put espmidi.py
    * ampy -p /dev/ttyUSB0 put midi.py
    * ampy -p /dev/ttyUSB0 put retune.py

5. Connect on the USB-serial terminal

6. "import espmidi" and "espmidi.main()"

7. Disconnect from the serial terminal (you get interference from MIDI)

8. Turn on your MIDI keyboard

9. Press the panic button to get the serial terminal back