trouby
Published © GPL3+

Trigger to MIDI Converter

I had to develop a MIDI converter for 2 80s drum machine to embedding them into my modular system.

IntermediateShowcase (no instructions)2,173
Trigger to MIDI Converter

Things used in this project

Hardware components

19" 1U case
×1
Amphenol jacks
×1
Arduino Nano R3
Arduino Nano R3
×1
Custom PCB
Custom PCB
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

Schaeffer front panel

Schematics

input prevention

Code

TR-909

Arduino
// Trigger to MIDI - Roland TR-909

#include <MIDI.h>

bool trig[11];
bool mem[11];
byte drum[11]={38,45,37,42,51,49,46,39,48,41,35};
//             SD LT HT CP OH CC RC CH RS MT BD
byte x;

void setup() {
pinMode(2,INPUT);  //SD
pinMode(3,INPUT);  //MT
pinMode(4,INPUT);  //RS
pinMode(5,INPUT);  //CH
pinMode(6,INPUT);  //RC
pinMode(7,INPUT);  //CC
pinMode(8,INPUT);  //OH
pinMode(9,INPUT);  //CP

pinMode(10,INPUT); //HT
pinMode(11,INPUT); //LT
pinMode(12,INPUT); //BD

Serial.begin(31250);

for (x=0;x<11;x++){
  trig[x]=LOW;
  mem[x]=LOW;
}
delay(1000);
}

void loop() {
trig[0]=digitalRead(2);
trig[1]=digitalRead(3);
trig[2]=digitalRead(4);
trig[3]=digitalRead(5);
trig[4]=digitalRead(6);
trig[5]=digitalRead(7);
trig[6]=digitalRead(8);
trig[7]=digitalRead(9);
trig[8]=digitalRead(10);
trig[9]=digitalRead(11);
trig[10]=digitalRead(12);

for (x=0;x<11;x++){
  if (trig[x]==HIGH){
    if (mem[x]==LOW){
      Serial.write(144);
      Serial.write(drum[x]);
      Serial.write(127);
      mem[x]=HIGH;
    }}
  if (trig[x]==LOW){
    if (mem[x]==HIGH){
      Serial.write(128);
      Serial.write(drum[x]);
      Serial.write(0);
      mem[x]=LOW;
}}}}

HR-16

Arduino
// Trigger to MIDI - Alesis HR-16

#include <MIDI.h>

bool trig[16];
bool mem[16];
byte drum[16]={48,41,65,67,68,62,63,45,49,46,42,38,35,39,44,51};
//             CH T3 P1 P3 P4 P2 T4 T2 CC OH CH SD BD CP MH RC
byte x;

void setup() {
pinMode(2,INPUT);  //T1
pinMode(3,INPUT);  //T3
pinMode(4,INPUT);  //P1
pinMode(5,INPUT);  //P3
pinMode(6,INPUT);  //P4
pinMode(7,INPUT);  //P2
pinMode(8,INPUT);  //T4
pinMode(9,INPUT);  //T2

pinMode(10,INPUT); //CC
pinMode(11,INPUT); //OH
pinMode(12,INPUT); //CH
pinMode(A0,INPUT); //SD
pinMode(A1,INPUT); //BD
pinMode(A2,INPUT); //CP
pinMode(A3,INPUT); //MH
pinMode(A4,INPUT); //RC

Serial.begin(31250);

for (x=0;x<16;x++){
  trig[x]=LOW;
  mem[x]=LOW;
  }

delay(1000);
}

void loop() {
trig[0]=digitalRead(2);
trig[1]=digitalRead(3);
trig[2]=digitalRead(4);
trig[3]=digitalRead(5);
trig[4]=digitalRead(6);
trig[5]=digitalRead(7);
trig[6]=digitalRead(8);
trig[7]=digitalRead(9);
trig[8]=digitalRead(10);
trig[9]=digitalRead(11);
trig[10]=digitalRead(12);
trig[11]=digitalRead(A0);
trig[12]=digitalRead(A1);
trig[13]=digitalRead(A2);
trig[14]=digitalRead(A3);
trig[15]=digitalRead(A4);

for (x=0;x<16;x++){
  if (trig[x]==HIGH){
    if (mem[x]==LOW){
      Serial.write(144);
      Serial.write(drum[x]);
      Serial.write(127);
      mem[x]=HIGH;
    }}
  if (trig[x]==LOW){
    if (mem[x]==HIGH){
      Serial.write(128);
      Serial.write(drum[x]);
      Serial.write(0);
      mem[x]=LOW;
}}}}

Credits

trouby

trouby

2 projects • 0 followers

Comments