From df6fe7a6005d95c60816f694bf0bd91e49280880 Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Mon, 1 Jan 2018 23:23:19 +0000 Subject: [PATCH] Replace hardwired Nyquist frequency with variable (fsample/2). Add a clipping warning. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8390 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/jt65sim.f90 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/jt65sim.f90 b/lib/jt65sim.f90 index eca533b47..46b978fca 100644 --- a/lib/jt65sim.f90 +++ b/lib/jt65sim.f90 @@ -190,7 +190,7 @@ program jt65sim endif enddo - bandwidth_ratio=2500.0/6000.0 + bandwidth_ratio=2500.0/(fsample/2.0) sig=sqrt(2*bandwidth_ratio)*10.0**(0.05*xsnr) if(xsnr.gt.90.0) sig=1.0 write(*,1020) ifile,isig,f0,csubmode,xsnr,xdt,fspread,msg @@ -285,7 +285,11 @@ program jt65sim dat=aimag(cdat) + xnoise !Add the generated noise fac=32767.0/nsigs if(snrdb.ge.90.0) iwave(1:npts)=nint(fac*dat(1:npts)) - if(snrdb.lt.90.0) iwave(1:npts)=nint(rms*dat(1:npts)) + + if(snrdb.lt.90.0) then + if(any(dat.gt.32767.0/rms)) print*,"Warning - data will be clipped." + iwave(1:npts)=nint(rms*dat(1:npts)) + endif write(10) h,iwave(1:npts) !Save the .wav file close(10) enddo