mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-10-27 02:50:39 -04:00 
			
		
		
		
	Add filtering of audio waveforms generated for Fox.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8316 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
		
							parent
							
								
									54e19459b5
								
							
						
					
					
						commit
						5cadbe26aa
					
				| @ -437,6 +437,7 @@ set (wsjt_FSRCS | ||||
|   lib/fmtmsg.f90 | ||||
|   lib/foldspec9f.f90 | ||||
|   lib/four2a.f90 | ||||
|   lib/ft8/foxfilt.f90 | ||||
|   lib/ft8/foxgen.f90 | ||||
|   lib/ft8/foxgen_wrap.f90 | ||||
|   lib/fqso_first.f90 | ||||
|  | ||||
							
								
								
									
										37
									
								
								lib/ft8/foxfilt.f90
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								lib/ft8/foxfilt.f90
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,37 @@ | ||||
| subroutine foxfilt(nslots,wave) | ||||
| 
 | ||||
|   parameter (NN=79,ND=58,KK=87,NSPS=4*1920) | ||||
|   parameter (NWAVE=NN*NSPS,NFFT=614400,NH=NFFT/2) | ||||
|   real wave(NWAVE) | ||||
|   real x(NFFT) | ||||
|   complex cx(0:NH) | ||||
|   equivalence (x,cx) | ||||
| 
 | ||||
|   x(1:NWAVE)=wave | ||||
|   x(NWAVE+1:)=0. | ||||
|   call four2a(x,NFFT,1,-1,0)              !r2c | ||||
|   df=48000.0/NFFT | ||||
|   fa=1800.0 - 0.5*6.25 | ||||
|   fb=1800.0 + 7.5*6.25 + (nslots-1)*60.0 | ||||
|   width=25.0 | ||||
|   ia2=nint(fa/df) | ||||
|   ib1=nint(fb/df) | ||||
|   ia1=nint(ia2-width/df) | ||||
|   ib2=nint(ib1+width/df) | ||||
|   pi=4.0*atan(1.0) | ||||
|   do i=ia1,ia2 | ||||
|      fil=(1.0 + cos(pi*df*(i-ia2)/width))/2.0 | ||||
|      cx(i)=fil*cx(i) | ||||
|   enddo | ||||
|   do i=ib1,ib2 | ||||
|      fil=(1.0 + cos(pi*df*(i-ib1)/width))/2.0 | ||||
|      cx(i)=fil*cx(i) | ||||
|   enddo | ||||
|   cx(0:ia1-1)=0. | ||||
|   cx(ib2+1:)=0. | ||||
| 
 | ||||
|   call four2a(cx,nfft,1,1,-1)                  !c2r | ||||
|   wave=x(1:NWAVE)/nfft | ||||
| 
 | ||||
|   return | ||||
| end subroutine foxfilt | ||||
| @ -28,9 +28,9 @@ subroutine foxgen() | ||||
|   integer*1 msgbits(KK),codeword(3*ND),msgbits2 | ||||
|   integer*1, target:: i1Msg8BitBytes(11) | ||||
|   integer*1, target:: mycall | ||||
|   real x(NFFT),y(NFFT) | ||||
|   real x(NFFT) | ||||
|   real*8 dt,twopi,f0,fstep,dfreq,phi,dphi | ||||
|   complex cx(0:NH),cy(0:NH) | ||||
|   complex cx(0:NH) | ||||
|   common/foxcom/wave(NWAVE),nslots,i3bit(5),cmsg(5),mycall(6) | ||||
|   common/foxcom2/itone2(NN),msgbits2(KK) | ||||
|   equivalence (x,cx),(y,cy) | ||||
| @ -41,9 +41,10 @@ subroutine foxgen() | ||||
|   dfreq=6.25d0 | ||||
|   dt=1.d0/48000.d0 | ||||
|   twopi=8.d0*atan(1.d0) | ||||
|   wave=0. | ||||
|   mygrid='      ' | ||||
|   irpt=0 | ||||
|   nplot=0 | ||||
|   wave=0. | ||||
| 
 | ||||
|   do n=1,nslots | ||||
|      i3b=i3bit(n) | ||||
| @ -72,7 +73,6 @@ subroutine foxgen() | ||||
| 1003    format(11b8) | ||||
|         icrc12=crc12(c_loc(i1Msg8BitBytes),11) | ||||
| 
 | ||||
|         print*,'BB',icrc10,nrpt,i3b,icrc12 | ||||
|         write(cbits,1001) msgbits(1:56),icrc10,nrpt,i3b,icrc12 | ||||
|         read(cbits,1002) msgbits | ||||
| 
 | ||||
| @ -109,47 +109,30 @@ subroutine foxgen() | ||||
|         enddo | ||||
|      enddo | ||||
|   enddo | ||||
| 
 | ||||
|   sqx=0. | ||||
|   do i=1,NWAVE | ||||
|      sqx=sqx + wave(i)*wave(i) | ||||
|   enddo | ||||
|   sigmax=sqrt(sqx/NWAVE) | ||||
|   wave=wave/sigmax                    !Force rms=1.0 | ||||
| 
 | ||||
|   do i=1,NWAVE | ||||
|      wave(i)=h1(wave(i))              !Compress the waveform | ||||
|   enddo | ||||
|   kz=k | ||||
|    | ||||
|   fac=1.0/maxval(abs(wave))           !Set maxval = 1.0 | ||||
|   wave=fac*wave | ||||
|   peak1=maxval(abs(wave)) | ||||
|   wave=wave/peak1 | ||||
| !  call plotspec(1,wave)          !Plot the spectrum | ||||
| 
 | ||||
|   if(NWAVE.ne.-99) go to 100             !### Omit filtering, for now ### | ||||
| 
 | ||||
|   x(1:k)=wave | ||||
|   x(k+1:)=0. | ||||
|   call four2a(x,nfft,1,-1,0) | ||||
| 
 | ||||
|   nadd=64 | ||||
|   k=0 | ||||
|   df=48000.0/NFFT | ||||
|   rewind(29) | ||||
|   do i=1,NH/nadd - 1 | ||||
|      sx=0. | ||||
| !     sy=0. | ||||
|      do j=1,nadd | ||||
|         k=k+1 | ||||
|         sx=sx + real(cx(k))**2 + aimag(cx(k))**2 | ||||
| !        sy=sy + real(cy(k))**2 + aimag(cy(k))**2 | ||||
|      enddo | ||||
|      freq=df*(k-nadd/2+0.5) | ||||
|      write(29,1022) freq,sx,sy,db(sx)-90.0,db(sy)-90.0 | ||||
| 1022 format(f10.3,2e12.3,2f10.3) | ||||
|      if(freq.gt.3000.0) exit | ||||
|   enddo | ||||
|   flush(29) | ||||
| 
 | ||||
| 100 continue | ||||
| ! Apply compression | ||||
| !  rms=sqrt(dot_product(wave,wave)/kz) | ||||
| !  wave=wave/rms | ||||
| !  do i=1,NWAVE | ||||
| !     wave(i)=h1(wave(i)) | ||||
| !  enddo | ||||
| !  peak2=maxval(abs(wave)) | ||||
| !  wave=wave/peak2 | ||||
|    | ||||
| !  call plotspec(2,wave)          !Plot the spectrum | ||||
|    | ||||
|   call foxfilt(nslots,wave) | ||||
|   peak3=maxval(abs(wave)) | ||||
|   wave=wave/peak3 | ||||
| 
 | ||||
| !  call plotspec(3,wave)          !Plot the spectrum | ||||
|    | ||||
|   return | ||||
| end subroutine foxgen | ||||
| 
 | ||||
| !include 'plotspec.f90' | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user