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

Toggle MIDI Recording via CC message #66

Open
szszoke opened this issue Nov 9, 2021 · 26 comments
Open

Toggle MIDI Recording via CC message #66

szszoke opened this issue Nov 9, 2021 · 26 comments

Comments

@szszoke
Copy link

szszoke commented Nov 9, 2021

It's me again. I ended up getting a Launchpad Pro MK3 and I started setting things up.

I have the loop control and play/pause working so far.

I'm trying to set up a toggle for the MIDI Recording button.

Is that supported?

@ahlstromcj
Copy link
Owner

ahlstromcj commented Nov 9, 2021 via email

@szszoke
Copy link
Author

szszoke commented Nov 9, 2021

It's not song recording that I'm trying to do.

I'm trying to control the MIDI Record Toggle (page 63 in the manual) button. As far as I know this should be supported but I couldn't get it to work.

Another question is that it seems this button is activated individually for each pattern. It's not obvious how a specific pattern can be targeted when a CC message is used.

@szszoke
Copy link
Author

szszoke commented Nov 9, 2021

There are some similarities between the devices but I ended up starting from scratch just so that I familiarize myself with the config files.

@ahlstromcj
Copy link
Owner

ahlstromcj commented Nov 9, 2021 via email

@szszoke
Copy link
Author

szszoke commented Nov 9, 2021

No worries! Enjoy your wine :)

@szszoke
Copy link
Author

szszoke commented Nov 10, 2021

It seems that Seq66 sees the MIDI CC message but nothing seems to be happening.

Here is the output with the --verbose switch:

Record 'Toggle'; d0 = 1; d1 = 17; inv = 0

Here is how I assigned the CC message to Record:

17 "KP_*"        [ 0 0xb0   1   0   0 ] [ 0 0x00   0   0   0 ] [ 0 0x00   0   0   0 ] # Record

@ahlstromcj
Copy link
Owner

I know the LaunchPad Mini's top row of (circular) buttons emit 0xb0 XX 127 on press and 0xb0 XX 0 on release, where XX is the button number ranging from 104 to 111. So make sure you are using the right XX value.

Also, depending on what value your Launchpad emit, change the "0 0" to "1 127" or "127 127". I would suspect your more-sophisticated Launchpad might emit a value that depends on how fast/ you press the key. An example:

10 "." [ 0 0xb0 106 127 127 ] [ 0 0xb0 107 1 127 ] [ 0 0xb0 105 1 127 ] # Playback
11 "P" [ 0 0xb0 109 127 127 ] [ 0 0x00 0 0 0 ] [ 0 0x00 0 0 0 ] # Song Record

If it still doesn't work, let me know. There's always a chance I broke something. (You should have seen how I broke JACK transport completely once! Embarassing!)

Also take a look at the Mini spreadsheet in the "doc" directory. That show's diagrams for the Mini (only).

@szszoke
Copy link
Author

szszoke commented Nov 10, 2021

My device just emits two CC messages. One on press with the value of 127 and another on release with the value of 0.

I'm still don't understand how Seq66 knows which loop to arm.

I tried to set the Record option to a keyboard shortcut so that no MIDI controller is in the equation. The key press is detected as "toggle Record" but nothing actually happens.

@ahlstromcj
Copy link
Owner

ahlstromcj commented Nov 10, 2021 via email

@szszoke
Copy link
Author

szszoke commented Nov 10, 2021

But what does that mean? Is toggling the Record option in [automation-control] supposed to toggle the MIDI Record option for all loops?

@ahlstromcj
Copy link
Owner

The Record option for keystrokes doesn't do anything. Although your idea about it sounds interesting and I will try that at some point to see if it is workable. The problem with keystrokes is that the have only two states, press and release, where as MIDI controls have d0 and the d1 range, so they are capable of lookup.

d1 is currently used only to test if the MIDI event is usable/valid. I will probably make it usable to choose items in the next release, 0.97.3. The new and current release is 0.97.2, just pushed it to master today.

Sorry about the issues, but thanks for giving me some more things to try!

@szszoke
Copy link
Author

szszoke commented Nov 11, 2021

No worries. I in the meantime tried Ableton and Bitwig which both support my Launchpad I'm thinking that taking inspiration from how they handle arming a pattern for recording could worth a try.

The only thing is that it requires stateful MIDI controller handling.

By that I mean that the functions of the main grid buttons depend on what "state" was activated earlier.

If the program is in "arm for recording" mode then the grid buttons arm or disarm patterns for recording and overdub.

If the program is in "loop control" mode then the grid buttons play/pause patterns.

@ahlstromcj
Copy link
Owner

ahlstromcj commented Nov 11, 2021 via email

@ahlstromcj
Copy link
Owner

I added a couple of modes. First, the control mode for clicking on the grid buttons or sending keystroke/MIDI commands. There is a button in the main window to cycle between: Loop, Overdub (same as Merge in the pattern editor), Overwrite, Expand, and One Shot. In the recording modes, a red circle appears in the slot the is recording.

Another button controls the recording mode: Normal, Quantize, and Tighten. The latter two add "Q" or "T" to the red circle indicator, respectively.

There is currently a trick there. Quantize and Tighten can turn on recording, but cannot turn it off. Also there is still a remaining bug where the record indicator remains lit.

Also, the 'ctrl' file commands "Record" and "Quan Record" have been modified to perform the functions of those new buttons.

