2012-10-16 19:32:15 -04:00
|
|
|
subroutine decoder(ntrSeconds,c0)
|
2012-10-15 17:06:15 -04:00
|
|
|
|
|
|
|
! Decoder for JT9. Can run stand-alone, reading data from *.wav files;
|
|
|
|
! or as the back end of wsjt-x, with data placed in a shared memory region.
|
|
|
|
|
|
|
|
! NB: For unknown reason, ***MUST*** be compiled by g95 with -O0 !!!
|
|
|
|
|
|
|
|
parameter (NMAX=1800*12000) !Total sample intervals per 30 minutes
|
|
|
|
parameter (NDMAX=1800*1500) !Sample intervals at 1500 Hz rate
|
|
|
|
parameter (NSMAX=22000) !Max length of saved spectra
|
|
|
|
character*22 msg
|
|
|
|
real*4 red(NSMAX)
|
|
|
|
integer*1 i1SoftSymbols(207)
|
|
|
|
integer*2 id2
|
2012-10-16 19:32:15 -04:00
|
|
|
complex c0(NDMAX)
|
|
|
|
common/jt9com/ss(184,NSMAX),savg(NSMAX),id2(NMAX),nutc,ndiskdat, &
|
2012-10-19 15:26:07 -04:00
|
|
|
ntr,nfqso,nagain,newdat,npts8,nfb,ntol,kin
|
2012-10-15 17:06:15 -04:00
|
|
|
|
|
|
|
ntrMinutes=ntrSeconds/60
|
|
|
|
newdat=1
|
|
|
|
|
|
|
|
nsps=0
|
2012-10-20 13:25:46 -04:00
|
|
|
if(ntrMinutes.eq.1) then
|
|
|
|
nsps=6912
|
|
|
|
df3=1500.0/2048.0
|
|
|
|
else if(ntrMinutes.eq.2) then
|
2012-10-15 17:06:15 -04:00
|
|
|
nsps=15360
|
2012-10-20 13:25:46 -04:00
|
|
|
df3=1500.0/2048.0
|
|
|
|
else if(ntrMinutes.eq.5) then
|
|
|
|
nsps=40960
|
|
|
|
df3=1500.0/6144.0
|
|
|
|
else if(ntrMinutes.eq.10) then
|
|
|
|
nsps=82944
|
|
|
|
df3=1500.0/12288.0
|
|
|
|
else if(ntrMinutes.eq.30) then
|
|
|
|
nsps=252000
|
|
|
|
df3=1500.0/32768.0
|
2012-10-15 17:06:15 -04:00
|
|
|
endif
|
2012-10-20 13:25:46 -04:00
|
|
|
if(nsps.eq.0) stop 'Error: bad TRperiod' !Better: return an error code###
|
2012-10-15 17:06:15 -04:00
|
|
|
|
|
|
|
! Now do the decoding
|
2012-10-16 19:32:15 -04:00
|
|
|
nutc=0
|
2012-10-19 15:26:07 -04:00
|
|
|
kstep=nsps/2
|
2012-10-16 19:32:15 -04:00
|
|
|
tstep=kstep/12000.0
|
2012-10-15 17:06:15 -04:00
|
|
|
|
|
|
|
! Get sync, approx freq
|
2012-10-16 19:32:15 -04:00
|
|
|
call sync9(ss,tstep,df3,ntol,nfqso,sync,fpk,red)
|
2012-10-19 15:26:07 -04:00
|
|
|
print*,'A',nfqso,ntol,fpk
|
2012-10-16 19:32:15 -04:00
|
|
|
call spec9(c0,npts8,nsps,fpk,xdt,i1SoftSymbols)
|
2012-10-15 17:06:15 -04:00
|
|
|
call decode9(i1SoftSymbols,msg)
|
|
|
|
|
2012-10-19 15:26:07 -04:00
|
|
|
open(13,file='decoded.txt',status='unknown')
|
|
|
|
rewind 13
|
2012-10-16 19:32:15 -04:00
|
|
|
! write(*,1010) nutc,sync,xdt,1000.0+fpk,msg
|
2012-10-19 15:26:07 -04:00
|
|
|
write(13,1010) nutc,sync,xdt,1000.0+fpk,msg
|
2012-10-16 19:32:15 -04:00
|
|
|
1010 format(i4.4,3f7.1,2x,a22)
|
2012-10-19 15:26:07 -04:00
|
|
|
call flush(13)
|
|
|
|
close(13)
|
2012-10-15 17:06:15 -04:00
|
|
|
|
|
|
|
return
|
|
|
|
end subroutine decoder
|