How to switch between grids by MIDI?

117 views
Skip to first unread message

jur1...@gmail.com

unread,
Apr 3, 2018, 5:32:24 AM4/3/18
to Lightjams


Sorry for so many questions.....


next problem is how to link a list of midi note to a sequence grid


so i have a Listmenue in Cantabile (with linked MIDI-Notes,controller,Prog.-Numbers)  and everytime i chose an item it should call the associated Source/or X_Position in the Grid

so how to jump to specific positions......
list.PNG

jur1...@gmail.com

unread,
Apr 3, 2018, 5:58:45 AM4/3/18
to Lightjams
....Solved ...I understand what's going on 


made a grid of 127 steps and bound the Midi-controler-values to the X-Value

o865324

unread,
Apr 3, 2018, 3:55:55 PM4/3/18
to Lightjams
you don't need a grid size of 127

I have a slider21 with formula midi.controlraw(4,1)+1 which receives Rack State Selected Program from Cantabile on channel 4 as a CC.

My power source X formula is then xtopercent(slider(21)-1)

That then maps whatever size grid so that program number 10 in C3 maps to the 10th cell.

The reason for the +1 and -1 are so that the program number matches the slider % which matches the cell number.

o865324

unread,
Apr 3, 2018, 4:25:42 PM4/3/18
to Lightjams
Also, if you want the range of a power source to be a hard cutoff of 3 cells upwards for example then set the range shape to be "fall" and set the range formula to be ytopercent(3) and it will always be 3 cells upwards regardless of grid size.

Mathieu

unread,
Apr 3, 2018, 4:57:43 PM4/3/18
to ligh...@googlegroups.com
Well, you're having some serious fun :)

The range to ytopercent(3) is only working if the width and height of the grid are equal. Otherwise, use: min(ytopercent(3), xtopercent(3)). And if you don't want to repeat the "3", you can use: 

min(ytopercent(1), xtopercent(1))*3

Edit: ytopercent(3) isn't the way to do it. See https://groups.google.com/d/msg/lightjams/WGIu4qR5Yk4/_0s2nXSVBgAJ

jur1...@gmail.com

unread,
Apr 3, 2018, 6:33:06 PM4/3/18
to Lightjams
unfortunately I am not a programmers and have nothing to do with mathematics....
You pros don't really make life easier for me


:-)    Greetz

Jürgen

Mathieu

unread,
Apr 3, 2018, 6:46:33 PM4/3/18
to ligh...@googlegroups.com
Just having a bit of extra fun jamming with math formulas! Let me know if something isn't working to select a grid via MIDI.

jur1...@gmail.com

unread,
Apr 4, 2018, 3:44:16 AM4/4/18
to Lightjams
..thank's at the moment MIDI is the smallest problem.

to set my sequenzer grid to 128 and call the Presets scaled is for me the easyest way.

But an other understanding problem is here in this formula because it does not what I want:


scale(slider(2),0,540,0,200) .....this works perfekt in the range of 0-200
scale(slider(2),0,540,30,200) .....this show's me a range of 162-332 ???

what's going wrong with me?


Mathieu

unread,
Apr 4, 2018, 8:24:59 AM4/4/18
to ligh...@googlegroups.com
The slider(id) function returns a value between 0 and 100. The formula scale(slider(2),0,540,0,200) expects to receive a value between 0 and 540 and scale it between 0 and 200. Since the maximum value it receives from the slider is 100, it's surely not what you're expecting.

If you want to scale a slider value to be between 30 and 200, you can use:

scale(slider(2), 0, 100, 30, 200)

or use the short version that assumes a 0-100 range:

scale(slider(2), 30, 200)

And remember that all values for sources are percents when doing a calculation in a formula (power, range, delay, x, y, etc.). So if you're controlling the pan attribute which can go to 540 degrees, the source emits a power 0%-100% which is then mapped by the attribute to be 0-540 degrees.

jur1...@gmail.com

unread,
Apr 4, 2018, 9:44:27 AM4/4/18
to Lightjams
Thank you for helping me,  :-)

(so much to learn but not enough time)


Regards
Jürgen

o865324

unread,
Apr 5, 2018, 5:09:58 AM4/5/18
to Lightjams
Hi Mathieu, I resized my grid from 25x25 to 25x10 and ytopercent(3) is extending more than I expected. Is this correct?




On Tuesday, 3 April 2018 21:57:43 UTC+1, Mathieu wrote:
Well, you're having some serious fun :)

The range to ytopercent(3) is only working if the width and height of the grid are equal. Otherwise, use: min(ytopercent(3), xtopercent(3)). And if you don't want to repeat the "3", you can use: 

min(ytopercent(1), xtopercent(1))*3

Edit: ytopercent(3) is ok if your source doesn't emit horizontally
Capture.PNG

