binaryencode question
jbv at souslelogo.com
jbv at souslelogo.com
Mon Dec 7 07:34:08 EST 2020
Never mind folks,
I found another (and easier solution) : I'm using bytetonum() to
convert the binary data from the file, and then, after processing,
numtobyte() to write the data as binary in the file.
Le 2020-12-07 04:53, jbv via use-livecode a écrit :
> Hi list,
>
> I have a script that opens a binary file (actually a .wav) file,
> converts binary data to hex, do some processing on parts of the
> data, and then saves the result as a new .wav file.
> I managed to convert the binary data to hex and do the processing,
> but now I'm stuck trying to convert hex back to binary using the
> binaryencode function, to get a playable .wav file.
>
> Here's the code that works so far :
> put "/sounds/my.wav" into path
> open file path for binary read
> read from file path at 45 for 200
> close file path
> put it into mybin
>
> put "" into tHex
> put 1 into tCount
>
> repeat until tCount=155
> put byte tCount of mybin into theByte
>
> put binarydecode("H*", theByte, tHex) into theNumConversions
> put tHex after theHex
> add 1 to tCount
> end repeat
>
> After processing the content of theHex, I need to save it as a .wav
> file.
> I am aware of all the requirements for a .wav header, my only problem
> is
> to convert the whole thing to binary before saving.
>
> Can someone help ?
> Thanks in advance.
>
> jbv
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list