[PD] Reading and writing binary files

Martin Peach martin.peach at sympatico.ca
Sun Feb 27 17:48:02 CET 2011


On 2011-02-26 17:57, David wrote:
> Thanks. I think I'll try using the MrPeach external. I didn't realize
> that it was already installed (I'm using pd-extended). It seems to do
> what I want, and I don't have to install any other libraries.
>
> I have a question about [binfile] though, for either of you (or
> anybody else). Is there only one buffer that has global scope, or is
> there one buffer for each patch that uses [binfile]? I tried to create
> one sub-patch to read the file, and another to write it out, assuming
> that the buffer was global. But the file that was created was empty,
> so I guess I need to extract the data from the buffer and pass it
> around in a list. Is there an object to get/put all the values in the
> buffer and convert them to/from a list? Or do I have to write a loop
> to do it "manually"?
>

Actually each [binfile] has its own buffer, which can only be accessed 
via the inlet of that [binfile]. You could use [send] and [receive] 
objects to communicate across patches, and [tabwrite] to dump the buffer 
into a table and work on it there. Or use [list append] to build a list.

[bang]
|
[trigger   b   b   b]
|        |        |
|*       |        |
[until]  [rewind( [0(
|________|        /
|                /
[binfile]       /
|       |*     /  The * connects back to the [until] to stop it.
|             /
[trigger f b]/
|          |/
|          [f]X[+1]
|          |
[tabwrite x]

Martin



More information about the Pd-list mailing list