| Jürgen Kahrs 2007-06-05, 9:57 pm |
| Vassilis wrote:
Years ago, I wrote the following functions for writing
binary data (sound data in .wav format).
function PrintBin(Value, Count) {
for (; Count > 0; Count--) {
printf("%c", Value%256);
Value /= 256
}
}
The header of the .wav file is written like this:
printf("RIFF");
PrintBin(nr*Channels*BytesPerSample+36, 4)
printf("WAVEfmt ");
PrintBin(16, 4)
PrintBin(1, 2)
PrintBin(Channels, 2)
PrintBin(SampleRate, 4)
[color=darkred]
> Your post seems a bit confusing (to say the least):
>
> In the title you ask an awk way to write at specific offsets.
> You also say that you've got a binary file, which you pass it through
> od (I guess) and want to convert od output to uppercase. By changing
> the output to uppercase doesn't change anything.
> Then your write two scripts that, by them selfs, don't make much
> sense.
That's indeed a bit confusing.
> Post some input, tell us what's this binary like/for or set a link to
> an example, and then try to specify the least of your requirements.
Right.
|