%Init 'high-bit-rate horus'
function states = fsk_horus_init_hbr(Fs,P,Rs,M=2)
assert((M==2) || (M==4), "Only M=2 and M=4 FSK supported");
+
+ nsym = 96;
+
states.M = M;
states.bitspersymbol = log2(M);
states.Fs = Fs;
- N = states.N = Fs; % processing buffer size, nice big window for timing est
+ N = states.N = Ts*nsym; % processing buffer size, nice big window for timing est
states.Ndft = 2.^ceil(log2(N))/2; % find nearest power of 2 for efficient FFT
%states.Ndft = 1024; % find nearest power of 2 for efficient FFT
states.Rs = Rs;
% $ hackrf_transfer -t ../octave/fsk_10M.iq -f 10000000 -a 1 -x 40
function hackrf_uc(outfilename, infilename)
- Fs1 = 96E3; % input sample rate
+ pkg load signal;
+ Fs1 = 48E3; % input sample rate
Fs2 = 10E6; % output sample rate to HackRF
fc = 700E3-24E3; % offset to shift to, HackRF doesn't like signals in the centre
A = 100; % amplitude of signal after upc-nversion (max 127)
N = Fs1*20;
fin = fopen(infilename,"rb");
- s1 = fread(fin,Inf,"short");
+ printf("1\n");
+ s1 = fread(fin,"short");
+ printf("1\n");
fclose(fin);
+ printf("1\n");
ls1 = length(s1);
-
+ printf("1\n");
+ N = ls1;
% single sided freq shifts, we don't want DSB
-
+ printf("1\n");
s1 = hilbert(s1(1:N));
% upsample to Fs2
ls2 = length(s2);
mx = max(abs(s2));
t = 0:ls2-1;
-
+ printf("2\n");
% shift up to Fc, note use of rot90 rather than trasnpose operator '
% as we don't want complex conj, that would shift down in freq
sout = rot90((A/mx)*s2) .* exp(j*2*pi*t*fc/Fs2);
save_hackrf(outfilename,sout);
+
end
int i;
int memold;
int Ndft = 0;
-
+ printf(stdout,"hbr_initing\n");
/* Number of symbols in a processing frame */
//int nsyms = 96;
int nsyms = 48;
fsk->est_max = (Fs/2)-Rs;
- fsk->est_space = Rs-(Rs/5);
+ fsk->est_space = Rs-(Rs/10);
/* Set up rx state */
fsk->phi1_c = comp_exp_j(0);
return fsk;
}
-#define HORUS_MIN 800
-#define HORUS_MAX 2500
+#define HORUS_MIN 100
+#define HORUS_MAX 4000
#define HORUS_MIN_SPACING 200
/*---------------------------------------------------------------------------*\
f_min = (fsk->est_min*Ndft)/Fs;
f_max = (fsk->est_max*Ndft)/Fs;
- f_zero = (fsk->est_space*Ndft)/(2*Fs);
+ f_zero = (fsk->est_space*Ndft)/(Fs);
int fft_loops = nin/Ndft;
for(j=0; j<fft_loops; j++){
+++ /dev/null
-
-/*---------------------------------------------------------------------------*\
-
- FILE........: vhf_deframe_c2.c
- AUTHOR......: Brady O'Brien
- DATE CREATED: 8 March 2016
-
- C tool to extract codec2 data from freedv VHF 2400A/B/whatever frames
-
-
-\*---------------------------------------------------------------------------*/
-
-/*
- Copyright (C) 2016 David Rowe
-
- All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License version 2.1, as
- published by the Free Software Foundation. This program is
- distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include "freedv_vhf_framing.h"
-
-int main(int argc,char *argv[]){
- struct freedv_vhf_deframer * deframer;
- FILE *fin,*fout;
- uint8_t *bitbuf;
- uint8_t *c2buf;
- uint8_t zbuf[] = {0,0,0,0,0,0,0};
-
- if(argc<3){
- fprintf(stderr,"usage: %s InputOneBitPerCharFile OutputC2File\n",argv[0]);
- exit(1);
- }
-
- /* Open files */
- if(strcmp(argv[1],"-")==0){
- fin = stdin;
- }else{
- fin = fopen(argv[1],"r");
- }
-
- if(strcmp(argv[2],"-")==0){
- fout = stdout;
- }else{
- fout = fopen(argv[2],"w");
- }
-
- /* Set up deframer */
- deframer = fvhff_create_deframer(FREEDV_VHF_FRAME_A,0);
-
- if(fin==NULL || fout==NULL || deframer==NULL){
- fprintf(stderr,"Couldn't open test vector files\n");
- goto cleanup;
- }
-
- /* allocate buffers for processing */
- bitbuf = (uint8_t*)malloc(sizeof(uint8_t)*96);
- c2buf = (uint8_t*)malloc(sizeof(uint8_t)*7);
-
- /* Deframe! */
- while( fread(bitbuf,sizeof(uint8_t),96,fin) == 96 ){
- if(fvhff_deframe_bits(deframer,c2buf,NULL,NULL,bitbuf))
- fwrite(c2buf,sizeof(uint8_t),7,fout);
- else
- fwrite(zbuf,sizeof(uint8_t),7,fout);
-
- if(fin == stdin || fout == stdin){
- fflush(fin);
- fflush(fout);
- }
- }
-
- free(bitbuf);
- free(c2buf);
-
- cleanup:
- fclose(fin);
- fclose(fout);
- fvhff_destroy_deframer(deframer);
- exit(0);
-}
-