Per S Posted July 18, 2004 Report Share Posted July 18, 2004 When testing my MIDIO128 in my organ application I came across the following problem:The Program Change (C0) event didn’t produce the desired result. I used the following example in the MIDI128 ini file# (Program Change) Example: C0 01 00 FF 00 00 @OnOff (ON: send C0 01, OFF: send nothing!)# (Channel Aftertouch) Example: D0 40 00 FF 00 00 @OnOff (ON: send D0 40, OFF: send nothing!)The result was this:00048EBF 9 -- C0 00 -- 1 --- PC: Acc. Grand Piano000495CF 9 -- F0 Buffer: 9 Bytes System Exclusive SYSX: F0 43 10 5C 10 10 31 00 F7 00050607 9 -- D0 00 -- 1 --- Channel Aft 00050BCA 9 -- F0 Buffer: 9 Bytes System Exclusive SYSX: F0 43 10 5C 10 10 31 00 F7After some experimenting I found that the “on†event sends byte 2 instead of byte 1. The cause seems to come from the “midi_evnt.inc†;; sending two bytes MIDI_EVNT_Send_Cx ; Program Change MIDI_EVNT_Send_Dx ; Channel Pressure movff MIDI_EVNT0, WREG call MIOS_MIDI_TxBufferPut movff MIDI_EVNT_VALUE, WREG andlw 0x7f call MIOS_MIDI_TxBufferPut rgoto MIDI_EVNT_Send_End After I changed it to the following the “on†event works OK ;; sending two bytes MIDI_EVNT_Send_Cx ; Program Change MIDI_EVNT_Send_Dx ; Channel Pressure movff MIDI_EVNT0, WREG call MIOS_MIDI_TxBufferPut MOVFF MIDI_EVNT1, WREG ; <-----Changed andlw 0x7f call MIOS_MIDI_TxBufferPut rgoto MIDI_EVNT_Send_End Result:000A492B 9 -- C0 01 -- 1 --- PC: Brite Acc. Piano <--- OK000A4AA6 9 -- F0 Buffer: 9 Bytes System Exclusive <--- Shouldn’t be there!!SYSX: F0 43 10 5C 10 10 31 00 F7000A8675 9 -- D0 40 -- 1 --- Channel Aft <--- OK000A8785 9 -- F0 Buffer: 9 Bytes System Exclusive <--- Shouldn’t be there!! SYSX: F0 43 10 5C 10 10 31 00 F7If byte 0 is FF the MIDIO128 is supposed to send nothing. Instead a SYSEX string is presented. It seems to originate from the midi_meta.inc routine but I don’t know how to fix it so I’m hoping for some help there.Per S Quote Link to comment Share on other sites More sharing options...
jimhenry Posted July 18, 2004 Report Share Posted July 18, 2004 After some experimenting I found that the “on†event sends byte 2 instead of byte 1. Hard to say if that is a bug or a feature. I found it confusing at first too. But now there are people who have built tables that put the second byte of two byte messages in the third position. Do we change the way it works or just document very clearly how it works now? If byte 0 is FF the MIDIO128 is supposed to send nothing. Instead a SYSEX string is presented. It seems to originate from the midi_meta.inc routine but I don’t know how to fix it so I’m hoping for some help there. I think the comments in the sysex.ini files are out of date. It looks like a first byte of FF is used to trigger a Meta Event now. The @OnOnly Behavior is now used to set a switch that only sends a message when set On. In the following example pin 1 works as desired. Pin 2 send a Meta Message as indicated by the LCD display.[MIDI_OUT] ########################################## # Pin # On Evnt # Off Evnt # Behaviour # ########################################## 1 = C0 00 01 C0 00 02 @OnOnly 2 = C0 00 03 FF 00 04 @OnOff Can someone (TK) confirm that the comments need to be updated? Then Per or I can do that and post the updates for approval. Quote Link to comment Share on other sites More sharing options...
Per S Posted July 18, 2004 Author Report Share Posted July 18, 2004 Jim,I think I overlooked the following. I made the conclusion that the meta event is triggered by Fx xx but the FF would still send nothing. I think the comments in the sysex.ini files are out of date. It looks like a first byte of FF is used to trigger a Meta Event now. The @OnOnly Behavior is now used to set a switch that only sends a message when set On. In the following example pin 1 works as desired. Pin 2 send a Meta Message as indicated by the LCD display.I also took a look at my old 16F MIDIO. My version doesn’t support the â€@OnOnly†and the ini file looks like this (there is no support for meta event either) ############################## # Pin # On Evnt # Off Evnt # ############################## 9 = C0 00 00 FF 00 00 10 = C0 09 00 FF 00 00 11 = C0 0E 00 FF 00 00The result:0000D42A 9 -- C0 0E -- 1 --- PC: Tubular Bells 0000DCF8 9 -- C0 09 -- 1 --- PC: Glockenspiel 0000E4C4 9 -- C0 00 -- 1 --- PC: Acc. Grand PianoAs can be seen the second byte contains the information and the third byte is not sent.Yes, we need to have this confirmedPer S Quote Link to comment Share on other sites More sharing options...
jimhenry Posted July 26, 2004 Report Share Posted July 26, 2004 As it seems that the 16F version of MIDIO128 used the second byte as the data for Program Change and given that the only two of us who have commented find that more logical, I am going to do it that way in Switch Matrix.At such time as Thorsten is able to consider the matter, I am going to say the recommendation is to change the 18F version of MIDIO128 so that the second byte is used as the data for Program Change. Â In the meantime, the code is easily modified to do this for anyone starting a new project as Per explained above. Quote Link to comment Share on other sites More sharing options...
Per S Posted September 5, 2004 Author Report Share Posted September 5, 2004 Some time ago Thorsten wrote the following. This is a humble reminder to look into these questions.I will upload a new MIDIO128 release soon. If you have a special whish for this release (minor feature which could be useful for you), just let me know Best Regards, Thorsten.Before doing this, please consider this post. Here’s a short recap:Contents of the MIDIO128.INI # (Program Change) Example: C0 01 00 FF 00 00 @OnOff (ON: send C0 01, OFF: send nothing!) # (Channel Aftertouch) Example: D0 40 00 FF 00 00 @OnOff (ON: send D0 40, OFF: send nothing!) # (Pitch Bender) Example: E0 30 30 E0 60 60 @OnOff (ON: send E0 30 30, OFF: send E0 60 60) # - If byte0 is FF, the event will not be sentProblem number 1:C0 01 00 will send CO 00 since the third byte is sent, not the second. Same thing for D0. Jim Henry and I think this should be changed. The old 16F worked OK in this respect.Problem number 2:INI file description says: - If byte0 is FF, the event will not be sent. In fact a meta event will be sent. Is this correct?It can be resolved using @OnOnlyRegards, Per S Quote Link to comment Share on other sites More sharing options...
TK. Posted September 5, 2004 Report Share Posted September 5, 2004 Hi Per S,thank you for the reminder. The changes are already made, but I haven't found the time to release it (which takes some time since I always have to do some checks before)Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
TK. Posted September 6, 2004 Report Share Posted September 6, 2004 the new MIDIO128 release is now available in the MIOS download section:http://www.ucapps.de/mios_download.htmlChangeLog:http://www.ucapps.de/midio128_changelog.htmlBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.