Activating presets a 2nd time, misses first midi event

lxr71

2009-08-30 17:42:24

I think I found a bug in MT 1.70 It could be me.
The preset below allow me to switch to midi channel 1 or 9 with 1 button (CF 00)
(The full setup allows me to switch to all midi channels with 8 buttons)

When I load this patch, it works perfectly...the first time.
p0: When I press a button, it just goes out in its original form (it's a toggle button, so 2 midi events)
p1: When I press the button that sends CF 00, preset 'channel01 is activated and all controller messages go out over channel 1 right away.
p2: When I press the CF 00 button again, preset 'channel09 is activated and all controller messages go out over channel 9 right away.
p3: When I press the CF 00 button again, only the 'AlwaysOnChan' preset is activated. Any buttons I push go out over their original midi channel (11 in this case).
p4: When I then press the button again and preset 'channel01' is activated a second time, the first other button I push goes out over its original midi channel and only after that do all controller messages go out over channel 1.
p5: When I then press the button again and preset 'channel09' is activated a second time, the first other button I push goes out over its original midi channel and only after that do all controller messages go out over channel 9.

This then continues to happen. The other button in p4 and p5 are routed straight through, without translation.
I have tried a number of things, but cannot seem to be able to work it out.
Seeing that it does work, the first time after loading, I think the presets are good.
There are no variables and no rules or whatever being used. So that's why I think it's a bug.
You can imagin how this can be very annoying if you think your sending something on channel 9, but are in fact sending out over channel 11.

I hope I'm wrong and there is an easy way around this.

---------------------------
Midi-Ox monitor output:
---------------------------
step TIMESTAMP.....IN.....PORT.....STATUS.....DATA1.....DATA2.....CHAN.....NOTE..... EVENT
p0..... 6721474..........4.....5..........186..........70..........127..........11..........---..........Control Change
p0..... 6721641..........4.....5..........186..........70..........0..........11..........---..........Control Change
p1..... 6726371..........4.....5..........176..........70..........127..........1..........---..........Control Change
p1..... 6726510..........4.....5..........176..........70..........0..........1..........---..........Control Change
p2..... 6729678..........4.....5..........184..........70..........127..........9..........---..........Control Change
p2..... 6729811..........4.....5..........184..........70..........0..........9..........---..........Control Change
p3..... 6733316..........4.....5..........186..........70..........127..........11..........---..........Control Change
p3..... 6733439..........4.....5..........186..........70..........0..........11..........---..........Control Change
!p4..... 6737289..........4.....5..........186..........70..........127..........11..........---..........Control Change
p4..... 6737461..........4.....5..........176..........70..........0..........1..........---..........Control Change
!p5..... 6741332..........4.....5..........186..........70..........127..........11..........---..........Control Change
p5..... 6741532..........4.....5..........184..........70..........0..........9..........---..........Control Change
---------------------------


--------------- Preset AlwaysOnChan

Translator 1: Channel01-09
Options: stop=false
Incoming: MIDI CF 00
Outgoing: activate only preset "Channel01"

--------------- Preset Channel01

Translator 1: New Translator
Options: stop=false
Incoming: MIDI pp qq rr
Outgoing: MIDI B0 qq rr

Translator 2: Channel01-09
Options: stop=false
Incoming: MIDI CF 00
Outgoing: activate only preset "Channel09"


--------------- Preset Channel09

Translator 1: New Translator
Options: stop=false
Incoming: MIDI pp qq rr
Outgoing: MIDI B8 qq rr

Translator 2: Channel01-09
Options: stop=false
Incoming: MIDI CF 00
Outgoing: activate only preset "AlwaysOnChan"

florian

2009-09-09 07:46:43

Hi,

sorry for the late reply. Thanks for reporting this issue. In fact, few people use "activate only preset", so it is possible that a bug there went unnoticed.

I'll check it out.

Thanks,
Florian

florian

2009-09-09 07:58:50

Hi I recreated the preset, and I cannot see any problem with it.

Do you use the MIDI Router to activate MIDI thru while only the first preset is active? Are the MIDI IN and Router OUT LED's blinking appropriately when the first preset is active? There should be no router out in presets 2 and 3.

Can you monitor the checkmarks in the preset list to verify that they're doing what they should?

Can you invoke MT's log window and verify that your actions do what you think they should?

Let me know...
Florian

lxr71

2009-09-09 10:26:51

Hi,

Yes, I use midi router. Usually from Kontrol49 midi-in to MidiYoke 1 out
Yesterday I read that there were some problems with Yoke, so instead, I'm trying it with Bome's Midi out, but that doesn't fix it.

The lights blink appropriately.
However, when the issue occurs, so when say preset 2 is activated the 2nd time, the 'router out' light blinks, but only on the first midi event after preset activation, which is exactly the problem.
After that, the router out does not blink.

The checkmarks work appropriately.
The log tells me everything is right, except for when the issue occurs. Then there's no log event, since apparently MT just routes it to the midi-out.

Too bad you cannot seem to reproduce it, because here it happens with great annoying consitency ;-)
Also, since not many people are using this activateonly option, my solution may not be the best one.
If you can suggest better ways to route midi signals over another channel without this preset switching, I could live with that.
However, since it does appear to be a bug, and since the rest of the tool is so great, it really should be fixed (if it is a bug).

