-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to distinguish between CC #2
Comments
Can you show your code? Where do you get this '10' from? And what are the exact sequences you get in python-Jackclient? The ControlChangeEvent object should contain all the data sent by the keyboard with the ControlChange MIDI message. In some cases one parameter change can cause two events being sent (for 14 bit values). If it is more convenient for you to work with midi bytes you can pass prefer_bytes=True to event_input() method to receive MidiBytesEvent instead of ControlChangeEvent. |
I just started learnig Python and PyQt and I'd like to make some midi stuff with both backends, so I'm trying to get same results from both. client = SequencerClient("my client") #parse input event Code for jackClient it's almost this: https://jackclient-python.readthedocs.io/en/0.5.3/examples.html#midi-chord-generator for offset, indata in inport.incoming_midi_events(): status = 176, pitch = 10 and vel is the value like event.value I just need a way to indentify the controller with both backends Thanks. |
First (off-topic, sorry), you are testing event type in a very convoluted (and inefficient) way. Doing (str) on an object and then parsing the result is probably never the right way. The Python way to do it would be:
or:
Second: Your 'status' as read from Jack includes channel number. Control change status byte is 0xBn where 'n' is channel number. So byte sequence '176 10 22' is a control change message in channel 0 (or 1 – MIDI channels can be numbered either way), for controller 10 with value 22. And '177 10 66' is control change message in channel 1 (or 2, depending how you count), controller 10 and value 66. The channel number is available in the channel attribute of the ControlChangeEvent:
|
Thanks for the explanation (also for hints about code) but I still don't understand how to get compatible results between alsa and jack. Sorry if this has become more of a request for help than an issue.. |
Please, no str() + int(), that is a huge 'code smell'. If you want convert this way (from ControlChangeEvent to the status code like you get from jack), then try this:
Or, the same without hex:
|
Hello, on my midi keyboard all ancoders are mapped to CC 10. With python-Jackclient I can distinguish between them because it returns all byte, so encoders are 176-10, 177-10, 178-10... but wuth alsa-midi, ControlChangeEvent() returns only 10.
Am I doing something wrong ? How to distinguish between them ?
Thanks,
Daniele.
The text was updated successfully, but these errors were encountered: