Serial Midi Problem

mirco posted Aug 18, 18:21:

Hi to all
i have a problem with serial midi, if i use a Nord Lead 2x the polifony are ok and velocity of keyboard is ok, if i use a Kurweil pc361 some note remainig on and the poly is not good, morever the passage from note C to D for examples is very slow, any idea ?


mirco posted Aug 19, 17:39:

Hi, any news about midi serial ?

mirco posted Aug 19, 19:13:

Rasp have won ..... i connect my keyboard with USB Port .....

Damin Park posted Apr 3, 22:34:

Hi Mirco, I'm having the same problems with notes lingering and missing notes when playing quickly with my LMK2+. Did you ever find a solution? I'm using midi-out to USB using M-Audio USB Midisport Uno, but the cable works perfectly to send MIDI messages to my computer.


jpg posted Apr 5, 00:08:

Same behavior than Damin, sometimes with some notes that came again even without pressing a key.
My keyboard (Microkorg XL) is connected by usb, the cable is ok with other devices.

Florian Ostertag posted Apr 25, 18:07:

Had the same problem. In my case it was a thing called "Midi Running Status" some keyboards "compress" Midi if more than one key is pressed at the same time. The Midi Keyboard only sends one Note On Command and then just keys and velocity. You can read about it here:

The decoding of this kind of compression doesn't seem to be implemented in Samplerbox.

jpg posted Apr 28, 23:45:

Very interesting! Thank you Florian.
Do somebody know how to solve this problem? :-)

Florian Ostertag posted May 3, 23:02:

I changed some of the code in It is the part "USE_SERIALPORT_MIDI" and the function MidiSerialCallback() that U changed. It works for testing purposes. So I know that the Running Status was the Problem. But I haven't fully checked everything that could happen on the midi side (like sysex commands, Midi Clock...). So far it only handles StatusBytes with 2 following DataBytes. You can develop it further if you want to. :-)

import serial

ser = serial.Serial('/dev/ttyAMA0', baudrate=38400)       # see hack in /boot/cmline.txt : 38400 is 31250 baud for MIDI!

def MidiSerialCallback():

    message = [0, 0, 0]
    i = 0

    while 1:
        if (input>>7) != 0:  #StatusByte received, store it 
            message[0] = input    
            i = 1             #following Databyte will be 1st Databyte
        elif (input>>7) == 0: #DataByte recieved
            if i == 1:
                message[1] = input
                i = 2         #next DataByte will be 2nd DataByte
            elif i == 2:
                message[2] = input
                i = 1          #next DataByte will be 1st DataByte again
                MidiCallback(message, None) 

MidiThread = threading.Thread(target = MidiSerialCallback)
MidiThread.daemon = True
Florian Ostertag posted May 4, 00:56:

Oh and it doesn't do Program Changes at this point.

jpg posted Jun 4, 20:52:

Florian, I try your code today but it does not seem to solve the problem, does it?
If I quickly play several notes, some of them are played again by themselves.
I don't know how to investigate on this problem. Any solution?

r.meurer posted Nov 17, 15:49:

Same Problem with the newest Firmware :-(

r.meurer posted Nov 17, 16:53:

sorry I was wrong, my Paspberry Pi 2B as well as the Raspberry Pi 3 only works with the old Image samplerbox_20150618.img
The newer Images:
does not do any Sound. NOTHING, only the old Image works for me with the well known MIDI Running Status BUG :-(
What may I di wrong?

Pavel posted Feb 8, 18:37:

  (not published)
  I want to post as guest