diff options
| author | Christoph Berg <myon@debian.org> | 2026-04-07 19:02:45 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-04-07 19:02:45 +0200 |
| commit | f647d78463c1250ce9c99af664615fafccf5e959 (patch) | |
| tree | 5b00428cef68aef1c9d407e2d4535687422419b6 /lib/sumsim.f90 | |
| parent | 0a13f1fdb9928b6d012569dd65f7f6ef18fac2f8 (diff) | |
New upstream version 3.0.0upstream/3.0.0
Diffstat (limited to 'lib/sumsim.f90')
| -rw-r--r--[-rwxr-xr-x] | lib/sumsim.f90 | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/lib/sumsim.f90 b/lib/sumsim.f90 index 24cca29a..594b8b20 100755..100644 --- a/lib/sumsim.f90 +++ b/lib/sumsim.f90 @@ -1,42 +1,42 @@ -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))
- fac=1.0/nargs
- iwave(1:npts)=nint(fac*wave(1:npts))
-
- open(12,file='000001_0000.wav',access='stream',status='unknown')
- write(12) h,iwave(1:npts)
- close(12)
-
-999 end program sumsim
+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)) + fac=1.0/nargs + iwave(1:npts)=nint(fac*wave(1:npts)) + + open(12,file='000001_0000.wav',access='stream',status='unknown') + write(12) h,iwave(1:npts) + close(12) + +999 end program sumsim |
