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!
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.
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.
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.
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 https://ator2109.home.xs4all.nl/samplerbox/
Ignore all the other stuff in there, that belongs to the fork of http://homspace.fritz.box/homspace/samplerbox/
In your own samplerbox.py, 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!).
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....
Thanks very much! I'll try it out tonight. I'll let you know what happens.