Advertisement
Guest User

Untitled

a guest
May 28th, 2015
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. use strict;
  3. use warnings qw(all);
  4.  
  5. use Carp qw(croak);
  6. use Fcntl qw(:DEFAULT);
  7.  
  8. unless (@ARGV) {
  9. print "$0 - converts rtl_sdr output to GNU Radio cfile (little-endian)\n";
  10. print "Usage: $0 dump1.dat dump2.dat > combined.cfile\n";
  11. }
  12.  
  13. binmode \*STDOUT;
  14. for my $filename (@ARGV) {
  15. sysopen(my $fh, $filename, O_RDONLY)
  16. || croak "Can't open $filename: $!";
  17. my $buf;
  18. while (sysread($fh, $buf, 4096)) {
  19. print pack('f<*', map { ($_ - 127) * (1 / 128) } unpack('C*', $buf));
  20. }
  21. close $fh;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement