Making a simple MIDI Controller. One Man's Journey

Here's some quick Ideas I played with last year for a "stomp box" style of foot control. However I used the Fluxamasynth as my output synth (everything in the one spot and compact) and also used a Uno to to the hard work.

#include "Fluxamasynth.h"

# define bass 36              // Define midi note numbers for several GM drum sounds
# define snare 38
# define hihatC 42
# define hihatP 44
# define hihatO 46

Fluxamasynth synth;		// create a synth object

// * Some basic settings */
int channel = 9;              // MIDI channel number
int tempo = 127;              // Start tempo

const int pad0 = A0;  // Analog input pin that the potentiometer is attached to
const int pad1 = A1;  // Analog input pin that the potentiometer is attached to
const int pad2 = A2;  // Analog input pin that the potentiometer is attached to
const int ledPin = 13;       // LED connected to digital pin 13

int sensor0 = 0;         // value read from the sensor
int perc_0 = 45;         //Center
int sensor1 = 0;         // value read from the sensor
int perc_1 = 49;         //LHS
int sensor2 = 0;         // value read from the sensor
int perc_2 = 38;          //RHS
int trapADC = 0;            //used to trap the reading
int trapSensor = 0;
int sensorHi = 0;
int sensorLo = 2000;
int trigger = 0;
int hiHys = 500;
int loHys = 100;
int vel = 120;

void setup() {
  //Use the LED as a monitor
  pinMode(ledPin, OUTPUT);              // sets the digital pin as output
  // initialize serial communications to Midi 31,250 bps
  Serial.begin(31250);		        //  Set MIDI baud rate:
  //Set up the Midi
  
  synth.midiReset();                    // Do a complete MIDI reset
  //synth.setReverb(channel,5,255,100);   // A Plate Reverb with maximum effect level
  synth.setChannelVolume(channel, 127); // max. channel volume
  synth.setMasterVolume(255);	        // max. master volume
  //synth.noteOn(channel, hihatP, vel);	// play a note
  
  //Serial.begin(9600);		        // just for debug only

}

void loop() {
  // read the analogs into values:
  sensor0 = analogRead(pad0);
  sensor1 = analogRead(pad1);
  sensor2 = analogRead(pad2);
  // determine alarm status
  if (sensor0 > hiHys)
  {
    digitalWrite(ledPin, HIGH);   // sets the LED on
  }
  else
  {
    digitalWrite(ledPin, LOW);    // sets the LED off
  }

  if (sensor0 > hiHys){
    synth.noteOn(channel, perc_0, vel);	// play a note
    synth.noteOff(channel, perc_0);    
    trapADC = A0;
    trapSensor = sensor0;
  }
  if (sensor1 > hiHys){
    synth.noteOn(channel, perc_1, vel);	// play a note
    synth.noteOff(channel, perc_1);    
    trapADC = A1;
    trapSensor = sensor1;
  }
  if (sensor2 > hiHys){
    synth.noteOn(channel, perc_2, vel);	// play a note
    synth.noteOff(channel, perc_2);    
    trapADC = A2;
    trapSensor = sensor2;
  }
  while (trapSensor > hiHys ){
    delay(10);
    trapSensor = analogRead(trapADC);

  }
  while (trapSensor < loHys){
    delay(10);
    trapSensor = analogRead(trapADC);

  }
  // wait 10 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
}

void update(){
  //delay(1000);
  Serial.print("Sensor A0 = " );
  Serial.print(sensor0,DEC);
  Serial.print(" Sensor A1 = " );
  Serial.print(sensor1,DEC);
  Serial.print(" Sensor A2 = " );
  Serial.print(sensor2,DEC);
  Serial.print(" Sensor lo = " );
  Serial.print(hiHys,DEC);
  Serial.print(" Sensor hi = " );
  Serial.println(loHys,DEC);
  Serial.println();
}
/*
Bass  	KeyNum	Sound
A_	33	Metronome Click
B_b	34	Metronome Bell
B_	35	Acoustic Bass Drum
C	36	Bass Drum 1
C#	37	Side Stick
D	38	Acoustic Snare
Eb	39	Hand Clap
E	40	Electric Snare
F	41	Low Floor Tom
F#	42	Closed Hi-Hat
G	43	High Floor Tom
G#	44	Pedal Hi-Hat
A	45	Low Tom
Bb	46	Open Hi-Hat
Bn	47	Low-Mid Tom
c	48	Hi-Mid Tom
c#	49	Crash Cymbal 1
d	50	High Tom
eb	51	Ride Cymbal 1
e	52	Chinese Cymbal
f	53	Ride Bell
f#	54	Tambourine
g	55	Splash Cymbal
g#	56	Cowbell
a	57	Crash Cymbal 2
bb	58	Vibraslap
bn	59	Ride Cymbal 2
C	60	Hi Bongo
C#	61	Low Bongo
D	62	Mute Hi Conga
D#	63	Open Hi Conga
E	64	Low Conga
F	65	High Timbale
F#	66	Low Timbale
G	67	High Agogo
G#	68	Low Agogo
A	69	Cabasa
Bb	70	Maracas
Bn	71	Short Whistle
c	72	Long Whistle
c#	73	Short Guiro
d	74	Long Guiro
d#	75	Claves
e	76	Hi Wood Block
f	77	Low Wood Block
f#	78	Mute Cuica
g	79	Open Cuica
g#	80	Mute Triangle
a	81	Open Triangle
	82	
	83	
	84	
*/

It uses three pressure sensitive sensors with a dropper resistor and reading the voltage with the analogue channels to set thresholds etc All "notes" are in the Percussion channel and it does not seem to matter when the off signal is sent, the beat plays the same.

Cheers, Rob

I hope this helps.