When a device attached to the 5pin MIDI IN2 is power cycled, midi messages start buffering

I have a WIDI Thru6 BT that is hooked into the MIDI IN 2 port.

When the WIDI device is up as Electra One is powered on it works fine.

If the WIDI device is power cycled while the Electra One is up then the Electra One starts consistently failing to pull all the messages off the wire leaving a few left without being drained.

If more data does come in it eventually does drain the messages that were stuck in the buffer but this quite often leaves NoteOffs not arriving as they are usually near the end of the stream when playing a note.

The same setup into the Blokas Midihub shows everything recovering and processing fine after power cycling the WIDI device so it’s probably an Electra One specific issue.

Also to confirm it isn’t an issue with what I coded up I switched to the default preset and reenabled the built in port forwarding and it was seeing the same sort of buffering issue in this state.

I also tried the new midi.flush() to see if it was output buffering but it appears to be at the input level.

This seems to be repeatable in my setup if there’s more stuff to gather for debugging.

One thing I thought of overnight, in the MIDI docs for midi.flush() it states:

“A function to flush (force the sending of) all data from MIDI queues. Normally, outbound MIDI data is sent at regular time intervals.”

Now this could just be a reference to POSIX level buffering but it could also mean the queues are implemented as:

full buffer || (timer && not full buffer)

For whether to send data.

Now if the same logic is applied on the input queues as well for receiving data this bug would be consistent with the timer not running.

So in response to the power cycle there would be some sort of connection broken event. Something likely percolates EOF or connection reset back to the Electra One.

Now if the timer gets disabled in response to the break and stays disabled, the incoming will eventually be processed when full but the remainder will be left.

1 Like

I am still having troubles with replicating this one.

I do not have Thru6 BT around. I tried to use Blokas Midihub to replicate it. This is what I have done:

  1. sequencer on computer sends a stream of MIDI data (clock + notes) to the midihub over the USB MIDI.
  2. midihub forwards all messages to DIN port which is connected to E1 MIDI IN 2.
  3. E1 runs Blofeld preset and forwards MIDI IN 2 to Blofeld connected to the USB Host.

I can switch the midihub on and off without having issues processing MIDI IN 2 data and E1 in general. I feel I missed something and I am not be doing the same thing as you. Pls advise. Thx!

I used the Midihub to take the output from the WIDIThru6 BT and tried the same experiment with it as the destination vs the Electra One.

I haven’t tried power cycling the midhib using it as a source into the Electra One. I can probably try some other experiments when I get a chance.

I was using the DIN → USB Device forwarding with the Electra One when I was doing this.

yup, I know :slight_smile: I tried to emulate stream of data using the midihub as if it was your thru6.