-
-
Save fo0nikens/67a3b8114bf75c3e2fec to your computer and use it in GitHub Desktop.
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