text to midisysex

26 viewsCSS QuestionsmidiSysEx text
0

Hi, i am building a script that will act with touchOSC via midi.

And i would like to send the name of a parameter from ableton when it was changed.

So i add a listener:

self.song().tracks[0].devices[0].parameters[1].add_name_listener

and my action would be:

self._send_midi(X)

where X should be some kind of transformation from:

self.song().tracks[0].devices[0].parameters[1].name

that should be a text, like “LFO” into:

into midiSysEX.

Can you suggest a solution for this reaction?

MartinJ Answered question June 17, 2024
1

Hi,

I suggest you have to transform the string of the name in a tuple of integers.

Let “pname” be the name-string of the parameter

n_char = len(pname)

text = []

for i in range(n_char): text.append(ord(pname[i]))

text = tuple(text)

may be the text integers tuple must be closed by a Zero, depends on the Sysex command definition of your controller.

Dieter

HDV Answered question June 16, 2024
1

Hi, I use this to send parameter labels to Open Stage Control:

SYSEX_START = (240, 126, 3,)
val = self.song().view.selected_track.view.selected_device.parameters[loop_number].value
valStr = tuple([ord(c) for c in self.song().view.selected_track.view.selected_device.parameters[loop_number].str_for_value(val)],)
SYSEX_END = (247,)

sysexMsg = SYSEX_START + tuple([loop_number],) + valStr + SYSEX_END

self._send_midi(sysexMsg)

I use different numbers in SYSEX_START to distinguish between track name, device name, parameter name. In this example “3” for parameter name. In Open Stage Control I then filter by this number where to put the text (parameter name label).

Hellem Posted new comment June 24, 2024

thank you!!
can you please comment – what is
[loop_number]
?
as i suppose there should be smth like
parameters[1].name
to get parameter name label, right?

according to
https://docs.cycling74.com/max5/refpages/m4l-ref/m4l_live_object_model.html#DeviceParameter

parameters[1].value
will give us Linear-to-GUI value between min and max.

And why do you put val in valStr?
shouldn’t it be like:
valStr = tuple([ord(c) for c in self.song().tracks[0].devices[0].parameters[1].name])

and why you sysex message looks like 240, 126, 3 instaed of F0 52 00 4F 28 20 37 ?

thank you, waiting for your answers)))

Hi, you’re right I confused it with parameter values, sorry. For parameter names I use:

self._send_midi(tuple([240, 126, 2, loop_number] + [ord(c) for c in self.song().view.selected_track.view.selected_device.parameters[loop_number].name] + [247]))

Hexadecimal just didn’t work in my case, that’s why I use decimal for midi sysex. Maybe I’ve done something wrong.
And I use a loop in CSS to get all the parameter names of the selected device at once.

And take it with a grain of salt: I have zero programming experience – just trial and error… 😉 Regards, mj

you are my hero!)

how can tracks[1].color be sent as hex? i can figure out…

0

I’ve attached my CSS template. It’s work in progress and sure there are a lot of things that can be done way better. Maybe it gives you some ideas. Regards, mj

MartinJ Answered question June 17, 2024
Attached Files: