A better SoftwareSerial for ATtiny45/85?

Hello,
I’m using an ATtiny45 with GitHub - SpenceKonde/ATTinyCore: Arduino core for ATtiny 1634, 828, x313, x4, x41, x5, x61, x7 and x8

I’m doing a MIDI 1 in/1 out event processor.

I’ve tried many Serial solutions:

but always, at the end, some MIDI messages were badly read and written when too many MIDI messages were arriving at the same time. The electronic part (optocoupler etc.) is double checked and ok.

Question: is there a better SoftwareSerial on ATtiny45 that could read all the bytes, wait 1 ms, write the bytes?

Attempt1 (writing just after reading, maybe not a good idea!) of echo RX to TX

#include "SoftwareSerial.h"
SoftwareSerial Serial2(3,4);

void setup() {
  Serial2.begin(31250);
  Serial2.write(255);
}

void loop() {
  while (Serial2.available())          
    Serial2.write(Serial2.read());
}

Attempt2 (reading all available bytes, wait, and write) of echo RX to TX

#include "SoftwareSerial.h"
SoftwareSerial Serial2(3,4);

void setup() {
  Serial2.begin(31250);
  Serial2.write(255);
}

byte buf1[64] = {0};
byte num = 0;

void loop()
{
  while (Serial2.available()) {
    buf1[num] = Serial2.read();
    num += 1;
  }
  delay(1);
  for (int i = 0; i < num; i++)
    Serial2.write(buf1[i]);
  num = 0;
}

Thanks in advance