📄 pitsyn.f,v
字号:
* concrete. If LFRAME is ever changed, keep this in mind. Similarly,* 135's are 3*LFRAME/4, and 45's are LFRAME/4. If LFRAME is not a* multiple of 4, then the 135 for NL-JSAMP is actually LFRAME-LFRAME/4,* and the 45 for NL-JSAMP is actually LFRAME-3*LFRAME/4.* * Note that LSAMP-JSAMP is given as the variable. This was just for* brevity, to avoid adding "+JSAMP" to all of the column entries.* Similarly for NL-JSAMP.* * Variable | 000 001 011,010 111 110 100,101* ------------+--------------------------------------------------* ISTART | 1 NL+1 NL+1 1 1 1* LSAMP-JSAMP | 180 180 180 180 135 45* IPITO | 45 PITCH PITCH oldPITCH oldPITCH oldPITCH* SLOPE | 0 0 0 seebelow 0 0* JUSED | 0 NL NL 0 0 0* PITCH | 45 PITCH PITCH PITCH PITCH PITCH* NL-JSAMP | -- 135 45 -- -- --* VFLAG | 0 0 0 0 1 1* NOUT | 0 2 2 0 0 0* IVOICE | 0 1 1 1 1 1* * while_loop | once once once once twice twice* * ISTART | -- -- -- -- JUSED+1 JUSED+1* LSAMP-JSAMP | -- -- -- -- 180 180* IPITO | -- -- -- -- oldPITCH oldPITCH* SLOPE | -- -- -- -- 0 0* JUSED | -- -- -- -- ?? ??* PITCH | -- -- -- -- PITCH PITCH* NL-JSAMP | -- -- -- -- -- --* VFLAG | -- -- -- -- 0 0* NOUT | -- -- -- -- ?? ??* IVOICE | -- -- -- -- 0 0* * * UVPIT is always 0.0 on the first pass through the DO WHILE (.TRUE.)* loop below.* * The only possible non-0 value of SLOPE (in column 111) is* (PITCH-IPITO)/FLOAT(LSAMP)* * Column 101 is identical to 100. Any good properties we can prove* for 100 will also hold for 101. Similarly for 010 and 011.* * SYNTHS calls this subroutine with PITCH restricted to the range 20 to* 156. IPITO is similarly restricted to this range, after the first* call. IP below is also restricted to this range, given the* definitions of IPITO, SLOPE, UVPIT, and that I is in the range ISTART* to LSAMP.* DO WHILE (.TRUE.)* * JUSED is the total length of all pitch periods currently* in the output arrays, in samples.* * An invariant of the DO I = ISTART,LSAMP loop below, under* the condition that IP is always in the range 1 through* MAXPIT, is:* * (I - MAXPIT) .LE. JUSED .LE. (I-1)* * Note that the final value of I is LSAMP+1, so that after* the DO loop is complete, we know:* * (LSAMP - MAXPIT + 1) .LE. JUSED .LE. LSAMP* DO I = ISTART,LSAMP IP = IPITO + SLOPE*I + .5 IF (UVPIT .NE. 0.0) IP = UVPIT IF (IP .LE. I-JUSED) THEN NOUT = NOUT + 1* * The following check is no longer necessary, now that* we can prove that NOUT will never go over 16.* * IF (NOUT .GT. 16) STOP 'PITSYN: too many epochs'* IPITI(NOUT) = IP PITCH = IP IVUV(NOUT) = IVOICE JUSED = JUSED + IP PROP = (JUSED-IP/2)/FLOAT(LSAMP) DO J = 1,ORDER ALRO = ALOG((1+RCO(J))/(1-RCO(J))) ALRN = ALOG((1+RC(J))/(1-RC(J))) XXY = ALRO + PROP*(ALRN-ALRO) XXY = EXP(XXY) RCI(J,NOUT) = (XXY-1)/(XXY+1) END DO RMSI(NOUT) = ALOG(RMSO) + PROP*(ALOG(RMS)-ALOG(RMSO)) RMSI(NOUT) = EXP(RMSI(NOUT)) END IF END DO IF (VFLAG .NE. 1) GOTO 100* * I want to prove what range UVPIT must lie in after the* assignments to it below. To do this, I must determine* what range (LSAMP-ISTART) must lie in, after the* assignments to ISTART and LSAMP below.* * Let oldLSAMP be the value of LSAMP at this point in the* execution. This is 135+JSAMP in state 110, or 45+JSAMP in* states 100 or 101.* * Given the loop invariant on JUSED above, we know that:* * (oldLSAMP - MAXPIT + 1) .LE. JUSED .LE. oldLSAMP* * ISTART is one more than this.* * Let newLSAMP be the value assigned to LSAMP below. This* is 180+JSAMP. Thus (newLSAMP-oldLSAMP) is either 45 or* 135, depending on the state.* * Thus, the range of newLSAMP-ISTART is:* * (newLSAMP-(oldLSAMP+1)) .LE. newLSAMP-ISTART* .LE. (newLSAMP-(oldLSAMP - MAXPIT + 2))* * or:* * 46 .LE. newLSAMP-ISTART .LE. 133+MAXPIT .EQ. 289* * Therefore, UVPIT is in the range 23 to 144 after the first* assignment to UVPIT below, and after the conditional* assignment, it is in the range 23 to 90.* * The important thing is that it is in the range 20 to 156,* so that in the loop above, IP is always in this range.* VFLAG = 0 ISTART = JUSED + 1 LSAMP = LFRAME + JSAMP SLOPE = 0 IVOICE = 0 UVPIT = (LSAMP-ISTART)/2 IF (UVPIT .GT. 90) UVPIT = UVPIT/2 RMSO = RMS DO I = 1,ORDER RC(I) = YARC(I) RCO(I) = YARC(I) END DO END DO100 JSAMP = LSAMP - JUSED END IF* Given that the maximum pitch period MAXPIT .LT. LFRAME (this is* currently true on every call, since SYNTHS always sets* LFRAME=180), NOUT will always be .GE. 1 at this point. IF (NOUT .NE. 0) THEN IVOICO = VOICE(2) IPITO = PITCH RMSO = RMS DO I = 1,ORDER RCO(I) = RC(I) END DO END IF RETURN ENTRY INITPITSYN () RMSO = 1. FIRST = .TRUE. RETURN END@1.1log@Initial revision@text@d5 4a8 1* $Log$d14 1a14 1* Inputs:d17 3d21 5a25 1* RMS - Energyd27 4a30 2* LFRAME - Length of speech buffer* Outputs:d32 3d39 5d45 1d50 20a69 6 INTEGER ORDER, VOICE(2), PITCH, LFRAME INTEGER IVUV(11), IPITI(11), NOUT REAL RMS, RC(ORDER), RMSI(11), RCI(ORDER,11), RATIO REAL RCO(MAXORD), YARC(MAXORD) INTEGER I, J, LSAMP, IP, IPITO, ISTART, IVOICE, IVOICO INTEGER JSAMP, JUSED, NLd71 33a103 1 REAL RMSO, SLOPE, UVPIT, VFLAG, XXYa104 1 DATA FIRST/.TRUE./d106 8a113 2 IF (RMS.LT.1) RMS = 1 IF (RMSO.LT.1) RMSO = 1d119 1a119 1 IF (IVOICE.EQ.0) PITCH = LFRAME/4d122 8d146 2a147 2 IF ((VOICE(1).EQ.IVOICO).AND.(VOICE(2).EQ.VOICE(1))) THEN IF (VOICE(2).EQ.0) THENd151 1a151 1 IF( RATIO.GT.8 ) RMSO = RMSd157 2a158 2 IF (IVOICO.NE.1) THEN IF (IVOICO.EQ.VOICE(1)) THENd183 1a183 1 IF (IVOICO.NE.VOICE(1)) THENd199 65d265 15d282 2a283 2 IF (UVPIT.NE.0.0) IP = UVPIT IF (IP.LE.I-JUSED) THENd285 6a290 1 IF (NOUT .GT. 11) STOP 'PITSYN: too many epochs'd307 37a343 1 IF (VFLAG.NE.1) GOTO 100d350 1a350 1 IF(UVPIT.GT.90) UVPIT = UVPIT/2d359 6a364 1 IF (NOUT.NE.0) THENd373 9@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -