User Forum    :: Powered by YaBB
  « MIDI-OX User Forum - Sysex Processing in VBScript »
Welcome, Guest. Please Login or Register.
May 9th, 2025, 8:55am


Home Home Help Help Search Search Members Members Login Login Register Register


   MIDI-OX User Forum
   MIDI-OX
   Scripting Questions
(Moderator: Jamie OConnell)
   Sysex Processing in VBScript
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Sysex Processing in VBScript  (Read 2416 times)
abhunkin
Member
**



MIDI-OX Rules!

   
WWW Email

Posts: 35
Sysex Processing in VBScript
« on: Feb 9th, 2007, 7:13pm »
Quote Quote Modify Modify

I need to process some 6-byte sysex messages in a vbscript. These messages are scattered in with normal MIDI messages.
 
A typical sysex message: 240 127 0 6 5 247.
 
I'm interested only in the fifth byte (here, 5), and will do conditional things based on its value. Is this appropriate code?
 
dim msg, val(5), switch
 
Sub Sink_SysExInput(strSysEx)
  msg = strSysEx
  val = Split(msg, ",", 6, vbTestCompare)
  switch = Int(val(5))
  If switch = 5 Then
    etc.
 
I'd like to stay with the sink method if possible, as my normal MIDI subroutine is also of that type.
 
All suggestions most appreciated.
IP Logged

Art Hunkins
abhunkin@uncg.edu
http://www.arthunkins.com
JerryJorgenrud
New Member
*



MIDI-OX Rules!

   


Posts: 0
Re: Sysex Processing in VBScript
« Reply #1 on: Feb 10th, 2007, 12:00pm »
Quote Quote Modify Modify

dim A
Sub Sink_SysExInput( strSysEx )
   A = Split(strSysex," ", 6, vbTextCompare)
   select case A(4)
 case "05"
    msgbox "The fifth element is 5"
 case "04"
    msgbox "The fifth element is 4"
 case "03"
    msgbox "The fifth element is 3"
 case Else
    msgbox "Unused number: " & A(4)
   end select
End Sub
IP Logged
abhunkin
Member
**



MIDI-OX Rules!

   
WWW Email

Posts: 35
Re: Sysex Processing in VBScript
« Reply #2 on: Feb 11th, 2007, 7:55pm »
Quote Quote Modify Modify

Thanks very much for your revised example, Jerry. It is most helpful.
 
I've three quick followups:
 
1) In your example above with Case "05", is the value in hex? In other words, would:
  Case "20"
be looking for 32dec?
 
2) I notice in MOXScriptPoll.vbs, the separator character in Split is given as "," whereas you list " ". Are both OK, or does the context in our example require " "?
 
3) I want to sort out 6-byte sysex messages from any others, and only deal with them. Would the best way be:
  If Len(strSysEx) = 17 Then
or would it be better to test:
  If A(5) = 247 Then
or are both methods OK?
 
I really appreciate the expert advice. Unfortunately, I'm flying blind here, unable to experiment/test myself the code.
IP Logged

Art Hunkins
abhunkin@uncg.edu
http://www.arthunkins.com
JerryJorgenrud
New Member
*



MIDI-OX Rules!

   


Posts: 0
Re: Sysex Processing in VBScript
« Reply #3 on: Feb 12th, 2007, 6:45am »
Quote Quote Modify Modify

1) In your example above with Case "05", is the value in hex?
 
Yes, that's the way you're going to get it.
 
 2) I notice in MOXScriptPoll.vbs, the separator character in Split is given as "," whereas you list " ". Are both OK, or does the context in our example require " "?  
 
Sysex bytes are separated by spaces. It's the regular MIDI messages that are separated by commas. So you have to use spaces.
 
3) "are both methods OK?"
 
 I suppose I would probably go with the length, which would protect you from one that was too short as well. If you use the other method, the value to test for won't be in decimal it will be "F7".
IP Logged
abhunkin
Member
**



MIDI-OX Rules!

   
WWW Email

Posts: 35
Re: Sysex Processing in VBScript
« Reply #4 on: Feb 12th, 2007, 3:32pm »
Quote Quote Modify Modify

Gotcha.
 
Thanks so much for the guidance, Jerry. (I'm glad to see I was pretty much on track.)
 
It shouldn't be too long before I can announce here a package of scripts that convert a range of MIDI controllers to a Mackie Control Universal emulation.
 
The particular issue under discussion here is some sysex generated by the Tascam TM-D1000 (transport and rec arm messages) that needs to be converted to appropriate MCU output.
IP Logged

Art Hunkins
abhunkin@uncg.edu
http://www.arthunkins.com
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »


MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.