MIDI-OX User Forum (http://www.midiox.com/cgi-bin/yabb/YaBB.pl)
MIDI-OX >> Scripting Questions >> Capturing to .syx file
(Message started by: rgonzale on Oct 1st, 2005, 6:35am)

Title: Capturing to .syx file
Post by rgonzale on Oct 1st, 2005, 6:35am
Hi, is there a way with the COM interface to capture sysex data and save to a binary .syx file? GetSysExInput() apparently gets an ASCII string but I don't think this can be used to write a binary .syx file?

Thanks,
Ralph

Title: Re: Capturing to .syx file
Post by Jamie OConnell on Oct 2nd, 2005, 3:32pm
Using COM, you'd have to convert the ascii to binary while writing your own binary file.

Title: Re: Capturing to .syx file
Post by rgonzale on Oct 5th, 2005, 8:13am
Thanks for the answer Jamie. Forgive my denseness, but how would I convert the ascii to binary? IE is the ascii that midiox returns simply a per-byte coding or something? I'd like to do this from Perl...

Thanks,
Ralph

Title: Re: Capturing to .syx file
Post by rgonzale on Oct 9th, 2005, 4:15pm
To answer my own sort of naive question, here is perl code to receive sysex and write to a binary .syx file. This uses Perl/Tk gui:


Code:
eval { require Win32::OLE; import Win32::OLE };
my $haveWin32 = !$@ && ($^O eq "MSWin32");
my $mox=($haveWin32 ? Win32::OLE->new('MIDIOX.MOXScript.1') : undef);
...
   my @syx;
   my $start=time();
   while ( !$cancelSoon && scalar(@syx)<400 && time() < $start+30)
   {
       $win->update();
       if ($mox->GetMidiInput())
           { push @syx, (split /\s+/, $mox->GetSysExInput()) }
   }
...
   binmode OUT; # to prevent CR->CR/LF
   foreach my $h (@syx)
       { print OUT pack("H2", $h) }




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