Here they are. They prompt for the file name using [openpanel] and
[savepanel]. I'm not sure if that's what you really want. But it
shouldn't be difficult to modify them to pass a file name through an
inlet, or just hard-code the file name. They're built on top of Martin
Peach's [binfile], which is included in pd-extended. But if you're
using vanilla pd, you'll have to download Martin's code as well.

To use 'getfile', just send it a 'bang' and it will return a list of
floats containing the byte values in the file. To use 'putfile', just
send it a list of floats. It doesn't do any validation, so if the list
contains a non-integer or an integer that's outside the range of 0 to
255, you'll get one of the following errors, for example:

error: binfile: input (7.300000) not an integer
error: binfile: input (100020) out of range [0..255]

David.

On Tue, Mar 8, 2011 at 1:37 PM, Jamie Bullock <[email protected]> wrote:
>
>
> On 8 Mar 2011, at 17:55, David <[email protected]> wrote:
>
>> Hi! I developed some abstractions for reading/writing binary files,
>> but they're somewhat limited in capability. They just load the data
>> into a list of floats (one per byte), or save a list of floats to a
>> file, and they read/write the entire file at once. They don't support
>> repositioning within the file, or writing/reading a portion of the
>> file. But if the files are relatively small, they might be suitable.
>>
>> I can send them to you later if you're interested, I'm at work right now.
>>
>
> Thanks, that would be great!
>
> Jamie
>
>
#N canvas 455 101 462 532 10;
#X obj 121 238 mrpeach/binfile;
#X msg 102 168 read \$1;
#X obj 102 127 openpanel;
#X obj 217 19 inlet;
#X obj 34 312 until;
#X obj 34 220 t b;
#X obj 230 382 t l;
#X obj 175 335 list prepend;
#X obj 105 352 t b;
#X obj 105 415 list append;
#X obj 105 482 outlet;
#X obj 217 64 t b l;
#X connect 0 0 7 0;
#X connect 0 2 4 1;
#X connect 0 2 8 0;
#X connect 1 0 0 0;
#X connect 1 0 5 0;
#X connect 2 0 1 0;
#X connect 3 0 11 0;
#X connect 4 0 0 0;
#X connect 5 0 4 0;
#X connect 6 0 7 1;
#X connect 7 0 6 0;
#X connect 7 0 9 1;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 11 0 2 0;
#X connect 11 1 7 1;
#N canvas 561 225 396 395 10;
#X obj 118 340 mrpeach/binfile;
#X obj 56 23 inlet;
#X obj 56 150 savepanel;
#X msg 56 193 write \$1;
#X obj 254 166 list split 1;
#X msg 166 186 writeat 0;
#X obj 56 79 t b b l;
#X obj 254 217 t b a;
#X obj 315 99 list;
#X connect 1 0 6 0;
#X connect 2 0 3 0;
#X connect 3 0 0 0;
#X connect 4 0 7 0;
#X connect 4 1 8 1;
#X connect 5 0 0 0;
#X connect 6 0 2 0;
#X connect 6 1 5 0;
#X connect 6 2 4 0;
#X connect 7 0 8 0;
#X connect 7 1 0 0;
#X connect 8 0 4 0;
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to