summaryrefslogtreecommitdiff
path: root/lib/superfox
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2024-07-20 08:39:32 +0000
committerChristoph Berg <myon@debian.org>2024-07-20 08:39:32 +0000
commitfbaeaa72f63f22bf0b53d634f6809cbdfbb46c9f (patch)
tree34bf121b8a6f02b43542bd554d59ba6191cd1359 /lib/superfox
parent93f7198f9c2864ef9630cc0cc9e46d6cc1933aa9 (diff)
New upstream version 2.7.0~rc6+dfsgupstream/2.7.0_rc6+dfsg
Diffstat (limited to 'lib/superfox')
-rwxr-xr-xlib/superfox/sfox_wave.f9040
-rwxr-xr-xlib/superfox/sfox_wave_gfsk.f9078
2 files changed, 118 insertions, 0 deletions
diff --git a/lib/superfox/sfox_wave.f90 b/lib/superfox/sfox_wave.f90
new file mode 100755
index 00000000..2e39a1c6
--- /dev/null
+++ b/lib/superfox/sfox_wave.f90
@@ -0,0 +1,40 @@
+subroutine sfox_wave(fname)
+
+! Called by WSJT-X when it's time for SuperFox to transmit. Reads array
+! itone(1:151) from disk file 'sfox_2.dat' in the writable data directory.
+
+ parameter (NWAVE=(160+2)*134400*4) !Max WSJT-X waveform (FST4-1800 at 48kHz)
+ parameter (NN=151,NSPS=1024)
+ character*(*) fname
+ integer itone(151)
+ real*8 dt,twopi,f0,baud,phi,dphi
+
+ common/foxcom/wave(NWAVE)
+
+ wave=0.
+ open(25,file=trim(fname),status='unknown',err=999)
+ read(25,'(20i4)',err=999,end=999) itone
+ close(25)
+ if(itone(1).lt.0 .or. itone(1).gt.128) go to 999
+
+! Generate the SuperFox waveform.
+
+ dt=1.d0/48000.d0
+ twopi=8.d0*atan(1.d0)
+ f0=750.0d0
+ phi=0.d0
+ baud=12000.d0/NSPS
+ k=0
+ do j=1,NN
+ f=f0 + baud*mod(itone(j),128)
+ dphi=twopi*f*dt
+ do ii=1,4*NSPS
+ k=k+1
+ phi=phi+dphi
+ xphi=phi
+ wave(k)=sin(xphi)
+ enddo
+ enddo
+
+999 return
+end subroutine sfox_wave
diff --git a/lib/superfox/sfox_wave_gfsk.f90 b/lib/superfox/sfox_wave_gfsk.f90
new file mode 100755
index 00000000..c4e30d75
--- /dev/null
+++ b/lib/superfox/sfox_wave_gfsk.f90
@@ -0,0 +1,78 @@
+subroutine sfox_wave_gfsk(fname)
+
+! Called by WSJT-X when it's time for SuperFox to transmit. Reads array
+! itone(1:151) from disk file 'sfox_2.dat' in the writable data directory.
+! Generates a GFSK waveform with short ramp-up and ramp-down symbols of
+! duration NSPS/BT at the beginning and end of the waveform.
+
+ parameter (NWAVE=(160+2)*134400*4) !Max WSJT-X waveform (FST4-1800 at 48kHz)
+ parameter (NSYM=151,NSPS=1024*4)
+ parameter (NPTS=(NSYM+2)*NSPS)
+ parameter (BT=8)
+ character*(*) fname
+ integer itone(151)
+ real*8 dt,twopi,f0,baud,phi,dphi_peak
+ real*8 dphi(0:NPTS-1)
+ real*8 pulse(3*NSPS)
+ logical first/.true./
+
+ common/foxcom/wave(NWAVE)
+ save first,twopi,dt,hmod,dphi_peak,pulse
+
+ if(first) then
+ fsample=48000.0
+ twopi=8.d0*atan(1.d0)
+ dt=1.d0/fsample
+ hmod=1.0
+ dphi_peak=twopi*hmod/real(NSPS)
+ do i=1,3*NSPS
+ tt=(i-1.5*NSPS)/real(NSPS)
+ pulse(i)=gfsk_pulse(BT,tt)
+ enddo
+ first=.false.
+ endif
+ wave=0.
+
+ open(25,file=trim(fname),status='unknown',err=999)
+ read(25,'(20i4)',err=999,end=999) itone
+ close(25)
+ if(itone(1).lt.0 .or. itone(1).gt.128) go to 999
+
+! Generate the SuperFox waveform.
+
+ dphi=0.d0
+ do j=1,NSYM
+ ib=(j-1)*NSPS
+ ie=ib+3*NSPS-1
+ dphi(ib:ie)=dphi(ib:ie)+dphi_peak*pulse(1:3*NSPS)*itone(j)
+ enddo
+ dphi(0:2*NSPS-1)=dphi(0:2*NSPS-1)+dphi_peak*itone(1)*pulse(NSPS+1:3*NSPS)
+ dphi(NSYM*NSPS:(NSYM+2)*NSPS-1)=dphi(NSYM*NSPS:(NSYM+2)*NSPS-1)+dphi_peak*itone(NSYM)*pulse(1:2*NSPS)
+
+ phi=0.d0
+ f0=750.0d0
+ dphi=dphi+twopi*f0*dt
+ k=0
+ do j=1,NSPS*(NSYM+2)-1
+ k=k+1
+ wave(k)=sin(phi)
+ phi=phi+dphi(j)
+ enddo
+
+! Add raised cosine ramps at the beginning and end of the waveform.
+! Since the modulator expects an integral number of symbols, dummy
+! symbols are added to the beginning and end of the waveform to
+! hold the ramps. All but nramp of the samples in each dummy
+! symbol will be zero.
+
+ nramp=NSPS/BT
+ wave(1:NSPS-nramp)=0.0
+ wave(NSPS-nramp+1:NSPS)=wave(NSPS-nramp+1:NSPS) * &
+ (1.0-cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0
+ k1=(NSYM+1)*NSPS+1
+ wave(k1:k1+nramp-1)=wave(k1:k1+nramp-1) * &
+ (1.0+cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0
+ wave(k1+nramp:NPTS)=0.0
+
+999 return
+end subroutine sfox_wave_gfsk