submult.f
上传用户:szhypcb168
上传日期:2007-01-06
资源大小:2187k
文件大小:2k
- program submultiple
- implicit undefined(a-z)
- c
- real pitch(256),quarter,third,half,minpitch
- integer i,j,submult(256,4)
- open (unit=10, file='pdelay.h')
- open (unit=11, status='new', file='submult.h')
- c
- c *read in pitch table pdelay.h
- read (10,*) pitch(1:256)
- c
- minpitch=pitch(1)
- c
- c *look for pitch submultiples
- do 400 i=256,1,-1
- c
- c *look for quarters
- if (pitch(i)/4 .ge. minpitch) then
- quarter=pitch(i)/4.
- do 100 j=2,256
- if (pitch(j) .gt. quarter) then
- submult(i,1)=submult(i,1)+1
- if (pitch(j)-quarter .le. quarter-pitch(j-1)) then
- submult(i,4)=j
- else
- submult(i,4)=j-1
- end if
- goto 101
- end if
- 100 continue
- 101 endif
- c
- c *look for thirds
- if(pitch(i)/3 .ge. minpitch) then
- third=pitch(i)/3.
- do 200 j=2,256
- if (pitch(j) .gt. third) then
- submult(i,1)=submult(i,1)+1
- if (pitch(j)-third .le. third-pitch(j-1)) then
- submult(i,3)=j
- else
- submult(i,3)=j-1
- end if
- goto 201
- end if
- 200 continue
- 201 endif
- c
- c *look for halves
- if(pitch(i)/2 .ge. minpitch) then
- half=pitch(i)/2.
- do 300 j=2,256
- if (pitch(j) .gt. half) then
- submult(i,1)=submult(i,1)+1
- if (pitch(j)-half .le. half-pitch(j-1)) then
- submult(i,2)=j
- else
- submult(i,2)=j-1
- end if
- goto 301
- end if
- 300 continue
- 301 endif
- print *,'index',i,'pitch',pitch(i),'has',submult(i,1),'submultiples'
- print *,'indicies',submult(i,2),submult(i,3),submult(i,4)
- print *,'multiples',pitch(submult(i,2)),pitch(submult(i,3)),
- & pitch(submult(i,4))
- print *,'----------------------------------------------------------'
- 400 continue
- do 500 i=1,256
- submult(i,2) = submult(i,2) - 1
- submult(i,3) = submult(i,3) - 1
- submult(i,4) = submult(i,4) - 1
- write (11,69)submult(i,1:4)
- 69 format (4i5)
- 500 continue
- close(10)
- close(11)
- stop
- end