To make a virtual MIDI, I am using Hairless MIDI to get commands from the Arduino and then loopMIDI to make the "virtual MIDI". Everything works fine. I open the Mixxx Programm and go to controllers. I can see my "virtual controller". I select it and I am trying to use the Learning Wizard function without success. It does not understand the key that I am pressing and at the end, it says " Didn't get any midi messages. Please try again". So my question is: Is my code ok when it comes to midi commands? Anyone who has tried a similar project to give me some advice? Thank you in advance!
-Note: I used VirtualDJ to map my button and it does detect it and I can see variables changing but I can not use it since this function needs full version on the software, aka buy it...
Thank you for your answer! To be honest, I am not sure what the software expects. I am kinda new at this. I think that I could find info here: Home · mixxxdj/mixxx Wiki · GitHub but I don't know what to look for. Also, I added a potentiometer and tried an online midi "software" (you.dj) and the potentiometer worked. Also, it recognized the button. Here's the new code:
It looks like your program is working fine. If other DJ software can recognise the MIDI messages you're sending then the problems you're having are just how to get your Mixxx software to do anything with those same messages. I doubt if you can get much help with that here. Most of us, like me, have probably never used or even heard of Mixxx.
I see you've asked the same question in the Mixxx forums with not much luck. Perhaps be a bit more specific...maybe say you are sending a MIDI NoteOn (0x90), 1, 1 for button down and NoteOn, 1, 0 for button release and ask what steps you need to take to get those recognised by Mixxx?
#include <MIDI.h>
#include <midi_Defs.h>
#include <midi_Message.h>
#include <midi_Namespace.h>
#include <midi_Settings.h>
int val = 0;
int lastVal = 0;
MIDI_CREATE_INSTANCE(HardwareSerial, Serial, midiOut);
void setup() {
pinMode(9, INPUT_PULLUP);
Serial.begin(115200);
}
void loop() {
val = analogRead(0) / 8;
if (val != lastVal)
{
midiOut.sendControlChange(55, val, 1);
}
lastVal = val;
if (digitalRead(9) == LOW) {
delay(10); //
if (digitalRead(9) == LOW) {
midiOut.sendControlChange(56, 127, 1); // send a MIDI CC -- 56 = note, 127 = velocity, 1 = channel
delay(250);
}
}
}
Note: Code is for 1 button connected at pin 9 and 1 potentiometer at pin A0. You can add more buttons/potentiometers later but remember to change channel (midiOut.sendControlChange((put a number here), 127, 1); )
Next, run loopMIDI HairlessMIDI and setup them (search about it). Then go to Mixxx, go to options and preferences. If everything is ok, you should see the "virtual MIDI" controller at the "controllers" section. Use Learning Wizard to set up your buttons and you are done! Feel free to ask for any questions!