Hello,
I'm using binfile external to read a binary file content and would like to convert the four bytes to floats. Is there an abstraction or external doing the conversion?
Best
Patco.
Am 29. August 2024 21:32:45 MESZ schrieb Patko nytkophilus colet.patrice@gmail.com:
Hello,
I'm using binfile external to read a binary file content and would like to convert the four bytes to floats. Is there an abstraction or external doing the conversion?
My "bytestruct" library can do this. I just noticed, that I never uploaded to deken (as for whatever reasons I wanted it to be included in pd directly, and opened a pr a while ago).
There should be a downloadable .dek file (that can be installed via the "find externals..." menu) somewhere at https://git.iem.at/pd/bytestruct/-/pipelines (at the top job, in the "actions" section locate the "deken:archive" artifact (the zip file contains the dek file)
I'll try to upload a proper deken package after the weekend.
mfg.sfg.jfd IOhannes
Am 29. August 2024 22:02:13 MESZ schrieb "IOhannes m zmölnig" zmoelnig@iem.at:
Am 29. August 2024 21:32:45 MESZ schrieb Patko nytkophilus colet.patrice@gmail.com:
Hello,
I'm using binfile external to read a binary file content and would like to convert the four bytes to floats. Is there an abstraction or external doing the conversion?
My "bytestruct" library can do this.
If you would like to avoid externals, you can also use [oscparse]
for converting a (big endian) 4bytes to a float (just prepends some dummy bytes to create a valid OSC message).
Speaking of avoiding externals, I wonder why you use [binfile]
, rather than the built in [file]
mfg.sfg.jfd IOhannes
Am 29. August 2024 22:02:13 MESZ schrieb "IOhannes m zmölnig" zmoelnig@iem.at:
Speaking of avoiding externals, I wonder why you use
[binfile]
, rather than the built in[file]
It's because I'm not used to [file] internal, I've just figured out it can handle binary files.
By the way, now I'd like to search values > 0 in mega octets files size.
Polling with the [file] methods seems extremely slow, and it would take hours in some files.
Do you know how it could be faster?
Best regards
Patco
You could also load your file into an array (or [table]), using [soundfiler] in raw mode. Then I guess you can do your search operation in the patch quickly enough.
Le ven. 30 août 2024 à 14:33, Patko nytkophilus colet.patrice@gmail.com a écrit :
Am 29. August 2024 22:02:13 MESZ schrieb "IOhannes m zmölnig" zmoelnig@iem.at:
Speaking of avoiding externals, I wonder why you use
[binfile]
, rather than the built in[file]
It's because I'm not used to [file] internal, I've just figured out it can handle binary files.
By the way, now I'd like to search values > 0 in mega octets files size.
Polling with the [file] methods seems extremely slow, and it would take hours in some files.
Do you know how it could be faster?
Best regards
Patco
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/VKMVRX6I6E...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
I've just done a quick check and it should work. For example:
[read -raw 0 1 4 b your-file your-table( | [soundfiler]
will read a raw 4-bytes-float file in a big-endian format. Use 'l' in place of 'b' to read a little-endian file.
Le 30 août 2024 à 23:45, Antoine Rousseau antoine@metalu.net a écrit :
I've just done a quick check and it should work. For example:
[read -raw 0 1 4 b your-file your-table( | [soundfiler]
will read a raw 4-bytes-float file in a big-endian format. Use 'l' in place of 'b' to read a little-endian file.
That's quite clever, thank you for the tip.
cool! I agree that [bytestruct] could become a standard (vanilla) tool.
Le lun. 2 sept. 2024 à 07:39, IOhannes m zmölnig zmoelnig@iem.at a écrit :
On 29/08/2024 22:02, IOhannes m zmölnig wrote:
I'll try to upload a proper deken package after the weekend.
done.
gmsar IOhannes
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/4HEHAAGFTR...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/