Created
September 29, 2014 10:55
-
-
Save creaktive/e487ae88202d924cecf5 to your computer and use it in GitHub Desktop.
converts rtl_sdr output to GNU Radio cfile (little-endian)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings qw(all); | |
use Carp qw(croak); | |
use Fcntl qw(:DEFAULT); | |
unless (@ARGV) { | |
print "$0 - converts rtl_sdr output to GNU Radio cfile (little-endian)\n"; | |
print "Usage: $0 dump1.dat dump2.dat > combined.cfile\n"; | |
} | |
binmode \*STDOUT; | |
for my $filename (@ARGV) { | |
sysopen(my $fh, $filename, O_RDONLY) | |
|| croak "Can't open $filename: $!"; | |
my $buf; | |
while (sysread($fh, $buf, 4096)) { | |
print pack('f<*', map { ($_ - 127) * (1 / 128) } unpack('C*', $buf)); | |
} | |
close $fh; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment