decoding multiple packets
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 12 Oct 2015 08:27:20 +0000 (08:27 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 12 Oct 2015 08:27:20 +0000 (08:27 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2431 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/fsk_horus.m

index e0d3351a802d5b9d39f6750994fd4189b9b8e66f..ce5c58730c8a68b51320d8e9a85b9d797b714cd9 100644 (file)
@@ -408,7 +408,7 @@ endfunction
 
 function rx_bits_log = demod_file(filename)
   rx = load_raw(filename);
-  more off
+  more off;
   rand('state',1); 
   randn('state',1);
   states = fsk_horus_init();
@@ -426,6 +426,8 @@ function rx_bits_log = demod_file(filename)
 
   % First extract raw bits from samples ------------------------------------------------------
 
+  printf("demod of raw bits....\n");
+
   for f=1:frames
 
     % extract nin samples from input stream
@@ -444,6 +446,8 @@ function rx_bits_log = demod_file(filename)
     f2_int_resample_log = [f2_int_resample_log abs(states.f2_int_resample)];
   end
 
+  printf("plotting...\n");
+
   figure(1);
   plot(f1_int_resample_log,'+')
   hold on;
@@ -457,15 +461,7 @@ function rx_bits_log = demod_file(filename)
   title('norm fine timing')
   grid
   
-  figure(3)
-  clf
-  step = 11;
-  hold on;
-  for i=1:step:length(rx_bits_log)-step
-    plot(rx_bits_log(i:i+step-1))
-  end
-  hold off;
-  axis([1 step -1 2])
+  printf("frame sync and data extraction...\n");
 
   % Now perform frame sync and extract ASCII text --------------------------------------------------------
 
@@ -489,19 +485,25 @@ function rx_bits_log = demod_file(filename)
       % RS232 idle bits stuck into it anywhere, ie "bit fields" don't
       % change dynamically.
 
+      str = [];
       st += length(states.uw);  % first bit of first char
       for i=st:nfield+npad:uw_loc
         field = rx_bits_log(i:i+nfield-1);
         ch_dec = field * (2.^(0:nfield-1))';
-        printf("i: %d ch_dec: %d ch: %c\n", i, ch_dec, ch_dec);
+        %printf("i: %d ch_dec: %d ch: %c\n", i, ch_dec, ch_dec);
+        str = [str char(ch_dec)];
       end
+      printf("%s", str);
     end
+   
   endwhile
-  
 endfunction
 
+% run test functions from here during development
+
 %run_sim
-rx_bits = demod_file("~/Desktop/vk5arg-3.wav");
+rx_bits = demod_file("~/Desktop/vk5arg-3-1.wav");
 
 
 % [X] fixed test frame
@@ -512,3 +514,4 @@ rx_bits = demod_file("~/Desktop/vk5arg-3.wav");
 % [X] try to match bits with real data
 % [X] look for UW
 % [ ] try big amplitude fades at a few Hz to simulate spinning, see if timing loses it
+% [ ] streaming I/O