Merge branch 'release-2.1.0' of bitbucket.org:k1jt/wsjtx into release-2.1.0

This commit is contained in:
Bill Somerville 2019-06-13 01:48:38 +01:00
commit 636da26ccc
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
2 changed files with 89 additions and 0 deletions

View File

@ -1274,6 +1274,9 @@ target_link_libraries (jt49sim wsjt_fort wsjt_cxx)
add_executable (allsim lib/allsim.f90 wsjtx.rc)
target_link_libraries (allsim wsjt_fort wsjt_cxx)
add_executable (rtty_spec lib/rtty_spec.f90 wsjtx.rc)
target_link_libraries (rtty_spec wsjt_fort wsjt_cxx)
add_executable (jt65code lib/jt65code.f90 wsjtx.rc)
target_link_libraries (jt65code wsjt_fort wsjt_cxx)

86
lib/rtty_spec.f90 Normal file
View File

@ -0,0 +1,86 @@
program rtty_spec
! Generate simulated data for standard RTTY and WSJT-X modes FT8, FT4
use wavhdr
use packjt
parameter (NMAX=15*12000)
type(hdr) h
complex cwave(NMAX)
real wave(NMAX)
real*4 dat(NMAX) !Generated waveform
integer*2 iwave(NMAX) !Generated waveform
integer itone(680) !Channel symbols (values 0-1, 0-3, 0-7)
integer*1 msgbits(77)
character*37 msg37,msgsent37
character*8 arg
nargs=iargc()
if(nargs.ne.1) then
print*,'Usage: rtty_spec <snr>'
go to 999
endif
call getarg(1,arg)
read(arg,*) snrdb !S/N in dB (2500 hz reference BW)
rmsdb=25.
rms=10.0**(0.05*rmsdb)
sig=10.0**(0.05*snrdb)
npts=NMAX
do i=1,NMAX !Generate gaussian noise
dat(i)=gran()
enddo
! Add the RTTY signal
fsample=12000.0 !Sample rate (Hz)
dt=1.0/fsample !Sample interval (s)
twopi=8.0*atan(1.0)
phi=0.
dphi=0.
j0=-1
do i=6001,NMAX-6000
j=nint(i*dt/0.022)
if(j.ne.j0) then
f0=1415.0
call random_number(rr)
if(rr.gt.0.5) f0=1585.0
dphi=twopi*f0*dt
j0=j
endif
phi=phi+dphi
if(phi.gt.twopi) phi=phi-twopi
dat(i)=dat(i) + sig*sin(phi)
enddo
! Add the FT8 signal
i3=0
n3=0
msg37='WB9XYZ KA2ABC FN42'
call genft8(msg37,i3,n3,msgsent37,msgbits,itone)
nsym=79
nsps=1920
bt=2.0
f0=3000.0
icmplx=0
nwave=nsym*nsps
call gen_ft8wave(itone,nsym,nsps,bt,fsample,f0,cwave,wave,icmplx,nwave)
dat(6001:6000+nwave)=dat(6001:6000+nwave) + sig*wave(1:nwave)
! Add the FT4 signal
ichk=0
call genft4(msg37,ichk,msgsent37,msgbits,itone)
nsym=103
nsps=576
f0=3500.0
icmplx=0
nwave=(nsym+2)*nsps
call gen_ft4wave(itone,nsym,nsps,fsample,f0,cwave,wave,icmplx,nwave)
dat(6001:6000+nwave)=dat(6001:6000+nwave) + sig*wave(1:nwave)
h=default_header(12000,NMAX)
iwave=nint(rms*dat)
open(10,file='000000_000001.wav',access='stream',status='unknown')
write(10) h,iwave
close(10)
999 end program rtty_spec