Extract just the midi channel

Image_Engine

2008-07-06 06:25:29

Hi All
Does anyone know how to extract just the midi channel from the status byte?
Regs
M

Breeze

2008-07-11 03:58:33

I'm interested in this too. It would be cool to make the channel nibble a variable.

metastatik

2008-07-11 19:11:25

See next post...

metastatik

2008-07-11 20:57:58

On 2nd thought, this is probably an easier way to do it.

Code: Select all

Translator 1: ExtractChannel
Options: stop=false
Incoming: MIDI pp qq rr 
Rules: 
  ss=pp/16
  tt=ss*16
  uu=tt-1
  ga=pp-uu
Outgoing: (none)
Here’s an example message:

95 45 7F – which is a note on/channel 6/note A4/velocity 127
95 in hex = 149 in decimal

If you divide 149 by 16, you’ll get 9.3125. MT disregards everything after the decimal, so…
ss =9

144=9*16

143=144-1

6=149-143

That will work for any message in the same format “nn nn nn”. You’d need another translator for dealing with messages in a different format…like PCs and AT, which look like “nn nn”. The rules would be the same, just the incoming message would be different.

Breeze

2008-07-13 19:18:45

I'm still waiting for my registered copy of MT Pro (Bome must be on vacation or something :) ) but I find this a bit of a hack. It actually won't work for channel 16, where your ss result will be 10 and your channel will be returned as 1. And yes you could create a special case for channel 16...

The proper way to handle it would be to create a partial variable for the channel part of the Hex Status byte, the first character being a wild card. That would allow simple or conditional re-channelization. Anyway, I have to wait and see what's possible with Pro.

Also, is it not possible to spell equations like yours in MT Pro like this:

ga=pp-(((pp/16)*16)-1)

?

metastatik

2008-07-13 19:50:07

No, you cannot write rules like that. And it would be great if MT let you use partial variables…but it doesn’t. If it did, the OP wouldn’t be asking this question.

The translator I posted works fine with channel 16…

9F 45 7F – note on/channel 16/note A4/velocity 127
9F in hex = 159 in decimal

9= 159/16...it actually equals 9.9375, but MT disregards everything after the decimal.

144=9*16

143=144-1

16=159-143

If you have a better way of doing it (that’s actually relevant to MT)…I’m all ears.

Breeze

2008-07-14 00:06:05

Oops! Right on both counts, metastatik! Ch "17" wouldn't have worked...