Midi-controller: unable to send Stop Command to Ableton

Hi
my project is a Midi-controller with a fake nano (one of those with CH340). Midi is transferred over Serial with a USB cable and the loop MIDI and Hairless Midi Serial bridge.
Beside triggering midi notes I want it to cover other options. Just like a Overall STOP of all notes that are played. (transferring midi notes works fine)

I tried different ways to achieve this. At the very beginning it worked one time, since then it gives the message "Serial In: System Message #12" in the hairless midi monitor.

  1. Serial.write(0xFC); -> I think that is the one which worked, but I'm not sure at this point. When It worked I saw in the hairless monitor sendNoteOff messages for (all?) midi notes
  2. MIDI.sendRealTime(midi::Stop);
  3. MIDI.sendStop();

My code is relatively complex but I wrote code to just do that one thing. Nothing changes.
For example like this:

#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();

void setup() {
  MIDI.begin(MIDI_CHANNEL_OMNI);
  Serial.begin(115200);
}

void loop() {
  Serial.write(0xFC);
  delay(1000);
}

I also ran that code on a different computer on which I just installed windows yesterday. Loop Midi, Hairless Midi, Arduino. That's all there is. Same Problem. Still the "Serial In: System Message #12" which apparently never ever someone wrote into the whole internet.

After hours of trying this I made CC messages like - MIDI.sendControlChange(21, value, 1); - and tried to map it to the stop button in ableton. Ableton does recognize the CC but I cant get it to actually trigger the stop button. When I do it with sendNoteOn it works. But that is not the way I want it.

Can somebody help and tell me why the nano does not send the proper command (anymore)?
I do not recall changing anything when it was working for that one time in the beginning. And I think my code can not be the problem, because the simple version does not work aswell.

Thanks!

you need

#include "MIDI.h"

where you want to send this text? to HairlessMIDI ?


MIDI-Clock und Song Position Pointer

  • MIDI-Clock (MC)

Die MIDI-Clock basiert auf Takt- und Notenebene. Die Einheit ist ein Tick, ein 96tel eines Schlages (bei vielen Liedern Viertelnote). Die Dichte, mit der die Clock-Informationen gesendet werden, ergibt sich daher aus der gewählten BPM-Einstellung des Liedes. Folgende Messages sind möglich:

  1. F2 Noten Position innerhalb eines Liedes 0–16383 (zwei Datenbytes)
  2. F3 Liedauswahl 0–127 (ein Datenbyte)
  3. F8 wird (während des Abspielens) 24-mal je Viertelnote gesendet
  4. FA Start
  5. FB Von der aktuellen Position aus fortsetzen
  6. FC Stopp <<------------------------------------------------------------------------------------ <<<<

Durch diese Signale starten alle Sequenzer gleichzeitig, folgen dem gegebenen Tempo und stoppen auch wieder gleichzeitig.

from german Wiki

Hey, thanks for your answer!
As I said, that was only the test code. In my real code of course I included the midi library.
I edited the code I provided in my post so now it is even simpler and it should work now, right? But it doesn't.

Why would I need the MIDI-Clock for this? (later in my project I want to include this because of BPM control but just for a Stop command I don't need it, right?)

Shall I provide my actual Code? It is 330 lines long, so I thought it would be more helpful to post a simpler version of the problem here.

EDIT: I tried different baud-rates and do it with MIDI.begin(1); - nothing changed.

i never hear about some MIDI command that acting as NoteOff for all active notes.

if i want stop playing my notes i will send NoteOff for all 127 existing notes, or i will notice which note is played and not stopped and then send NoteOff for that particular notes.

ok nice. But it exists. And I wanted to use it.

I wrote a workaround, I will share it but it's not really usefull without knowing what's going on...

void sendStop() {
  for (int i = 0; i < keyStateLength; i++) {
    if (keyState[i]) {
      keyState[i] = false;
      MIDI.sendNoteOff(i + lowestKey, 127, 1);
      delay(20);
      MIDI.sendControlChange(15, 127, 1);
      delay(20);
    }
  }
}

I use the Control Change Message 120 or 0x78 in hex with a zero as the message value. It is described as Channel Mode Message All Sound Off.

It works for me.

try


void setup() {
  Serial.begin(115200);
  for (int note = 0x1E; note < 0x5A; note +=5) {
    noteOn(0x90, note, 0x45);
    delay(100);
  }
  delay(500);
  allNotesOff();
}

void loop() {
}

void noteOn(byte cmd, byte pitch, byte velocity) {
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
}

void allNotesOff() {
  Serial.write(0xB0);
  Serial.write(0x7B); // or maybe 0x78
  Serial.write(0x00);
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.