[PD] [text] issue reading SysEx files

IOhannes m zmoelnig zmoelnig at iem.at
Mon Jan 21 13:34:02 CET 2019

On 21.01.19 12:48, Roman Haefeli wrote:
> On Mon, 2019-01-21 at 10:03 +0100, Antoine Rousseau wrote:
>>> make an addition to soundfiler to read binary characters into an
>>> array.
>>  wouldn't "read -raw 0 1 1 n" work?
> It would be cool if -raw would allow 1 byte per sample. But even if it
> worked this way, the result would be scaled to the range of -1 to 1,
> which is not so handy. A way to read bytes represented in the array as
> numbers in the range of 0 to 255 would make [soundfiler] really useful
> for dealing with binary files.

attached is a vanilla abstraction to read binary files like

it allows both [read <filename>( and [read <filename> <maxsize>(.

- if the file-size is not a multiple of 2, the last byte is omitted!
- when using the <maxsize> feature, you get an ugly error-like warning
on the Pd-console.
- it's not super-efficient. especially it reads the entire (up to
<maxsize> bytes) file into memory twice. so it's probably not a good
idea to use this with large files.
it also outputs the entire file as a list of bytes (as opposed to
[mrpeach/binfile] which just gives you have to bang to get the next byte).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: binread.pd
Type: text/x-puredata
Size: 3408 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20190121/26645199/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20190121/26645199/attachment.sig>

More information about the Pd-list mailing list