Let me know of any thoughts or issues you have for this new code. Thanks! (See the "optimizing" branch).

@szszoke
Copy link
Author

szszoke commented Nov 17, 2021

I tried running the application but I might be something wrong here. Nothing really happens when I press the buttons.

@ahlstromcj
Copy link
Owner

ahlstromcj commented Nov 17, 2021 via email

@szszoke
Copy link
Author

szszoke commented Nov 20, 2021

Your last comment helped a lot!

It works as you said and it looks really good now.

One final thing would be the possibility to assign a CC message for idividual modes.

In my case I would be mostly using the Loop and the Overdub mode.

The ideal flow would be that on startup the app is on loop mode and that is also the "neutral" mode.

Then if I send a CC (let's aay CC1) message, that will trigger the overdub mode. If I send the same the CC1 message then that will trigger the neutral mode again.

If I'm already in a non-neutral mode and send a CC (let's say CC2) to switch to a different mode, like expand, then the active mode should switch to that.

If I send CC2 again then the mode should be switched back to neutral.

In a more algorithmic way, I want CC messages to be able to trigger specific modes. I also want that whenever the CC message of the currently active mode is received then the mode switches back to neutral.

If you want flexibility, you can make it so that the neutral mode is configurable.

The only thing that is still unclear is how to implement LED feedback.

My launchpad has no concept of these modes, so whenever there is a transition of modes in Seq66, a set of MIDI messages should be sent out.

The easiest would be to add "on" and "off" messages to each mode, and then when when there is a mode transition, the following would happen:

  1. Old mode off message sent
  2. New mode on message sent

@ahlstromcj
Copy link
Owner

ahlstromcj commented Nov 20, 2021 via email

@szszoke
Copy link
Author

szszoke commented Nov 20, 2021

Actually I have been thinking about the mode transition logic and it would be nice to have support for temporary transition.

Here is my original suggested flow

1. Controller button pressed
2. MIDI CC message with `on value` sent
3. Seq66 reacts to the message and changes modes
4. Controller button released
5. MIDI CC message with `off value` sent
6. Seq66 does nothing
7. ...
8. Same controller button pressed
9. MIDI CC message with `on value` sent
10. Seq66 reacts to the message and changes to neutral mode
11. Controller button released
12. MIDI CC message with `off value` sent
13. Seq66 does nothing

A temporary transition would be engaged by holding a button down on the MIDI controller and then releasing it later.

While the button is held down, Seq66 switches to the configured mode, the grid buttons can then be used to engage with the mode. When the button is released, Seq66 switches back to the previous mode and not to the neutral one.

This could be implemented via a timer that starts when a CC from a button press is released. If the button is released under a threshold amount of time then the mode is toggled permamently. If no button released CC message is received within a threshold amount of time then the transition becomes temporary and when the button released CC message is finally received then Seq66 switches back to the previous mode.

@szszoke
Copy link
Author

szszoke commented Nov 20, 2021

Not sure it is worth adding extra commands (using up 7 more automation slots!),
but I will think about adding a "flip mode" or "toggle mode" that will simply
toggle from Loop to the selected mode of the recording mode, etc.....

I would say it does within the context of a MIDI controller. The idea is that with a MIDI controller you could assign different functions to a single button.

It would also fit nicely with a Launchpad where apart from the grid buttons, there are "mode" buttons on the side.

@szszoke
Copy link
Author

szszoke commented Nov 20, 2021

I think modes generally should be triggerable individually. Especially if there will be more to come in the future, it will get messy when you only have a single button for them.

I'm thinking that a next candidate would be for copy and clear mode.

In copy mode, the first grid button press would highlight a pattern and the second one would paste it to the appropriate slot.

On clear mode, the patterns could be emptied or removed via the grid buttons on the controller.

@ahlstromcj
Copy link
Owner

ahlstromcj commented Nov 20, 2021 via email

@szszoke
Copy link
Author

szszoke commented Nov 20, 2021

I think if you try to keep feature parity between MIDI controllers and standard PC keyboards, you will eventually run out of keys and keyboards will hold back MIDI controllers.

Also consider that not everyone would use exactly all of the features.

People can set up custom keymaps with features they need.

I'm not asking you to build something that only works with a MIDI controller.

I'm asking you to consider providing options.

As for the Launchpad, in programmer mode which I'm planning on using all the buttons have fixed and separate MIDI messages that cannot be changed.

@szszoke
Copy link
Author

szszoke commented Nov 20, 2021

Ideally there would be an automation control for cycling through the modes and one for each mode separately.

Then people could chose if they want to set up a control that cycles through the options or set up a control that instantly activates a specific mode.

@ahlstromcj
Copy link
Owner

ahlstromcj commented Nov 28, 2021 via email

@szszoke
Copy link
Author

szszoke commented Nov 28, 2021

Indeed the controllers don't support changing the value of the CC messages because the idea is that the DAW that integrates them will build a state machine.

This state machine will then just listen for the CC messages and depending on the current state, the same CC message might do one thing or another. This is how you can increase the functionality of the buttons.

I will soon take my winter vacation and I will likely work on a state machine implementation that essentially implements the buttons the same way they work in Ableton.

At the very beginning it will be something that is somewhat generic but mostly designed to work with the Launchpad Pro MK3.

I will eventually want to add support for this controller in Ardour.

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