I made a short ~2 minute video showing how things are setup and how the issue occurs. It shows the MT log and a Midi monitor.
(It's about 8 mb and not very professional, but it serves the purpose.)
http://alexapex.dyndns.org/_otherfiles/mt_bug.flv

Thanks for your great work.

-Alex

lxr71

2009-09-14 23:46:43

...ta-ta-ta talking to myself... ;-)

Yeah, so I stepped away from the ActivateOnly option.
I thought about it some more and came up with a much simpler solution to have incoming midi go out over a specific channel. I doesn't require any preset switching, just 2 translators: one to set a global variable which gets added to B0 which will raise the midi-out channelnr.
However, The issue kept happening.

I used a program change to choose a midi channel. for instance:
"Incoming: MIDI CF 06" causes any subsequent incoming "Bx pp qq" to become "B6 pp qq", effectively switching to channel 7.
I thought the problem might have to do with channel 16 (CF), so I tried using "C2 06" and "CE 06", but no change.
The first midi event after receiving any "Cx pp" got skipped.

Only when I started using normal CC to do the channelswitch, was the issue finally gone. So now "BF 7F 06" causes any subsequent incoming "Bx pp qq" to be output as "B6 pp qq".

So I think MT have a problem with program changes.

What I also noticed is that when you send a program change (PC) over another midichannel than is handled by a translator, this does fire a midi-in event in MT, but there is no midi-out, no router-out, no anything.
The PC events get swallowed. Maybe this is by design, or maybe it's my setup. I actually noticed this earlier while I was playing a synth and wanted to switch programs on it and it wouldn't accept the program changes, or rather, it didn't receive them, because they dissappeared in MT. When I changed the midi-input on the synth to come directly from my controller, rather than through the midiout of MT, was I able to change programs.
Only now, do I see the connection between that and this 'bugreport'.
What is also strange is that it doesn't seem as if this has been reported by anyone else (I didn't search too hard for it though).

There's a simple workaround for this (Translator 4 in the listing below)

All though I must say, I'm a little dissappointed with the lack of response, it did force me to think harder and come up with this much more elegant solution and finding the 'root' cause for this issue.
So, if anyone is still interested... ;-), here is the preset (highly simplified)

Hope this helps.

-Alex

--------------- Preset SwitchChannelsCC

Translator 1: ChooseChannelCC
Options: stop=false
Incoming: MIDI BF 7F pp
Rules:
j1=pp
Outgoing: (none)

Translator 2: ChooseChannelPC
Options: stop=false
Incoming: MIDI CF pp
Rules:
j1=pp
Outgoing: (none)

