Pairs (was It's a list!...) (was Function Newbie...)

Dar Scott dsc at swcp.com
Sat Dec 7 22:08:01 EST 2002


On Saturday, December 7, 2002, at 05:58 PM, erik hansen wrote:

> if all of this "binary" business relates to MIDI,
> please comment.

If you want to make a MIDI file or send MIDI out a serial port you need 
to have full control of each byte.  You have several tools at your 
disposal including the binaryEncode() and binaryDecode functions.  
However, you might be best off with numToChar() and maybe bit functions 
(bitAnd, bitOr, bitXor).  If you don't do binary or hex to decimal in 
your head, look at baseConvert().

Your primary tool will be numToChar().  Each character is really an 
8-bit byte.  You can represent every possible value that a byte can have 
with a number from 0 to 255.  Using numToChar() with such a number you 
can create the byte.  Then "all" you have to do is make the right bytes 
and use "&" to paste them all together to make what you want.

You can make any kind of file you want.

Dar Scott




More information about the Use-livecode mailing list