Hi folks.

I've got a file (http://home.iwcg.net/spectrum.bin) that has information about a radio observing program.

The first two bytes are a two-byte unsigned integer, which acts as an "index". When that number changes, there is new data. If you miss a number, you've missed a spectrum. The remaining data are 600 2-byte signed integers, representing the "dB" of 16384 channels. Each integer is in fact the maximum of 16384/600 = 27 bins. So the 600 integers are a boiled-down representation of the whole 16384 channel (73 kHz) bandwidth.

Now, with that said, when I'm going to get the data, and trying to split the data, my perl skills are only letting me get the binary data into hex....and the hex data is only so far.

[snip header, locations, comments, and other fluff] use LWP::Simple; require LWP::UserAgent; # First, let's get the data from the web server. $ua = LWP::UserAgent->new(); $ua->agent("Argus Remote Waterfall v.01a"); $ua->timeout ($timeout); my $response = $ua->get($fetchpage); foreach(split(//,$response)) { if (!$response->is_success) { die $response->status_line; } printf("%01x ", ord($_)); print "\n" if $_ eq "\n"; }

Now, when I run that code, I get:

48 54 54 50 3a 3a 52 65 73 70 6f 6e 73 65 3d 48 41 53 48 28 30 78 38 3 +4 38 31 65 34 34 29

Not exactly 1202 bytes of data.

What am I missing? Where do I need to be looking? Any help would be greatly appreciated


In reply to Splitting Binary Data by cableguy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.