mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 13:48:42 -05:00
Add a program to sum together several .wav files of simulated data.
This commit is contained in:
parent
9709b19585
commit
0a14984d6a
@ -1295,6 +1295,9 @@ target_link_libraries (jt4sim wsjt_fort wsjt_cxx)
|
||||
add_executable (jt65sim lib/jt65sim.f90 wsjtx.rc)
|
||||
target_link_libraries (jt65sim wsjt_fort wsjt_cxx)
|
||||
|
||||
add_executable (sumsim lib/sumsim.f90 wsjtx.rc)
|
||||
target_link_libraries (sumsim wsjt_fort wsjt_cxx)
|
||||
|
||||
add_executable (qra64sim lib/qra/qra64/qra64sim.f90 wsjtx.rc)
|
||||
target_link_libraries (qra64sim wsjt_fort wsjt_cxx)
|
||||
|
||||
|
41
lib/sumsim.f90
Normal file
41
lib/sumsim.f90
Normal file
@ -0,0 +1,41 @@
|
||||
program sumsim
|
||||
|
||||
! Sum a number of *.wav files so that multiple signals are present
|
||||
|
||||
use wavhdr
|
||||
parameter (NMAX=60*12000)
|
||||
type(hdr) h !Header for the .wav file
|
||||
integer*2 iwave(NMAX) !i*2 data
|
||||
real wave(NMAX) !r*4 data
|
||||
character*80 fname
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.lt.1) then
|
||||
print*,'Usage: sumsim file1 [file2, ...]'
|
||||
go to 999
|
||||
endif
|
||||
wave=0.
|
||||
|
||||
do ifile=1,nargs
|
||||
call getarg(ifile,fname)
|
||||
open(10,file=trim(fname),status='old',access='stream')
|
||||
read(10) h
|
||||
npts=h%ndata/2
|
||||
nfsample=h%nsamrate
|
||||
read(10) iwave(1:npts)
|
||||
n=len(trim(fname))
|
||||
wave(1:npts)=wave(1:npts)+iwave(1:npts)
|
||||
rms=sqrt(dot_product(wave(1:npts),wave(1:npts))/npts)
|
||||
write(*,1000) ifile,npts,float(npts)/nfsample,rms,fname(n-14:n)
|
||||
1000 format(i3,i8,f6.1,f10.3,2x,a15)
|
||||
close(10)
|
||||
enddo
|
||||
|
||||
fac=1.0/sqrt(float(nargs))
|
||||
iwave(1:npts)=nint(fac*wave(1:npts))
|
||||
|
||||
open(12,file='000000_0000.wav',access='stream',status='unknown')
|
||||
write(12) h,iwave(1:npts)
|
||||
close(12)
|
||||
|
||||
999 end program sumsim
|
Loading…
Reference in New Issue
Block a user