Skip to content
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

Note on/off behaviour in chord mode when pressing two pads that contain the same note simultaneously #63

Open
jaard opened this issue Sep 1, 2021 · 6 comments
Assignees

Comments

@jaard
Copy link

jaard commented Sep 1, 2021

First of all, thanks for this great project! I'm very interested in contributing if I can.
But let's first outline the issue I observed:

Intended behaviour (I assume):
If the user presses two chords that contain the same note and then one of them is released, the notes that are part of both chords remain on (i.e. no note off message is sent).

Current behaviour:
When one of the two chords is released, a note off command is sent for every note in that chord. The second chord that is still held down is missing notes.

Proposed solution:
I was building an Arduino-based Midi-controller some time ago and ran into the same issue. The way I solved it was by introducing a matrix of integers for every possible Midi note, initialised with zeros. When a button on the controller was pressed, that note would get a "note on"-message and the corresponding value in the matrix would get incremented by 1. When a button on the controller was released, the value in the matrix would get decremented by 1. But a "note off" message would only get sent if the value in the matrix was zero at this point. If its not, that means another chord is still holding that note.

Hope I made it clear! Would be grateful for suggestions where to start with this, what files or structure would need to be changed etc. Then I'm happy to contribute.

@mat1jaczyyy
Copy link
Owner

Hey, thanks for the issue report!

The intended behavior is whatever the Pro MK3 does in their official Chord mode, I'll need to double check what Novation does there.

@mat1jaczyyy mat1jaczyyy self-assigned this Sep 1, 2021
@jaard
Copy link
Author

jaard commented Sep 1, 2021

Do you own a MK3 as well? I was eyeing it since it came out but just realised that you already implemented the MK3 chord mode, so that was great news.

@mat1jaczyyy
Copy link
Owner

I don't actually, but I know some people who do.

@mat1jaczyyy
Copy link
Owner

Your assumed intended behavior matches the Pro MK3, I'll see when I can catch some time to do fix this up, I don't think it will be too soon...

If you want to contribute and fix it yourself, chord_press in this block returns the pitches (of the chord) affected by the button that was just pressed. It currently has no memory of what other physical keys are pressed down, so it clears up pitches that might be held by other keys. You will probably need to use additional memory to achieve this, that is fine so long as it's efficient (a u64 treated as a bitfield for keeping state of the 6x8 grid can be compared quickly and doesn't use much memory).

u8 n = chord_press(x, y, v, out_p);

@mat1jaczyyy
Copy link
Owner

mat1jaczyyy commented Sep 2, 2021

@jaard

@jaard
Copy link
Author

jaard commented Jun 11, 2022

Sorry @mat1jaczyyy, I completely missed your comment in September last year.
I just started using my Launchpad again, that's why I came to check for any news.

Thank you for pointing me to the fix, I'll have a look and try to contribute. I may have to ask you some more specific questions later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants