Closed ViktorNova closed 6 years ago
To be completely honest, I've never used sysex messages.
Did you have a look at those:
http://jackclient-python.readthedocs.io/en/0.4.4/#jack.OwnMidiPort http://jackclient-python.readthedocs.io/en/0.4.4/#jack.OwnMidiPort.clear_buffer http://jackclient-python.readthedocs.io/en/0.4.4/#jack.OwnMidiPort.write_midi_event
See also #47, for some hints.
It would indeed be nice to add some more MIDI examples, I just didn't have any more ideas for simple and instructive examples (that work without having specific hardware).
If you have some concrete ideas for examples, please tell me and I can try to create some more.
It's almost like any other midi event:
outport.clear_buffer()
outport.write_midi_event(0, [0xF0, 0x7F, 0x7F, 0x06, 0x02, 0xF7])
where the first argument is the time (in samples) relative to the beginning of the current audio block, which should be fine to set to 0 if you plan on sending that message only.
@MaurizioB Thanks for the example.
Shouldn't clear_buffer()
come first?
@mgeier well, you are right :-) It has been a lot since I used it, I just did a test on the python console, which obviously behaves in a different way than an event loop.
Thanks so much guys! Yeah I couldn't quite make sense of the syntax from the documentation but this seems very straightforward for sysex. What would be the proper way to send a CC? Like say I wanted to send a value of 2 on CC#3? I still don't quite understand how to format it
@ViktorNova You just have to provide the raw bytes as defined by the MIDI standard. You can either do this as a list of int
values, or you can specify a bytes
object.
I guess you could find the description of the relevant bytes in the MIDI specification, but you can also make a quick web search, to find e.g. that: http://www.ccarh.org/courses/253/handout/controllers/.
I have no clue if that's correct, but I guess that's the byte sequence you want (where channel
is the channel number):
[0xB0 | channel, 3, 2]
Thank you for the explanation, I think I can figure it out from here!
I am trying to use jackclient-python to send sysex messages, and it was unclear from the documentation how to do this. Can you give me a simple example?
The sysex message I'm trying to send is
F0 7F 7F 06 02 F7
(MMC play)Thanks! I love this project!