<br><br><div class="gmail_quote">On Sat, Feb 26, 2011 at 1:43 PM, David <span dir="ltr"><<a href="mailto:dfkettle@gmail.com">dfkettle@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">According to the<br>
help documentation, the '-raw' flag only applies to reading files. Is<br>
that correct?<br></div></div></blockquote><div>Well, you can write it back as a soundfile in the formats that [soundfiler] supports. But if it needs to be saved in the original format, you might want to try some of the other suggestions. </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">
<br>
Anyway, I tried it and I'm getting a usage error:<br>
<br>
error: usage: read [flags] filename tablename...<br>
flags: -skip <n> -nframes <n> -resize -maxsize <n> ...<br>
-raw <headerbytes> <channels> <bytespersamp> <endian (b, l, or n)>.<br>
<br>
Here's what my patch looks like. I'm not sure what I'm doing wrong.<br>
<br>
[read -raw 0 1 8 n Default.syx array1(<br>
|<br>
[soundfiler]<br></div></div></blockquote><div>[soundfiler] only supports 2, 3, or 4 bytes per sample...</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">
<br>
There's no "header" in the file, it's just raw data for a Midi sysex<br>
message, and I want to read each byte as an integer value in the range<br>
of 0 to 255.<br></div></div></blockquote><div>...which would be 1 byte. Definitely try the other suggestions. :-)</div><div><br></div><div>.mmb </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div class="h5">
<br>
David.<br>
<br>
On Fri, Feb 25, 2011 at 7:26 PM, Mike Moser-Booth <<a href="mailto:mmoserbooth@gmail.com">mmoserbooth@gmail.com</a>> wrote:<br>
> Try using the -raw flag for [soundfiler]. Setting the <bytespersample><br>
> parameter to 2 will treat it as a 16-bit file.<br>
><br>
> .mmb<br>
><br>
> On Fri, Feb 25, 2011 at 7:07 PM, David <<a href="mailto:dfkettle@gmail.com">dfkettle@gmail.com</a>> wrote:<br>
>> It's probably very obvious, but I can't figure out how to read and<br>
>> write files containing arbitrary binary data. I know there are objects<br>
>> for reading and writing sound files, and there's [textfile] for<br>
>> reading text files, but I want to read and write binary files, and<br>
>> interpret each byte as a 16-bit integer. Does anyone have an example I<br>
>> can look at? Since they will be small files, I just need to read them<br>
>> sequentially, I don't need to jump around in the file randomly.<br>
>><br>
>> _______________________________________________<br>
>> <a href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list<br>
>> UNSUBSCRIBE and account-management -> <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> Mike Moser-Booth<br>
> <a href="mailto:mmoserbooth@gmail.com">mmoserbooth@gmail.com</a><br>
><br>
<br>
_______________________________________________<br>
<a href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -> <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Mike Moser-Booth<br><a href="mailto:mmoserbooth@gmail.com">mmoserbooth@gmail.com</a><br>