BU16 "global" Button with DAW state at page change

Hello! On my BU16 I want to have a “global” Button across all 4 pages. (It has to be on each page, cause I need very quick access) I can apply the same CC# for the Button on each page and map it on, let’s say, a Track Mute switch in Ableton.

Now here is the problem:

  1. Page 1 → I press Button → Track is unmuted → Button LED turns on
  2. loading Page 2 → Button LED is off by initial load, hence doesn’t show the correct Track Mute state
  3. Page 2 → I press Button twice → Button LED on and then off again → Track is muted
  4. re-loading Page 1 → Button LED is remembered as on from before, hence doesn’t show the correct Track Mute state

I need to receive the DAW state each time I change pages, I suppose. How do I do that? Or is there another easier way to solve this?

Thanks a lot!

There’s two ways to do this:

  1. You create an actual global variable that lives in a library outside of Page memory and you call that and modify that on each Page when you access it.
  2. You don’t use actual Pages, but just create 4 Pages within 1 Page and leave that button out of these faux-Pages.

Creating either of these is possible, but would need some work provided you’re comfortable scripting in LUA.

But if you need some help, let me know!

1 Like

Hey Narayb, thanks for the quick reply! I’m happy to read there are ways to do this.

I know programming a little bit, but so far did the Grid coding with AI help only.

Regarding 1: Could you give a simple code example maybe, if not too much effort?

Regarding 2: I don’t understand this. What’s a faux page and how would I access it?

Cheers!

1 Like

Oh, cool!

AI can help by explaining and writing code in these cases so that’s a good start!

For solution 1:
This might be the simpler solution. In Editor there’s an option in the sidebar called the File Manager. This allows you to create files that exist outside of Pages. For example creating the file globals.lua and then making that file a library like this:

local globals = {
MY_GLOBAL = 0
}
return globals

After this, you will be able to require this library on any Page (any you will have to do that on all Pages, best practice would be to do it on System/Setup) like this:

G = require("globals")

And after this you can write to or read from this library like so:

print(G.MY_GLOBAL)
G.MY_GLOBAL = G.MY_GLOBAL + 1
print(G.MY_GLOBAL)

For solution 2:
Check out the Profile called 64CTRL (Workflow folder)/256CTRL (Community folder) in the Profile Cloud, as both of these use 4/16 “faux” Pages you can switch between. This is a more complex solution, but AI could figure it out from the json files I think.

But in any case, if you run into any trouble, let me know and I’ll try to help.

1 Like

Trying to get to work solution 1. But failing. I create globals.lua which contains:
local globals = {
SWITCH1 = 64,
SWITCH2 = 64,
SWITCH3 = 64
}
return globals

In the System/Setup of page 1 and 2 I type:
G = require(“globals”)

On Switch 1 I add a Code-Action:

print(“Switch 1”)

print(G.SWITCH1)

G.SWITCH1 = G.SWITCH1 + 1

print(G.SWITCH1)

And this happens:

I press Switch 1 on Page 1:

[-2,0] Switch 1
[-2,0] 65.000000
[-2,0] 66.000000

I change to page 2 by pressing a completely different button which runs a page_load(1). I didn’t press Switch 1 yet, but already receive another:

[-2,0] Switch 1
[-2,0] 64.000000
[-2,0] 65.000000

Then I do press Switch 1, which causes this:

[-2,0] Switch 1
[-2,0] 65.000000
[-2,0] 66.000000

What’s wrong?