Remove ramp-up and ramp-down symbols. Instead, shape the first 1/8th of first and last real symbols.

This commit is contained in:
Steve Franke 2019-02-25 15:03:43 -06:00
parent ec2d5b6233
commit 3759198982
3 changed files with 19 additions and 15 deletions

View File

@ -6,7 +6,7 @@ program ft8sim_gfsk
use wavhdr
use packjt77
include 'ft8_params.f90' !Set various constants
parameter (NWAVE=(NN+2)*NSPS)
parameter (NWAVE=NN*NSPS)
type(hdr) h !Header for .wav file
character arg*12,fname*17
character msg37*37,msgsent37*37

View File

@ -27,7 +27,7 @@ subroutine gen_ft8wave(itone,nsym,nsps,fsample,f0,cwave,wave,icmplx,nwave)
endif
! Compute the smoothed frequency waveform.
! Length = (nsym+2)*nsps samples, zero-padded
! Length = (nsym+2)*nsps samples, first and last symbols extended
dphi_peak=twopi*hmod/real(nsps)
dphi=0.0
do j=1,nsym
@ -35,13 +35,16 @@ subroutine gen_ft8wave(itone,nsym,nsps,fsample,f0,cwave,wave,icmplx,nwave)
ie=ib+3*nsps-1
dphi(ib:ie) = dphi(ib:ie) + dphi_peak*pulse(1:3*nsps)*itone(j)
enddo
! Add dummy symbols at beginning and end with tone values equal to 1st and last symbol, respectively
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)
! Calculate and insert the audio waveform
phi=0.0
dphi = dphi + twopi*f0*dt !Shift frequency up by f0
wave=0.
k=0
do j=0,nwave-1
do j=nsps,nsps+nwave-1 !Don't include dummy symbols
k=k+1
if(icmplx.eq.0) then
wave(k)=sin(phi)
@ -51,19 +54,20 @@ subroutine gen_ft8wave(itone,nsym,nsps,fsample,f0,cwave,wave,icmplx,nwave)
phi=mod(phi+dphi(j),twopi)
enddo
! Compute the ramp-up and ramp-down symbols
! Apply envelope shaping to the first and last symbols
nramp=nint(nsps/8.0)
if(icmplx.eq.0) then
wave(1:nsps)=wave(1:nsps) * &
(1.0-cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0
k1=(nsym+1)*nsps+1
wave(k1:k1+nsps-1)=wave(k1:k1+nsps-1) * &
(1.0+cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0
wave(1:nramp)=wave(1:nramp) * &
(1.0-cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0
k1=nsym*nsps-nramp+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
else
cwave(1:nsps)=cwave(1:nsps) * &
(1.0-cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0
k1=(nsym+1)*nsps+1
cwave(k1:k1+nsps-1)=cwave(k1:k1+nsps-1) * &
(1.0+cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0
cwave(1:nramp)=cwave(1:nramp) * &
(1.0-cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0
k1=nsym*nsps-nramp+1
cwave(k1:k1+nramp-1)=cwave(k1:k1+nramp-1) * &
(1.0+cos(twopi*(/(i,i=0,nramp-1)/)/(2.0*nramp)))/2.0
endif
return

View File

@ -6871,7 +6871,7 @@ void MainWindow::transmit (double snr)
float fsample=48000.0;
float f0=ui->TxFreqSpinBox->value() - m_XIT;
int icmplx=0;
int nwave=(nsym+2)*nsps;
int nwave=nsym*nsps;
gen_ft8wave_(const_cast<int *>(itone),&nsym,&nsps,&fsample,&f0,foxcom_.wave,
foxcom_.wave,&icmplx,&nwave);