Forums > MaxMSP

Read bin?

February 5, 2006 | 8:55 pm


February 5, 2006 | 9:30 pm


February 5, 2006 | 11:18 pm

Thanks for the tip, but I’m already working with Jitter. But for a project ( http://recyclism.com/corrupt.php ) I’d like to manipulate the binary of a document, and the matrix system of Jitter is not what I’m looking for, I just want to be able to access the binary code of a picture and scramble with it. I’m not looking for ways to simulate or to create visual effects with Jitter.

I’m looking for an object to read the binary, manipulate it and save the document again (I hope this is more clear now ;-)

Best,

bnjmn


February 6, 2006 | 1:44 am


February 6, 2006 | 3:37 am

have you seen the glitch browser?

http://dataisnature.com/?p=254

actually, here is some javascript code for a firefox plugin that the
glitchbrowser uses

http://glitchbrowser.com/gmonkey/

Similar ‘corrupt’ image processing

enjoy!

v a d e //

http://www.vade.info
abstrakt.vade.info

I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I
LIVE! I LIVE! I LIVE! I LIVE!

You will not be saved by the Holy Ghost. You will not be saved by the
God Plutonium.

In fact, YOU WILL NOT BE SAVED!


February 6, 2006 | 3:42 am

actually on closer inspection that JS code simply redirects to their
php parser and returns the image. oh well.but thats what you are
talking about right?

v a d e //

http://www.vade.info
abstrakt.vade.info

I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I
LIVE! I LIVE! I LIVE! I LIVE!

You will not be saved by the Holy Ghost. You will not be saved by the
God Plutonium.

In fact, YOU WILL NOT BE SAVED!


February 6, 2006 | 9:26 am


February 6, 2006 | 4:02 pm


February 6, 2006 | 4:11 pm


February 6, 2006 | 4:32 pm

filein

salutations

/*j

Benjamin Gaulon wrote:

> Yes indeed, it could fix a part of the pbl, thanks… Still I wonder how to read the binary of a file.. there must be something for that… ;-)


February 6, 2006 | 4:45 pm

> filein

> salutations

> /*j

I knew there was soething ;-)

Merci Jasch, ones again !!!!

All the best,

bnjmn


February 6, 2006 | 6:44 pm

you live, but i will be saved, by my-self.
i have red sand on my hand-mind prooving that.
someone broke the code.

to gar estin, to gar estin
for it is the same as to think and to be
to gar estin,

via page number: georges ifrah


February 6, 2006 | 9:51 pm

On Feb 6, 2006, at 4:11 PM, Benjamin Gaulon wrote:

> Still I wonder how to read the binary of a file.. there must be
> something for that… ;-)

Please see the JS documentation of the FIle object, specifically the
readbytes and writebytes methods to access the raw binary data of files.

readbytes (byte_count)
Reads and returns an array containing up to byte_count numbers, read
as bytes
from the file, starting at the current file position. The file
position is updated
accordingly.

writebytes (byte_array)
Writes the numbers contained in the byte_array argument as bytes to
the file,
starting at the current file position. The file position is updated
accordingly.

-Joshua


February 6, 2006 | 11:10 pm

Yeah, this sound more like it ;-) I knew there was something there…

thx,

bnjmn?


February 7, 2006 | 1:20 am

Javascript is suppose to be simple but maybe I miss something here (when I call my function I only get the flying pizza of death… and I have to force quit Max…), I certainly have made a stupod mistake but I don’t see it… :

function readbytes(s)
{
var f = new File(s);
var i,a,c;

if (f.isopen) {
c = f.eof;
for (i=0;i
a = f.readbytes(1); //
post("byte_count[" + f.position + "]: " + a + "n");
}
f.close();
} else {
post("could not open file: " + s + "n");
}
}

readbytes (byte_count)
Reads and returns an array containing up to byte_count numbers, read
as bytes
from the file, starting at the current file position. The file
position is updated
accordingly.

writebytes (byte_array)
Writes the numbers contained in the byte_array argument as bytes to
the file,
starting at the current file position. The file position is updated
accordingly.

-Joshua


February 7, 2006 | 1:33 am

On Feb 7, 2006, at 1:20 AM, Benjamin Gaulon wrote:

>
> Javascript is suppose to be simple but maybe I miss something here
> (when I call my function I only get the flying pizza of death…
> and I have to force quit Max…), I certainly have made a stupod
> mistake but I don’t see it… :
>

I don’t think so. The code looks okay at a glance. It sounds like
it’s taking that long to read in. Don’t underestimate the overhead of
doing this in JavaScript. Note that the max window won’t update
until you’ve completed your function. Try doing this just for a few
bytes. It will also be faster to read more than one byte at a time,
but still not that fast, as the byte is read, converted to a max
atom, which is converted to a JS number. Doing in Java or C would be
faster than in JS.

-Joshua


February 7, 2006 | 1:53 am

ok, thank you very much. finally it seams that my Proce55ing methods was more efficent ;-) but I will keep investigating with Max ;-)

thx again,

bnjmn

Doing in Java or C would be faster than in JS.


Viewing 17 posts - 1 through 17 (of 17 total)