Skip to content

Instantly share code, notes, and snippets.

@fo0nikens
Forked from creaktive/rtlsdr2cfile.pl
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fo0nikens/67a3b8114bf75c3e2fec to your computer and use it in GitHub Desktop.
Save fo0nikens/67a3b8114bf75c3e2fec to your computer and use it in GitHub Desktop.
#!/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