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 [mrpeach/binfile].
it allows both [read <filename>( and [read <filename> <maxsize>(.
caveats:
on the Pd-console.
<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).
gasdmr IOhannes