Program changes by itself

Casey P. posted Jan 22 '18, 20:43:

When my sequencer is playing my samplerbox will randomly change programs. Doesn't seem to be a problem when it isn't playing. Seems like it could be fixed by filtering out any program changes coming from my usb/midi-in port and only allowing program change from the buttons? If someone know's how to fix this let me know!

Casey P. posted Feb 8 '18, 17:29:

Im using a raspberry pi 3, first-gen axiom 49, Sabrent USB External Stereo Sound Adapter, Amosic MIDI Cable USB In-Out Interface Converter, and the image from this website if that helps.

HansEhv posted Feb 10 '18, 02:34:

Hi Casey,
Well you could just delete or comment out the "elif messagetype == 12: # Program change" branch.
But then you aren't able to change sample sets via Midi.
More interesting is why your sequencer sends program changes at all.

Casey P. posted Feb 12 '18, 17:32:

thanks for your response. I have commented that out and it works fine, was thinking i'd just build in the buttons and use that for program changes now. For now I only have two programs on it, so I just have use a different startup script for each one. The thing is i'm pretty sure the sequencer isn't actually sending out program changes, given that it doesn't cause my hardware drum machines, and synths to randomly change programs like that. It must be misinterpreting something. However if I can just wire in the buttons and not worry about it I think i'll just do that.

HansEhv posted Feb 13 '18, 22:44:

Hi Casey,
Misinterpreting is hardly possible on the midi syntax level as this very straightforward, but magic isn't possible either.
So let's think of a possibility:

  • The other devices have no problem with the synth's output
  • Samplebox is connected with Amosic midi cable
  • Do you use that cable with the others too?
    Reason I'm asking: your sequencer maybe using the the midi runing status technique. This is a way of compressing by leaving repeated data out. Normally this is done by the USB converters, so this is only an issue on the serial port (Alex's build has a fix for that).
    And if this is not used for your other devices, then we may have the crucial difference here.

I can give you some code to deal with this running status for all midi input. I hope no errors are introduced while copying it from the clone where I've used it.
I've uploaded OrgScript.txt and NewScript.txt to
Ignore all the other stuff in there, that belongs to the fork of
In your own, go to the start of the Midi callback, there you should see what's in OrgScript.
This can be replaced with NewScript. No guarantee, just something to try and if it helps we're happy :-)

By the way: you see there variable "messagechannel" getting a value.
That's the one to use for filtering channel 14 you asked for in the other topic, insert:
if messagechannel!=14: return
just before the midinote=note statement (and use the same indent!).

HansEhv posted Feb 13 '18, 23:02:

And regarding power: I have had trouble with a cheap usb cable, it drained the PI so it became unstable. On my PC I didn't have any issues.
It is a fact that the PI's power is not as reliable as other devices.
So this may be e second important difference: the cable may function ok on other devices but still cause trouble here.

Hope this all helps....

casey posted Feb 15 '18, 18:39:

Thanks very much! I'll try it out tonight. I'll let you know what happens.

casey posted Feb 23 '18, 04:38:

Works now! thanks again friendo!

casey posted Feb 24 '18, 20:14:

My problem was even simpler than I realized. I believe I isolated it to the Amosic USB midi cable. More about my setup: I have two raspberry pi 3s connected via a crossover ethernet cable. One raspberry pi runs Seq24 sequencer software, the other only runs samplerbox. I SSH into the sampler box pi to get text feedback. The amosic USB to Midi cable requires a powered midi source to function properly. I have a Behringer UMC204HD connected to the pi running Seq24. My midi controller was connected to the midi in port of the Behringer. The midi out port on the Behringer was connected to a 4 port midi thru box. Connected to the thru box is a Zoom drum machine, a Volca sample sequencer, a MicroKorg, and a Volca-bass. I had the sampler box pi connected to the thru port of the microkorg. After more frustration I realized I never tried connecting the sampler box Amosic USB Midi Cable directly to the midi-out port on the Behringer UMC204HD. It's now working flawlessly. Basically the flaw was in my midi routing and not in the program itself.

HansEhv posted Feb 24 '18, 22:31:

Hi Casey,
Good to hear it works.
So if I understand correctly, the Amosic did not get power from the through port of the Microkorg. For the through port I can understand this, but for the Amosic this is uncommon behaviour, as the USB-midi cables usually take their power from the USB (so: from the Pi).
I would't be surprised if one of the through circuits introduced the running status to speed up. So for my curiosity: did you also try the code I supplied - and what was the result?


  (not published)
  I want to post as guest