mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-10 14:23:31 -05:00
Added a simulation mode in which a specified SNR is generated.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@95 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
c36054139a
commit
076a01eba5
18
fivehz.f90
18
fivehz.f90
@ -209,3 +209,21 @@ subroutine fivehztx
|
|||||||
endif
|
endif
|
||||||
return
|
return
|
||||||
end subroutine fivehztx
|
end subroutine fivehztx
|
||||||
|
|
||||||
|
subroutine addnoise(n)
|
||||||
|
integer*2 n
|
||||||
|
real r(12)
|
||||||
|
include 'gcom1.f90'
|
||||||
|
|
||||||
|
if(txsnrdb.gt.90.0) return
|
||||||
|
snr=10.0**(0.05*(txsnrdb-1))
|
||||||
|
call random_number(r)
|
||||||
|
x=sum(r)-6.0
|
||||||
|
i=3000.0*x + n*snr*3000.0/32768.0
|
||||||
|
if(i>32767) i=32767;
|
||||||
|
if(i<-32767) i=-32767;
|
||||||
|
n=i
|
||||||
|
|
||||||
|
return
|
||||||
|
end subroutine addnoise
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ real*8 rxdelay !Delay between PTT=1 and Tx audio SoundIn
|
|||||||
real*8 txdelay !Delay from end of Tx Audio and PTT=0 SoundOut
|
real*8 txdelay !Delay from end of Tx Audio and PTT=0 SoundOut
|
||||||
real*8 samfacin !(Input sample rate)/11025 GUI
|
real*8 samfacin !(Input sample rate)/11025 GUI
|
||||||
real*8 samfacout !(Output sample rate)/11025 GUI
|
real*8 samfacout !(Output sample rate)/11025 GUI
|
||||||
|
real*8 txsnrdb !SNR for simulations GUI
|
||||||
integer*2 y1 !Ring buffer for audio channel 0 SoundIn
|
integer*2 y1 !Ring buffer for audio channel 0 SoundIn
|
||||||
integer*2 y2 !Ring buffer for audio channel 1 SoundIn
|
integer*2 y2 !Ring buffer for audio channel 1 SoundIn
|
||||||
integer nmax !Actual length of Rx ring buffers GUI
|
integer nmax !Actual length of Rx ring buffers GUI
|
||||||
@ -41,7 +42,7 @@ integer mfsample2 !Measured sample rate, output SoundOut
|
|||||||
integer ns0 !Time at last ALL.TXT date entry Decoder
|
integer ns0 !Time at last ALL.TXT date entry Decoder
|
||||||
|
|
||||||
common/gcom1/Tbuf(1024),ntrbuf(1024),Tsec,rxdelay,txdelay, &
|
common/gcom1/Tbuf(1024),ntrbuf(1024),Tsec,rxdelay,txdelay, &
|
||||||
samfacin,samfacout,y1(NRXMAX),y2(NRXMAX), &
|
samfacin,samfacout,txsnrdb,y1(NRXMAX),y2(NRXMAX), &
|
||||||
nmax,iwrite,iread,iwave(NTXMAX),nwave,TxOK,Receiving,Transmitting, &
|
nmax,iwrite,iread,iwave(NTXMAX),nwave,TxOK,Receiving,Transmitting, &
|
||||||
TxFirst,TRPeriod,ibuf,ibuf0,ave,rms,ngo,level,mute,newdat,ndsec, &
|
TxFirst,TRPeriod,ibuf,ibuf0,ave,rms,ngo,level,mute,newdat,ndsec, &
|
||||||
ndevin,ndevout,nx,mfsample,mfsample2,ns0
|
ndevin,ndevout,nx,mfsample,mfsample2,ns0
|
||||||
|
@ -137,6 +137,7 @@ static int SoundOut( void *inputBuffer, void *outputBuffer,
|
|||||||
short *in = (short*)inputBuffer;
|
short *in = (short*)inputBuffer;
|
||||||
short *wptr = (short*)outputBuffer;
|
short *wptr = (short*)outputBuffer;
|
||||||
unsigned int i,n;
|
unsigned int i,n;
|
||||||
|
static short n2;
|
||||||
static int n0;
|
static int n0;
|
||||||
static int ia=0;
|
static int ia=0;
|
||||||
static int ib=0;
|
static int ib=0;
|
||||||
@ -167,6 +168,7 @@ static int SoundOut( void *inputBuffer, void *outputBuffer,
|
|||||||
|
|
||||||
for(i=0 ; i<framesPerBuffer; i++ ) {
|
for(i=0 ; i<framesPerBuffer; i++ ) {
|
||||||
if(*data->TxOK) {
|
if(*data->TxOK) {
|
||||||
|
addnoise_(&data->iwave[ic]);
|
||||||
*wptr++ = data->iwave[ic]; //left
|
*wptr++ = data->iwave[ic]; //left
|
||||||
*wptr++ = data->iwave[ic]; //right
|
*wptr++ = data->iwave[ic]; //right
|
||||||
ic++;
|
ic++;
|
||||||
@ -177,8 +179,10 @@ static int SoundOut( void *inputBuffer, void *outputBuffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*wptr++ = 0; //left
|
n2=0;
|
||||||
*wptr++ = 0; //right
|
addnoise_(&n2);
|
||||||
|
*wptr++ = n2; //left
|
||||||
|
*wptr++ = n2; //right
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fivehztx_(); //Call fortran routine
|
fivehztx_(); //Call fortran routine
|
||||||
|
21
wsjt.py
21
wsjt.py
@ -86,6 +86,7 @@ setseq=IntVar()
|
|||||||
ShOK=IntVar()
|
ShOK=IntVar()
|
||||||
slabel="Sync "
|
slabel="Sync "
|
||||||
textheight=7
|
textheight=7
|
||||||
|
txsnrdb=99.
|
||||||
TxFirst=IntVar()
|
TxFirst=IntVar()
|
||||||
green=zeros(500,'f')
|
green=zeros(500,'f')
|
||||||
im=Image.new('P',(500,120))
|
im=Image.new('P',(500,120))
|
||||||
@ -892,6 +893,9 @@ def clear_avg(event=NONE):
|
|||||||
avetext.configure(state=NORMAL)
|
avetext.configure(state=NORMAL)
|
||||||
avetext.delete('1.0',END)
|
avetext.delete('1.0',END)
|
||||||
avetext.configure(state=DISABLED)
|
avetext.configure(state=DISABLED)
|
||||||
|
f=open(appdir+'/decoded.ave',mode='w')
|
||||||
|
f.truncate(0) #Delete contents of decoded.ave
|
||||||
|
f.close()
|
||||||
Audio.gcom2.nclearave=1
|
Audio.gcom2.nclearave=1
|
||||||
|
|
||||||
#------------------------------------------------------ defaults
|
#------------------------------------------------------ defaults
|
||||||
@ -1225,7 +1229,7 @@ def plot_yellow():
|
|||||||
def update():
|
def update():
|
||||||
global root_geom,isec0,naz,nel,ndmiles,ndkm,nhotaz,nhotabetter,nopen, \
|
global root_geom,isec0,naz,nel,ndmiles,ndkm,nhotaz,nhotabetter,nopen, \
|
||||||
im,pim,cmap0,isync,isync441,isync6m,isync65,isync_save,idsec, \
|
im,pim,cmap0,isync,isync441,isync6m,isync65,isync_save,idsec, \
|
||||||
first,itol
|
first,itol,txsnrdb
|
||||||
|
|
||||||
utc=time.gmtime(time.time()+0.1*idsec)
|
utc=time.gmtime(time.time()+0.1*idsec)
|
||||||
isec=utc[5]
|
isec=utc[5]
|
||||||
@ -1335,6 +1339,16 @@ def update():
|
|||||||
tx4.configure(bg='white')
|
tx4.configure(bg='white')
|
||||||
tx5.configure(bg='white')
|
tx5.configure(bg='white')
|
||||||
tx6.configure(bg='white')
|
tx6.configure(bg='white')
|
||||||
|
if tx6.get()[:1]=='#':
|
||||||
|
try:
|
||||||
|
txsnrdb=float(tx6.get()[1:])
|
||||||
|
if txsnrdb>-99.0 and txsnrdb<10.0:
|
||||||
|
Audio.gcom1.txsnrdb=txsnrdb
|
||||||
|
tx6.configure(bg='orange')
|
||||||
|
except:
|
||||||
|
txsnrdb=99.0
|
||||||
|
else:
|
||||||
|
txsnrdb=99.0
|
||||||
if Audio.gcom2.monitoring and not Audio.gcom1.transmitting:
|
if Audio.gcom2.monitoring and not Audio.gcom1.transmitting:
|
||||||
bmonitor.configure(bg='green')
|
bmonitor.configure(bg='green')
|
||||||
else:
|
else:
|
||||||
@ -1347,8 +1361,9 @@ def update():
|
|||||||
# t="Transmitting: "
|
# t="Transmitting: "
|
||||||
# t="Txing: "+t[:nmsg]
|
# t="Txing: "+t[:nmsg]
|
||||||
bgcolor='yellow'
|
bgcolor='yellow'
|
||||||
if Audio.gcom2.sendingsh==1: bgcolor='#66FFFF'
|
if Audio.gcom2.sendingsh==1: bgcolor='#66FFFF' #Shorthand
|
||||||
if Audio.gcom2.sendingsh==-1: bgcolor='red'
|
if Audio.gcom2.sendingsh==-1: bgcolor='red' #Plain Text
|
||||||
|
if txsnrdb<90.0: bgcolor='orange' #Simulation mode
|
||||||
if Audio.gcom2.ntxnow==1: tx1.configure(bg=bgcolor)
|
if Audio.gcom2.ntxnow==1: tx1.configure(bg=bgcolor)
|
||||||
elif Audio.gcom2.ntxnow==2: tx2.configure(bg=bgcolor)
|
elif Audio.gcom2.ntxnow==2: tx2.configure(bg=bgcolor)
|
||||||
elif Audio.gcom2.ntxnow==3: tx3.configure(bg=bgcolor)
|
elif Audio.gcom2.ntxnow==3: tx3.configure(bg=bgcolor)
|
||||||
|
Loading…
Reference in New Issue
Block a user