From f6797510d90b5de2e1f783d04ef086db0715ecba Mon Sep 17 00:00:00 2001 From: drowe67 Date: Tue, 13 Oct 2015 05:04:44 +0000 Subject: [PATCH] streaming working OK, some run time diagnostics git-svn-id: https://svn.code.sf.net/p/freetel/code@2434 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/octave/fsk_horus.m | 14 +++++++------- codec2-dev/octave/fsk_horus_stream.m | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/codec2-dev/octave/fsk_horus.m b/codec2-dev/octave/fsk_horus.m index 910fec0d..2d6ac87d 100644 --- a/codec2-dev/octave/fsk_horus.m +++ b/codec2-dev/octave/fsk_horus.m @@ -39,7 +39,7 @@ function states = fsk_horus_init() Rs = states.Rs = 50; Ts = states.Ts = Fs/Rs; states.nsym = N/Ts; - Nmem = states.Nmem = N+2*Ts; % one symbol memory in down converted signals to allow for timing adj + Nmem = states.Nmem = N+2*Ts; % two symbol memory in down converted signals to allow for timing adj states.f1_dc = zeros(1,Nmem); states.f2_dc = zeros(1,Nmem); states.P = 8; % oversample rate out of filter @@ -63,6 +63,8 @@ function states = fsk_horus_init() states.uw_thresh = 5*7 - 4; % allow 24bit errors when looking for UW states.df = 0; + states.f1 = 0; + states.f2 = 0; endfunction @@ -155,7 +157,7 @@ function [rx_bits states] = fsk_horus_demod(states, sf) %printf("f1: %4.0f Hz f2: %4.0f Hz\n", f1, f2); end - % down convert and filter at 4Rs ------------------------------ + % down convert and filter at rate P ------------------------------ % update filter (integrator) memory by shifting in nin samples @@ -187,7 +189,7 @@ function [rx_bits states] = fsk_horus_demod(states, sf) % integrate over symbol period, which is effectively a LPF, removing % the -2Fc frequency image. Can also be interpreted as an ideal % integrate and dump, non-coherent demod. We run the integrator at - % PRs (1/P symbol offsets) to get outputs at a range of different + % rate P (1/P symbol offsets) to get outputs at a range of different % fine timing offsets. We calculate integrator output over nsym+1 % symbols so we have extra samples for the fine timing re-sampler at either % end of the array. @@ -234,7 +236,7 @@ function [rx_bits states] = fsk_horus_demod(states, sf) end states.nin = next_nin; - % Re sample integrator outputs using fine timing estimate and linear interpolation + % Re-sample integrator outputs using fine timing estimate and linear interpolation low_sample = floor(rx_timing); fract = rx_timing - low_sample; @@ -467,8 +469,6 @@ endfunction function rx_bits_log = demod_file(filename) rx = load_raw(filename); more off; - rand('state',1); - randn('state',1); states = fsk_horus_init(); N = states.N; P = states.P; @@ -574,7 +574,7 @@ endfunction %rx_bits = demod_file("~/Desktop/vk5arg-3.wav"); %rx_bits = demod_file("~/Desktop/fsk_horus_10dB_1000ppm.wav"); %rx_bits = demod_file("~/Desktop/fsk_horus_6dB_0ppm.wav"); -rx_bits = demod_file("fsk_horus_rx.raw"); +%rx_bits = demod_file("fsk_horus_rx.raw"); %rx_bits = demod_file("~/Desktop/fsk_horus_20dB_0ppm_20dBfade.wav"); % streaming version: take a buffer of say 1 sec. demo to bits. Add to buffer diff --git a/codec2-dev/octave/fsk_horus_stream.m b/codec2-dev/octave/fsk_horus_stream.m index 72c9d561..e081e327 100644 --- a/codec2-dev/octave/fsk_horus_stream.m +++ b/codec2-dev/octave/fsk_horus_stream.m @@ -8,7 +8,7 @@ % % usage: % $ chmod 777 fsk_horus_stream.m -% $ rec -t raw -r 8000 -s -2 - | ./fsk_horus_stream.m +% $ rec -t raw -r 8000 -s -2 -c 1 - -q | ./fsk_horus_stream.m fsk_horus; % include library (make sure calls to functions at bottom are commented out) @@ -40,7 +40,8 @@ while c nin = states.nin; %printf("nin: %d length(rx): %d length(rx_bits_buf): %d \n", nin, length(rx), length(rx_bits_buf)); endwhile - % printf("nin: %d length(rx): %d length(rx_bits_buf): %d \n", nin, length(rx), length(rx_bits_buf)); + f = (states.f1+states.f2)/2; shift = states.f2 - states.f1; + printf("max: %d f: %d shift %d bits: %d\r", max(s), f, shift, length(rx_bits_buf)); % look for complete Horus frame, delimited by 2 unique words -- 2.25.1