Skip to content

A set of MIDI tools to use with M8C running on a Raspberry Pi 4 with Patchbox OS.

License

Notifications You must be signed in to change notification settings

RowdyVoyeur/midi-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIDI Tools for M8C and Roland MC-101

Introduction

This is a set of MIDI tools to use with M8C running on a Raspberry Pi with Patchbox OS, and a Roland MC-101. These tools have been customised to programmatically perform the following tasks:

  • Capture specific MIDI Control Change (CC) messages sent by the transport buttons of the Korg nanoKONTROL and convert them into MIDI Notes to control the M8;

  • Capture specific MIDI Note messages sent by the Korg nanoKONTROL and convert them into commands to change the audio routing between M8, MC-101, System Audio In and System Audio Out. If you have a Pisound, this can also be achieved with this script, which uses the clicks on The Button to change the audio routing;

  • Capture specific MIDI Control Change (CC) messages sent by the Korg nanoKONTROL and use them to control the main output and main input volume levels of Alsamixer.

While the second and third tasks can be useful for any setup, the first task is only useful if you have the original version of Korg nanoKONTROL. As far as I know, the following versions of this device can send MIDI Note messages from the transport buttons. Therefore, it is not necessary to convert MIDI CC to MIDI Notes.

CC To Note

The CC To Note tool uses python-rtmidi to capture MIDI Control Change (CC) messages sent on a specific MIDI Channel and convert them to MIDI Notes, which will then be pushed to another MIDI Channel.

This tool is basically a customised version of sherbocopter's script midi-cc-to-note, whith some minor changes to fit my needs. Therefore, I would like to thank sherbocopter for the phenomenal work.

MIDI To Command

The MIDI To Command tool also uses python-rtmidi to capture MIDI Note messages sent on a specific MIDI Channel and convert them into actions or commands that can perform whatever you wish.

The original version of this tool can be found in the examples of the python-rtmidi. I simply configured it and created the scripts to perform the required commands. Thank you very much SpotlightKid for the amazing repository.

Control Amixer

The Control Amixer tool uses aseqdumpto capture MIDI Control Change (CC) messages and use the data to adjust two amixer simple mixer controls, namely Speakerand Mic, which are responsible for controlling the main output and main input volume levels of Alsamixer.

This tool assumes you are using this audio configuration, but it can be easily modified for other setups.

Installation

  1. To install these tools simply clone using:
cd
git clone https://github.com/RowdyVoyeur/midi-tools.git
  1. The MIDI To Command uses custom shell scripts. Therefore, you need to get into the midi-to-command directory and make all scripts executable by everyone:
cd
cd midi-tools/midi-to-command
sudo chmod a+x *.sh
  1. It shouldn't be necessary to install rtmidi because it's already part of Blokas Patchbox OS. However, you will need to install pyyaml. Start by installing pip:
sudo apt install python3-pip
  1. And then, install pyyaml:
sudo pip3 install pyyaml
  1. The Control Amixer also uses a custom bash script. Therefore, you need to get into the control-amixer directory and make the script executable by everyone:
cd
cd midi-tools/control-amixer
sudo chmod +x *.sh
  1. Once the steps above are done, you should test the scripts before automatically start them on boot. Connect the MIDI device(s), reboot and run the following to test midi-to-command:
cd
sudo python midi-tools/midi-to-command/midi2command.py midi-tools/midi-to-command/config.cfg -p nanoKONTROL
  1. Run the following to test cc-to-note:
cd
sudo python midi-tools/cc-to-note/main.py --config midi-tools/cc-to-note/config.json
  1. And run the following to test control-amixer:
cd
cd midi-tools/control-amixer
./control-amixer.sh
  1. If you did not find any errors, you can configure how you would like these tools to automatically start on boot. You can use several methods such as systemd or crontab to automatically start these tools on boot. However, if you are using the M8C Module for Patchbox OS you can simply customise the m8c.sh script and uncomment the relevant lines.

  2. Specific information about the configuration of each tool can be found here for CC To Note, here for MIDI To Command, here for Control Amixer, and here for The Button.

MIDI Configuration

You need to configure the MIDI Control Channels on each device to receive data and prevent conflicts.

If you're using the exact same exact setup comprised of M8, MC-101 and Korg nanoKONTROL, then you can use these settings:

  • M8's Control Map Chan is set to 16;

  • MC-101's Control Channel is set to anything different than 8, 15 or 16 (to prevent MIDI conflicts);

  • Korg nanoKONTROL is using this set file.

If you are using a different setup, then just remember the following default configurations:

  • CC To Note and Korg nanoKONTROL's scenes 1 and 2 are sending MIDI data to the M8 on channel 16;

  • MIDI To Command and Korg nanoKONTROL's scene 4 are sending MIDI data to the M8 on channel 15;

  • Korg nanoKONTROL's scene 3 is sending MIDI data to the M8 on channel 8 (you can find more information about this here).

References

Download nanoKONTROL editor

Convert MIDI Notes to Pitch Values

Control almost anything using a MIDI controller