Mathieu

unread,
Apr 5, 2018, 7:58:42 AM4/5/18
to ligh...@googlegroups.com
Finally, unfortunately, it's not as easy as using ytopercent for the range. The range percent is related to the diagonal of the grid. So 3/10 of the diagonal is what you see.

To get an exact number of squares, this should work:

(3+0.5)/distance(0,0, grid.lastx+1, grid.lasty+1) * 100

where 3 is the number of squares.

This should work for all range shapes except "pow" which computes the range exponentially.

o865324

unread,
Apr 5, 2018, 9:54:23 AM4/5/18
to Lightjams
Ah, I understand. Thanks for the formula - perhaps a new function would be helpful to return the % relating to the number of cells specified in an x or y direction? Not sure if anyone else has asked similar questions? If people are combining functions on one grid, then it is very useful to be definitive about how far the power will extend. I suppose I could always put a -100% power source on the grid as a "wall".

Mathieu

unread,
Apr 5, 2018, 10:06:53 AM4/5/18
to ligh...@googlegroups.com
It's the first time I see this request. If I see more people using this formula, I'll add a new function. I usually use the source's direction to target specific parts of the grid. Maybe it's because the "fall" range shape is a relatively new feature.

Robin Larsson

unread,
Apr 9, 2018, 1:15:10 PM4/9/18
to Lightjams
I´ve been using the Fall function on Range a fair bit lately in my projects with the APC40 mk2 controller, and just the other day I tried to resize a grid which contained about 60 sources for triggering the LEDs on the controller, all with the Range set to 5% or so, and that did of course mess things up a lot :P The trusty Ctr+Z to the rescue and I simply placed the additional attributes that I wanted to put in differently and it all worked out, but it did strike me then that a simply way to set the range in an absolute number of cells would be quite handy :) 

And that reminds me, I still havent uploaded one of my project files with the APC40 mk2, I´ll get around to that soon, need to clean up the projects a bit more first, and possibly finish the last parts. Still havent figured out the best ways to do things, and to be honest I wish there were some other way to handle the whole Midi In/Out function, the recent updates to the Midi In side is wonderful though :)  But mapping the Midi Out to a APC40 mk2 is a lot of hassle, especially when trying to do deep re-patching to change out most of the fixtures but retain as much as possible. Perhaps there could be a way to separate the "Control surface" from the DMX patching? Sorry for the OT rant..

o865324

unread,
Apr 15, 2018, 1:00:14 PM4/15/18
to Lightjams
I'm using this a lot now both as a range limiter and also as a random sequencer on the X value.

like this
/*activate random cell*/latch(onbeat(trigger(grid.onactivated|slider(34),0.5,51,49,0.5)),randint(0,/*restrict movement to x squares*/(7/*x*/+0.5)/distance(0,0, grid.lastx+1, grid.lasty+1) * 100))

This restricts it to 7 squares from 0,0 to 6,0.

How do I restrict from something other than 0,0 - How would I get a restriction from 2,0 to 6,0?
Thanks.



On Thursday, 5 April 2018 12:58:42 UTC+1, Mathieu wrote:

Mathieu

unread,
Apr 15, 2018, 1:53:08 PM4/15/18
to ligh...@googlegroups.com
I think there's a bug in this formula. The randInt wasn't used properly as it takes two integers as parameters. For a range of between 2 and 6, you should be able to specify it in the randInt function like this:

if(onbeat(trigger(grid.onactivated|slider(34),0.5,51,49,0.5)),(randint(2,6)+0.5)/distance(0,0, grid.lastx+1, grid.lasty+1) * 100, last)

And I think you want to use the if function with the randInt to get a different result each time since the if function unlike the switch function evaluates only one of its parameter. So randInt is evaluated only when you need a new value, returning a different result each time.

Also, the trigger function has a threshold up/down which aren't used since the trigger value is either 0 or 100 in this case because of the | (or) operator. So I'm not sure if you were just testing things or if you're expecting something else. Right now, the trigger function only purpose seems to be to prevent changing the value sooner than 0.5 seconds.

o865324

unread,
Apr 15, 2018, 2:24:44 PM4/15/18
to Lightjams
hmm, ok, might need some help please.

requirement is :- have the source change position every time the grid is activated, or slider 34 changes value. If slider 34 changes and grid activation occur within 0.5 seconds of each other, then don't change position twice. Position changes to be along the x axis between columns 2 and 6.

thanks!

Mathieu

unread,
Apr 15, 2018, 2:33:27 PM4/15/18
to Lightjams
For the x position and when slider 34 changes:

if(onbeat(trigger(grid.onactivated|onchange(slider(34)),0,0,100,0.5)),xtopercent(randint(2,6)), last)

You can use the onChange function to fire when a value changes.
Reply all
Reply to author
Forward
0 new messages