🔥 Lifetime deal! Get Control Surface Studio for Just £67 👉 Click Here To Get It
Time left... mailtimers.com
⚠️ Lifetime licenses are ending soon, get yours before they're gone ⚠️
Your shopping cart is empty.

Selected track listener (and track finder) with Reaction

Submitted by thx538 on Fri, 04/01/2022 - 07:36
thx538
Control Surface Studio User

Good morning,
This is my first trial with reaction so thank your for your patience.

I would like to implement a simple Reaction in order to get the selected track number and send a MIDI CC Message (on a given channel and CC #) back to the controller.

Please note that this reaction should be triggered when the selected track # changes but also during the script initialization.

Also I would like to memorize this number in a variable (eg. m1) for later use.

Thanks in advance for your support. Have a Nice day !

PS: I have another but similar request to scan tracks during a script intilialization, find a track with a given name (eg. "MPK"), put the track # in a variable (eg.m2) for later reuse within the script (and also send a MIDI message with this track #).
Thanks again for your help.

Topic Category: 

5 Responses

Comments

Wim
Control Surface Studio User
#1

Hello thx538,

Welcome to the community!
In short:
As Listeners you can use: "Song's selected track value has changed" (self.song().view.add_selected_track_listener) and "script is initialised"
Actions:
You can get the selected track info by using: 'self.get_selected_track_num()' and store that into a modifier.
Sending info back to the controller is possible with MIDI Controller --> send raw MIDI data to controller. That isn't that easy if you are new. I would suggest to make a midi clip with the wanted CC in it and trigger that clip.

I know it is a bit of a short answer, are you able to work with this info for the moment? Let us know!
Till soon!

thx538
Control Surface Studio User
#2

Yes Thanks,
I have the first part working.
However using a midi clip to send the CC is not an option because the CC is track related and it would disrupt the flow of playing tracks if a clip is playing in the selected track.
Best regards

Wim
Control Surface Studio User
#3

Hello thx538,

Yes, I know it is not always possible to use a clip, but for the moment, it is the easiest way to send a CC back to the controller.

The other option is to use "self._send_midi()", which means you'll need a midi string in decimals, you can find more info at https://remotify.io/community/question/how-display-ableton-track-colors-...

There have been more demands for having an easier way to send CCs (and Notes), so there probably will be an update where this will be implemented. We just can't say when yet.

I hope this info can help you out.
Best regards!

thx538
Control Surface Studio User
#4

Yes, It could be made easier with a form for PC, CC and Notes
Just for the record, I ended up with this which works :
message_to_send = []
message_to_send.append(184) # 184=HEX B8, CC on channel 9
message_to_send.append(self.get_modifier_value("m1"))
message_to_send.append(127)
self._send_midi(tuple(message_to_send))

Best regards

Wim
Control Surface Studio User
#5

Hello thx538,
Waw, great work, nice that you let us know.
Thanks for the share!
Now that you have made it that far, I suppose your second question in the original post is no longer valid ;-) Otherwise let us know.
Thanks again for posting your progress!