Translator 3: SendOverChosen
Options: stop=false
Incoming: MIDI pp qq rr
Rules:
if pp==191 then exit rules, skip Outgoing Action
pp=176+j1
Outgoing: MIDI pp qq rr

Translator 4: HandlePCEvents
Options: stop=false
Incoming: MIDI pp qq
Outgoing: MIDI pp qq

florian

2009-09-22 12:04:44

Hi lxr71,

sorry for the late response. It's not due to lack of interest.

It's sort of unlikely that MT has a problem with program change messages. Internally, MT does not treat different MIDI messages different, it's all just MIDI bytes to MT. But you never know!

Would you mind posting an annotated log? I.e. it shows the translations as they are correct, and then the point where it starts to be incorrect. It should be visible in the log window, right? It'll tell me much more than a textual description...

Thanks,
Florian

lxr71

2009-09-23 13:46:56

Hi,

In fact the MT Log alone won't show you what is happening, since the instances where the issue occurs, the events are not recognized by MT and are routed out. I hope the comments I supplied in bold will help.
During this test, I pressed the same button, a momentary CC which outputs BA 47 7F when pressed and BA 47 00 upon release. So you'll see that where it goes wrong, the entry in the log missed the 7f event and only shows the 00 event.
I also made a table that combines the output of MidiOx with the entries in the log: http://alexapex.dyndns.org/Public/_othe ... MT_Bug.htm
If your interested, I could show you the log of what happens when instead of CF 00, I use regular CC messages to switch presets. With regular CC's in otherwise the same MT project, this issue does not occur.

Okay, I hope this makes sense now. Let me know if you need more.

Regards,
Alex

IN 1.1: MIDI CF 00 (first time changing to "channel01")
OUT 1.1: activate only preset "Channel01"
Activated preset: Channel01
IN 2.1: MIDI BA 47 7F, pp=0xBA qq=0x47 rr=0x7F
OUT 2.1: MIDI B0 47 7F (output is correct)
IN 2.1: MIDI BA 47 00, pp=0xBA qq=0x47 rr=0x00
OUT 2.1: MIDI B0 47 00 (output is correct)
IN 1.1: MIDI CF 00 (first time changing to "channel09")
IN 2.2: MIDI CF 00
OUT 1.1: activate only preset "Channel01"
OUT 2.2: activate only preset "Channel09"
Deactivated preset: Channel01
Activated preset: Channel09
IN 3.1: MIDI BA 47 7F, pp=0xBA qq=0x47 rr=0x7F
OUT 3.1: MIDI B8 47 7F (output is correct)
IN 3.1: MIDI BA 47 00, pp=0xBA qq=0x47 rr=0x00
OUT 3.1: MIDI B8 47 00 (output is correct)
IN 1.1: MIDI CF 00 (turning all but the activeonly presets off)
IN 3.2: MIDI CF 00
OUT 1.1: activate only preset "Channel01"
Activated preset: Channel01
Deactivated preset: Channel09
OUT 3.2: activate only preset "AlwaysOnChan"
Deactivated preset: Channel01
(any events here are not registered, but routed out as they should)
IN 1.1: MIDI CF 00 (changing to preset "Channel01" the second time")
OUT 1.1: activate only preset "Channel01"
Activated preset: Channel01
(!!!Here the first event (BA 47 7F) is missed by MT and routed out!!!)
IN 2.1: MIDI BA 47 00, pp=0xBA qq=0x47 rr=0x00
OUT 2.1: MIDI B0 47 00 (only on the second event do we get translation)
IN 1.1: MIDI CF 00 (changing to preset "Channel09" the second time)
IN 2.2: MIDI CF 00
OUT 1.1: activate only preset "Channel01"
OUT 2.2: activate only preset "Channel09"
Deactivated preset: Channel01
Activated preset: Channel09
(!!!Here as well, the 1st event is missed and routed out!!!)
IN 3.1: MIDI BA 47 00, pp=0xBA qq=0x47 rr=0x00
OUT 3.1: MIDI B8 47 00[/b]