Pattern Scene Matrix Variables

bobbyquine

2012-11-20 13:32:14

Hi Jared,

OK another quick question....

If I'm going to set up a 'matrix memory' in MT storing the pattern states (1-8) of 8 tracks for 8 scenes, is there any way to NOT use up 64 globals, some clever formulae or technique....
Actually just realized you could double up in the variables if your working with only 8's, so 32 globals spoken for... Still I'd like to know if I'm missing something...

Thanks again for all your help, even quick confirmations of things like this really help to not waste time and start working on the right things.

Cheers

B

DvlsAdvct

2012-11-20 13:59:30

Well, you can use 8 variables, one for each track in each scene.

Instead of g1=1, g2=2, g3=1, etc. you can use g1=1, g1=2, g1=3, g1=4, etc. and then just use 8 to store each track's current value.

Make sense?

bobbyquine

2012-11-20 14:07:53

Ok, I'm not sure If I'm getting it...

Will this mean that the matrix is still storing all pattern combinations for all scenes, not just the current state? Sorry If I wasn't clear.

I need to do this in order to keep Maschine LED states consistent with Geist, which doesn't provide feedback.

If it does still do that I need to get my head around it!

Thanks again

B

metastatik

2012-11-20 18:54:24

It’s possible to have a variable store more than one value or state (on/off), but this is somewhat complex as it involves bit manipulation. In short, the value a variable stores can be represented as a series of bits (like 0 0 0 0 1 0 0 0), which we can manipulate individually. Here’s an example of storing the first state in a multiple state variable.

Code: Select all

ga=ga^1
This toggles the first state/bit in ga’s value.

From other translators you can check if the first state/bit has been set like so:

Code: Select all

rr=ga&1
if rr!=1 then exit rules, skip Outgoing Action
The rules for the successive states look very similar. The values used in each state will be double that of the previous state. So the third state would look like this:

Code: Select all

ga=ga^4
And this:

Code: Select all

rr=ga&4
if rr!=4 then exit rules, skip Outgoing Action
As a side note, it’s always a good idea to initialize your global variables at the start of a project, but it’s absolutely essential here. To do that, create a translator with input type Special and select the project load option. In the rules, just list each variable you use and give it a default value (like ga=0).

bobbyquine

2012-11-20 19:15:26

Wow...ok,

Im only a couple of weeks into MT so this is very challenging stuff, but I'm going to try and digest that.

Again, thanks for your time, I needed to know if that was possible as I'm still working out what I want to do and just how deep MT is...

Thanks

B

metastatik

2012-11-20 19:38:53

I’ve used MT for years and still find bit manipulation tricky, so don’t feel bad. Luckily though, MT has lots of variables on offer, so the need to resort to storing multiple values/states in a single variable isn’t all that common. It’s really just needed for storage intensive stuff like sequencers.