Midi to serial - Hairless MIDI (unexpected data byte)

I'm trying to convert my midi key numbers to midi format, as hairless midi cannot understand just the numbers alone. Almost all the code in my snippet is taken from else where, but its the only code I can get to read my midi and output as a genuin number.

Can I please get some help just to convert Serial.println(midiNote); to a format hairless midi will understand. Spent hours debugging this already

//MIDI Note receive with clock

#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1); // RX, TX

// constants

#define PIN_LED 13

// MIDI commands
#define MIDI_NOTE_ON 0x90
#define MIDI_NOTE_OFF 0x80
#define MIDI_START 0xFA
#define MIDI_STOP 0xFC
#define MIDI_CONTINUE 0xFB
#define MIDI_CLOCK 0xF8

//Clock
int play_flag = 0;

// filter MIDI events on channel and note number
const int filterChannel = 0; // MIDI channel 1
// states
#define STATE_NONE 0
#define STATE_NOTE_ON 1
#define STATE_NOTE 2
int state;

// keep action (LED) going for actionDuration milliseconds
bool actionOn;
unsigned long actionTime;
unsigned long actionDuration = 100;

// received MIDI data
byte midiByte;
byte midiChannel;
byte midiCommand;
byte midiNote;
byte midiVelocity;

//Counter
int counter_a = 0;
int counter_b = 0;
long int bpmcount_a;
int bpm;
int bpmprevious = 0;

void setup() {

    mySerial.begin(31250);
    Serial.begin(112500);
    delay(100);

    pinMode(PIN_LED, OUTPUT);
    
    state = STATE_NONE;
    actionOn = false;    

    pinMode(13,OUTPUT);
    pinMode(5,OUTPUT);

    resetcounters();
    
}

void loop () {

    // Is there any MIDI waiting to be read?

    if (mySerial.available() > 0) {

        // read MIDI byte

        midiByte = mySerial.read();
        
        switch (state) {
        case STATE_NONE:
        
            // remove channel info
            midiChannel = midiByte & B00001111;
            midiCommand = midiByte & B11110000;

            if (midiChannel == filterChannel)
              {
               if (midiCommand == MIDI_NOTE_ON){state = STATE_NOTE_ON;}
              }

             if (midiByte == MIDI_START){play_flag = 1; resetcounters(); Serial.println("Start");}
             if (midiByte == MIDI_CONTINUE){play_flag = 1; resetcounters();}
             if (midiByte == MIDI_STOP){play_flag = 0; resetcounters(); Serial.println("Stop");}

             if((midiByte == MIDI_CLOCK) && (play_flag == 1)) {Sync();}
      
            break;

        case STATE_NOTE_ON:
            midiNote = midiByte;
            state = STATE_NOTE;
            break;
            
        case STATE_NOTE:
            midiVelocity = midiByte;
            state = STATE_NONE;
            
            if ( midiVelocity > 0)
            {
               // digitalWrite(PIN_LED, HIGH);
                actionTime = millis();
                actionOn = true;
                Serial.println(midiNote);
                
            }
            
            break;
            
        } // switch

    } // mySerial.available()


    if (actionOn)
    {
        if ((millis() - actionTime) > actionDuration)
        {
            actionOn = false;
            digitalWrite(PIN_LED, LOW);
        }
    }    

} // loop

void Sync() {
// do something for every MIDI Clock pulse when the sequencer is running

if(counter_a == 6){counter_a = 0;}
if(counter_b == 24){ counter_b = 0; calcbpm(bpmcount_a,micros());}

if(counter_a == 0){digitalWrite(13,HIGH);}
if(counter_b == 0){digitalWrite(5,HIGH); bpmcount_a = micros();}
if(counter_a == 2){digitalWrite(13,LOW);}
if(counter_b == 11){digitalWrite(5,LOW);}

counter_a ++;
counter_b ++;
}

void calcbpm(long int bpmcount, long int microelapsed){

bpm = 60000 / ((microelapsed - bpmcount) /1000);

if (bpm != bpmprevious){Serial.print("BPM"); Serial.print(bpm); Serial.println("");}
bpmprevious = bpm;
}

//Functions to avoid repeted code.

void resetcounters(){
  counter_a = 0;
  counter_b = 0;
  digitalWrite(13,LOW);
  digitalWrite(5,LOW);
}

Hairless expects MIDI data, Seral.println(midiNote); sends the number as ASCII text, which is completely different. If you want to do your own parsing and sending of MIDI messages, read the specs (MIDI 1.0 Detailed Specifications), otherwise use a library that does it for you. You can use the arduino_midi_library if you only need Serial MIDI, or the Control Surface library if you want something that works for all transports (Serial MIDI, USB MIDI, MIDI over Bluetooth LE, etc.).

Some remarks about the code you posted: Why are you using SoftwareSerial on the pins of the hardware Serial port, and then using both in your code? That'll never work, and you probably shouldn't be using SoftwareSerial at all.
Don't use preprocessor macros (#define) for constants, use constants (e.g const uint8_t ledPin = 13;). Use an enum for your different states.
Speaking about states, your MIDI parser/state machine might work in simple scenarios, it's not standard compliant, you have check the msb of an incoming byte to determine whether it's a status or data byte, for example, you can't use a local state. If your intention is to learn how the MIDI protocol works, read the spec, it's quite interesting. If you just want a working project without reinventing the wheel, it's probably best to use a library with a well-tested parser.
The baud rate of 31250 seems to imply that you want to use serial 5-pin DIN MIDI. This baud rate is not supported by most computers, so you cannot use it with Hairless. If you want to use Hairless, use a standard baud rate such as 115200 (or even higher if you want lower latency).

casperround64:
Almost all the code in my snippet is taken from else where, but its the only code I can get to read my midi and output as a genuin number.

As a final piece of advice: don't use code you don't understand in your own sketches, and definitely don't start mixing snippets from multiple sources unless you understand exactly what each piece of code does.

Start from a very simple example that does a single thing right (e.g. sending a MIDI Note message every second). Don't start adding more code to it before you can explain every single line, every single character of that example to yourself. You can change things like the note number, the channel, the velocity, etc. to get comfortable with the code and to convince yourself that you fully understand how it works.

Not allowing yourself to use any code that you don't understand will prove to be a very useful rule in the long run.

Pieter