Hi,
I threw together few components today in order to play with changing and bypassing effects, switching between different presets, etc.
I am using Uno -> hairless midi -> loopMIDI -> biasFx. Serial midi should work, because in Addictive drummer I can hear the inputs, and switch button action, but Bias doesn't recognize thoose inputs.
Code is slightly modified (remaped inputs and outputs) version of this tutorial MidiFoot. I looked up for some midi codes, but nothing seems to work for me, atleast not in bias. Is it Arduino sending commands problem, is it problem with PC software, or there is some third problem?
My code is as follows
// midi.controller
// written by The Cat Herder
// Sends midi program change and control change messages based on foot pedal pressed
// Constants
#define SWITCH1 7
#define SWITCH2 8
#define SWITCH3 12
#define SWITCH4 9
#define SWITCH5 6
#define LED1 3
#define LED2 4
#define LED3 5
#define LED4 6
#define LED5 2
#define BOUNCEDELAY 25
// Variables:
int switches[5] = { SWITCH1, SWITCH2, SWITCH3, SWITCH4, SWITCH5 };
int switchState[5] = { HIGH, HIGH, HIGH, HIGH, HIGH };
// Initial state of switch is high due to internal pullup
int leds[5] = { LED1, LED2, LED3, LED4, LED5 };
int currentSwitch = 0;
int currentProgram = 22; // current program - sent to the output
int bypassState = LOW; // state of bypass pedal
int pedalActiveFlash = 50; // Delay for flash when pedal is pressed
void setup() {
// Set MIDI baud rate:
Serial.begin(31250);
// Setup Switches and activation LEDs
for( currentSwitch = 0; currentSwitch < 5; currentSwitch++ ) {
pinMode( switches[currentSwitch], INPUT ); // Set pin for switch
digitalWrite( switches[currentSwitch], HIGH ); // Turn on internal pullup
pinMode( leds[currentSwitch], OUTPUT ); // Set pin for LED
flashPin( leds[currentSwitch], 100 ); // Flash LED
}
}
void loop() {
for( currentSwitch = 0; currentSwitch < 5; currentSwitch++ ) {
if((digitalRead(switches[currentSwitch]) != switchState[currentSwitch] )&&(switchState[currentSwitch] == HIGH)){
switch( currentSwitch ) {
case 0:
//Bypass
if( bypassState == LOW ) {
bypassState = HIGH;
midiSend( 0xB0, 0x5B, 0x00 ); // bypass off
digitalWrite( leds[currentSwitch], LOW );
}
else {
bypassState = LOW;
midiSend( 0xB0, 0x5B, 0x7F ); // bypass on
digitalWrite( leds[currentSwitch], HIGH );
}
break;
case 1:
//Prev Program
currentProgram = currentProgram--;
if( currentProgram < 1 )
currentProgram = 0; // Don't go lower than 0
midiProg( 0xC0, currentProgram );
flashPin( leds[currentSwitch], pedalActiveFlash );
break;
case 2:
// Next Program
currentProgram = currentProgram++;
if( currentProgram > 96 )
currentProgram = 97; // Don't go lower than 97
midiProg( 0xC0, currentProgram );
flashPin( leds[currentSwitch], pedalActiveFlash );
break;
case 3:
// Favourite 1
currentProgram = 22;
midiProg( 0xC0, currentProgram );
flashPin( leds[currentSwitch], pedalActiveFlash );
break;
case 4:
// Favourite 2
currentProgram = 27;
midiProg( 0xC0, currentProgram );
flashPin( leds[currentSwitch], pedalActiveFlash );
break;
}
delay( BOUNCEDELAY );
}
switchState[currentSwitch] = digitalRead( switches[currentSwitch] );
}
}
// Send a three byte midi message
void midiSend(char status, char data1, char data2) {
Serial.write(status);
Serial.write(data1);
Serial.write(data2);
}
// Send a two byte midi message
void midiProg(char status, int data ) {
Serial.write(status);
Serial.write(data);
}
void flashPin( int ledPin, int flashDelay ) {
digitalWrite( ledPin, HIGH );
delay( flashDelay );
digitalWrite( ledPin, LOW );
}
Is there any definitive guide to what this amp software on pc requires, list of commands, notes, etc. Or is it just send me anything and I will assign it to something.
Thank you very much for any help, I appreciate it a lot.
Have a nice day/evening
Denis