summaryrefslogtreecommitdiff
path: root/lib/genwave.f90
diff options
context:
space:
mode:
Diffstat (limited to 'lib/genwave.f90')
-rw-r--r--lib/genwave.f9052
1 files changed, 52 insertions, 0 deletions
diff --git a/lib/genwave.f90 b/lib/genwave.f90
new file mode 100644
index 00000000..7db4cc7d
--- /dev/null
+++ b/lib/genwave.f90
@@ -0,0 +1,52 @@
+subroutine genwave(itone,nsym,nsps,nwave,fsample,hmod,f0,icmplx,cwave,wave)
+
+ real wave(nwave)
+ complex cwave(nwave)
+ integer hmod
+ integer itone(nsym)
+ logical ex
+ real*8 dt,phi,dphi,twopi,freq,baud
+
+ dt=1.d0/fsample
+ twopi=8.d0*atan(1.d0)
+ baud=fsample/nsps
+
+! Calculate the audio waveform
+ phi=0.d0
+ if(icmplx.le.0) wave=0.
+ if(icmplx.eq.1) cwave=0.
+ k=0
+ do j=1,nsym
+ freq=f0 + itone(j)*hmod*baud
+ dphi=twopi*freq*dt
+ do i=1,nsps
+ k=k+1
+ if(icmplx.eq.1) then
+ cwave(k)=cmplx(cos(phi),sin(phi))
+ else
+ wave(k)=sin(phi)
+ endif
+ phi=phi+dphi
+ if(phi.gt.twopi) phi=phi-twopi
+ enddo
+ enddo
+
+!### TEMPORARY code to allow transmitting both A and B submodes
+ inquire(file='Q65_Tx2',exist=ex)
+ if(ex) then
+ k=0
+ do j=1,nsym
+ freq=f0 + itone(j)*2.d0*hmod*baud + 500.d0
+ dphi=twopi*freq*dt
+ do i=1,nsps
+ k=k+1
+ wave(k)=0.5*(wave(k)+sin(phi))
+ phi=phi+dphi
+ if(phi.gt.twopi) phi=phi-twopi
+ enddo
+ enddo
+ endif
+!###
+
+ return
+end subroutine genwave