chiark / gitweb /
separate capture from display; 58us ticks in display
authorian <ian>
Thu, 29 Dec 2005 23:13:50 +0000 (23:13 +0000)
committerian <ian>
Thu, 29 Dec 2005 23:13:50 +0000 (23:13 +0000)
detpic/capture-nmra [new file with mode: 0755]
detpic/display-nmra

diff --git a/detpic/capture-nmra b/detpic/capture-nmra
new file mode 100755 (executable)
index 0000000..ecd53d7
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -ex
+rate=96000
+sox -r $rate -u -b -t ossdsp /dev/dsp t.nmra.dat trim 0 0:1
index af2f134bd7986d18a896a7d3b653cd15352e0bfe..2941e8a22ea27b466d1991719dbcfb9f31026983 100755 (executable)
@@ -4,47 +4,47 @@ set -ex
 xpixels=1024
 ypixels=768
 ypersamp=8
-rate=96000
 fsd=0.3
 
-test -f t.nmra$rate.dat || \
-sox -r $rate -u -b -t ossdsp /dev/dsp t.nmra$rate.dat trim 0 0:1
-
-perl -e <t.nmra$rate.dat '
+perl -e <t.nmra.dat '
        for (;;) {
                @l= ();
+               $ticks= "";
+               undef $tickat;
+               print "\n"x3;
                for ($x=0; $x<'$xpixels'; $x++) {
                        $_= <>;
                        last unless length;
                        next if m/^\;/;
-                       m/^\s*[-e0-9.]+\s+([-0-9.]+)\s*$/ or die;
+                       m/^\s*([-e0-9.]+)\s+([-0-9.]+)\s*$/ or die;
+                       ($t,$samp)=($1,$2);
                        $h= sprintf "%d",
-                               ($1/(2.0*'$fsd') + 0.5) * ('$ypersamp'-1);
+                               ($samp/(2.0*'$fsd') + 0.5) * ('$ypersamp'-1);
                        for ($y=0, $l=0; $y<'$ypersamp'; $y+=2, $l++) {
                                $c= $h==$y ? "_" : $h==$y+1 ? "~" : " ";
                                $l[$l] .= $c;
                        }
+                       if (!defined $tickat && $samp > 0 && $lastsamp < 0) {
+                               $tickat= $t;
+                       }
+                       if (defined $tickat && $t >= $tickat) {
+                               $ticks.= ".";
+                               $tickat += 58e-6 * 2;
+                       } else {
+                               $ticks.= " ";
+                       }
+                       $lastsamp= $samp if $samp < 0 || $samp > 0;
                }
                foreach $l (reverse @l) {
                        print $l, "\n" or die $!;
                }
-               print "\n"x('$ypersamp'+1) or die $!;
+               print "\n"x2, $ticks, "\n"x6 or die $!;
                last unless length;
        }
-' >t.nmra$rate.ptxt
+' >t.nmra.ptxt
 
 xterm -fn nil2 \
        -geometry ${xpixels}x$(($ypixels * ($ypsersamp+1)/2)) \
        -e less -sS t.nmra$rate.ptxt
 
 exit 0
-               for ($l=0; $l<@l; $l++) {
-                       print $l[$l], "\n";
-
-
-sox -r 96000 -u -b -t ossdsp /dev/dsp t.dat trim 0 0:10
-exit 0
-perl -pe '$_= m/\-/ ? "_" : "~"' <t.dat | fold -1024
-
-
-| perl -pe 's/$/\n\n\n/' >u