Hello everyone,
I'm having some trouble getting my project to work. It's a simple enough design, five buttons hooked up to an Arduino Uno with a MIDI shield to transmit the signals to my ASIO soundcard. The good news is it's built and I've got it working, almost. The buttons send a signal to MIDI out as expected, and I can send MIDI data from the input port to the thru port. Here's a link to the shield I bought: MIDI Shield Breakout Board F Arduino R3 AVI PIC Digital Interface Adapter M | eBay
The problem is I don't know how to code it to get my buttons to be added to that signal, and I'm not quite sure what I'm doing wrong! To put it another way, right now MIDI thru = MIDI in. I want it to be MIDI thru = MIDI in + MIDI out.
I've attached the code I used to get myself started. Hopefully you can see what I've done wrong here.
I've tried using MIDI.setThruFilterMode(Full) as part of the Arduino MIDI library but it appears that the code has changed now, as this message brings up an error. I also read somewhere that MIDI thru was on by default but I just can't seem to make it work.
Any help is appreciated. Thanks in advance.
MIDI arduino.txt (8.38 KB)
I'm sure exactly what you're aiming to do but the way you describe it is not how MIDI works. It's the wrong way round.
MIDI Thru should be a copy of the signal coming in on MIDI In (possibly with some elements excluded). But if you want to take a MIDI signal from MIDI In and modify it then the modified signal should go to MIDI OUT.
Steve
Hi Steve, thanks for the response.
This is a footpedal for my band, I want to use this to queue up audio tracks, stop and play etc. But my interface only has one MIDI in and I also need to plug in a keyboard. Therefore I want to daisy chain the two together so that the signal goes from the keyboard through the pedal to my DAW, and the pedal can also add notes or cc messages.
Although perhaps you're right and I've completely misunderstood the point of MIDI thru. Is it not possible to merge MIDI in and MIDI out and send them to the thru port?
Alex
Perhaps I'm missing something but if you only have one MIDI In on the interface where were you intending to plug MIDI Out and MIDI Thru to if you used them both?
Why can't you just plug the keyboard into the Arduino MIDI In and then send the keyboard commands plus any extras that your pedal is creating to MIDI Out (which then plugs into the interface)? If they need to be separated at the DAW just send the keyboard commands and extra commands on different MIDI channels.
Steve
What you described in the second paragraph is exactly what I intended, only I wanted to use the thru and leave the MIDI out empty, but sending it to the out is probably the solution.
I'll look up some more code and have another look tomorrow. Thanks for the help! I'll let you know how I get on.
So I found this, and this seems to be exactly what I want to do, but unfortunately it's not working for me and I don't really understand why...
http://sandsoftwaresound.net/tag/midi-thru/
//
// Send MIDI IN to MIDI OUT (THRU)
//
// Author: P.J. Drongowski
// Date: 30 May 2016
// Version: 1.0
//
// Copyright (c) 2016 Paul J. Drongowski
// Permission granted to use, copy and distribute
// Uncomment the following line to use the Arduino
// MIDI library instead of serial read() and Write().
// #define USE_MIDI_LIBRARY 1
#ifdef USE_MIDI_LIBRARY
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE() ;
void setup() {
MIDI.begin(MIDI_CHANNEL_OMNI) ;
}
void loop() {
if (MIDI.read())
{
MIDI.send(MIDI.getType(),
MIDI.getData1(),
MIDI.getData2(),
MIDI.getChannel());
}
}
#else
int midiByte = 0 ;
void setup() {
// Initialize the serial port for MIDI
Serial.begin(32500) ;
}
void loop() {
if (Serial.available() > 0) {
midiByte = Serial.read() ;
Serial.write(midiByte) ;
}
}
#endif
"Not working for me" in any particular way?
Anyway that's just a MIDI repeater, whatever comes in is sent straight back out. That's not what you said you wanted. Also it's based on using standard MIDI circuitry not on your MIDI breakout board which for all I know may use different connections.
Steve
Sorry, I should be clearer. I took this code and uploaded it to my Arduino but nothing happens, although I'm sending signals to the MIDI in it doesn't appear on the MIDI out.
Here's a link to more or less what I'm trying to do:
http://www.witchmastercreations.com/arduino-simple-midi-footswitch/
Just a simple footswitch which takes any MIDI that is sent to it and then resends it to my DAW, but can also send its own control messages on a separate channel.
Alex
Okay, real egg on face moment here. My MIDI shield has an on/off switch and I had no idea what it was for, so I just left it off, as I had some problems getting it to communicate with my computer otherwise.
Now I understand, it's because Arduino and MIDI use the same serial, so it needs to be off when programming! I read this online somewhere (can't find the link now) and I had a real light bulb moment.
Now I finally have my footpedal doing what I want, copy all MIDI messages from in to out and add other control messages on channel 16.
If anyone wants to see my code, it's attached to this post.
(notice that I took the "else" part of P.J. Drongowski's code; the other part above it in his original code caused the note velocity to vary wildly, although I was playing a sequence that had the same velocity throughout.)
MIDI_Controller_v1-2.ino (8.44 KB)