Everything you wanted to know about Transform

Some Animated Examples

All the messages Transform works with can be defined by (up to) three pieces of data.

These are known as the Status Byte, the 1st Data Byte & the 2nd Data Byte.

(The “Status Byte” always tells us what type of MIDI message to expect. With Channel messages it also tells us the channel)

This section shows a few examples of the different ways Transform can do this.

Many of the examples below transform a Note On into a CC message in various ways.

All the examples show Mode set to Replace (i.e. “one in”, “one out”) just to make the animations less fussy.

(plus I’ve stuck them all in disclosures to avoid distraction from several animations at once!)

viewing GIFs

People testing these animations have often wanted to let them run several times to get the ideas.

The Discord technology on this forum lets users on phones, tablets and PCs enlarge jpgs and pngs by clicking…
…but not GIFs it seems.

On a PC you can “Open in a separate Tab” to get a better view of an animation, but with phones and tablets, the only option seems to be going landscape and pinching. Hmm…


1. Transferring data bytes

In this first example we have the simplest Transform where nearly all the incoming data is re-used…

Transform 1

…in the same order as the original message…

0 Repl Id=Id val=vel simp 4_title fade

…the only thing that changes is the “message type” part of the Status Byte…

…changing the meaning of identical data when the message type changes

So a

type 2nd Byte 3rd Byte Ch
Note On C3 (#=60) velocity 87 Ch10
becomes
CC #60 value = 87 Ch10

(and so on for all the notes and velocities in the Transform’s ranges )


2. Swapping data bytes

The second Transform is similar:
all the data from the original message is re-used…
…but here the “data bytes” are swapped around…

Transform 2

So the velocity of the Note On becomes the CC id of the new message…

…and the Note number itself gives the CC value:

1 Repl Id=vel val=id simp 2title fade

:thought_balloon: it might be unusual to have a Transform exactly like this with unrestricted ranges, but when velocity is scaled to just a few values it can be very useful…

A more common use of a swapped property is shown later.


3. Discarding data bytes

Messages like Note On or CC need 3 bytes of data…
…so when we use them to create to a single byte message like Stop, all that extra data is just ignored.

Transform 3

5 Repl NoteOn>Stop

This use of Transform means several properties can be ignored

:game_die: try it yourself:

  • choose any What type from the top of the list (Note On to say Pitch Bend )…

  • then choose any Into type from one of the ‘simple’ types (Start ~ Stop and Tune Request ~ Reset)

    See how all of the Set...To properties become Unused

(this also means that all the Argument properties are also irrelevant - there’s nothing that can be set to them!)

puzzled by “Arguments”? Read on!


4. Providing data bytes

Using Transform the other way around –to make a more ‘complex’ message from a ‘simple’ one – means we’ve got to get that extra information from somewhere.

This is where Transform’s arguments become essential; we need them to fill in the gaps!

Transform 4

Here we’re using the values stored in the Arguments 1 & 2 to set the CC id and value…
…and the Channel Argument to set the Channel:

6 Repl Stop by CC

:pushpin: It is useful to think of Arguments as places for “stored values”, but they don’t have to be fixed
…see the section on arguments for more


5. Employing Arguments

We’ve seen above that you can use Transform without using arguments…
and we’ve seen that certain Transforms absolutely need to use all three arguments.

The next example shows a common usage where we choose to use arguments to get a job done:

Transform 5

Here we create a CC which carries as it’s value the Note Number of an incoming Note On

When we want that CC to be used for a mapping, for example, we often want to fix the CC id and Channel:

2 Repl Id=arg val=id simp 5

Now every note creates a Ch11 CC107 with its value holding the Note Number

:thought_balloon: Use this and Rescale to quickly set different values with a few keys on a keyboard

Or tweak this Transform to “fix” value to Arg 2 and use with a single key to send CC to change an external device…

…or change a channel or port within Midihub itself

:pushpin: we could use Argument 2 instead of Argument 1 above
Switching between the Channel Argument and Argument 1/2 is different as we’ll see next

…see also the section on arguments for more




The last two examples use the new Channel Argument feature.

Some users may prefer to return to these later…


6. Channel Number → Id/Value

Transform can also take a Channel Number and convert it into an “id” or “value”…

Transform 6

…but, to do this, the 16 Channel Numbers are “spread out” across the 128 value range:

3 Repl Id=arg val=inCh 7

the rule for this is “-1 then x 8”
more details in a separate entry


7. Id/Value → Channel Number

lastly, Transform can use an “id” or “value” and convert that to a Channel Number

Transform 7

So here, every Note On creates a CC107…

4 Repl ch=id Id=Arg1 val=inCh 8

…but the channel of CC107 is set by the Note Number itself:

  • the lowest 8 Notes → Channel 1
  • the next 8 Notes → Channel 2
  • the Notes 16-23 → Channel 3
  • etc

the calculation for this conversion could be written "divide by 8ignore the remainderthen +1"
…or maybe:

“what’s the next number in the 8 x table?”

So

  • this Note number is 27…

  • so “the next number in the 8 x table” is 32

  • that’s 4 x 8 so this Note is assigned to CC107 on channel 4

more details on this conversion in a separate entry

2 Likes