⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 synths.f,v

📁 lpc10-15为美军2400bps语音压缩标准的C语音源代码。
💻 F,V
字号:
head	1.5;access;symbols;locks; strict;comment	@* @;1.5date	96.03.26.19.31.58;	author jaf;	state Exp;branches;next	1.4;1.4date	96.03.25.19.41.01;	author jaf;	state Exp;branches;next	1.3;1.3date	96.03.25.19.20.10;	author jaf;	state Exp;branches;next	1.2;1.2date	96.03.22.00.18.18;	author jaf;	state Exp;branches;next	1.1;1.1date	96.02.07.14.49.44;	author jaf;	state Exp;branches;next	;desc@@1.5log@Commented out trace statements.@text@********************************************************************	SYNTHS Version 54** $Log: synths.f,v $* Revision 1.4  1996/03/25  19:41:01  jaf* Changed so that MAXFRM samples are always returned in the output array* SPEECH.** This required delaying the returned samples by MAXFRM sample times,* and remembering any "left over" samples returned by PITSYN from one* call of SYNTHS to the next.** Changed size of SPEECH from 2*MAXFRM to MAXFRM.  Removed local* variable SOUT.  Added local state variables BUF and BUFLEN.** Revision 1.3  1996/03/25  19:20:10  jaf* Added comments about the range of possible return values for argument* K, and increased the size of the arrays filled in by PITSYN from 11 to* 16, as has been already done inside of PITSYN.** Revision 1.2  1996/03/22  00:18:18  jaf* Added comments explaining meanings of input and output parameters, and* indicating which array indices can be read or written.** Added entry INITSYNTHS, which does nothing except call the* corresponding initialization entries for subroutines PITSYN, BSYNZ,* and DEEMP.** Revision 1.1  1996/02/07 14:49:44  jaf* Initial revision********************************************************************* * The note below is from the distributed version of the LPC10 coder.* The version of the code below has been modified so that SYNTHS always* has a constant frame length output of MAXFRM.* * Also, BSYNZ and DEEMP need not be modified to work on variable* positions within an array.  It is only necessary to pass the first* index desired as the array argument.  What actually gets passed is the* address of that array position, which the subroutine treats as the* first index of the array.* * This technique is used in subroutine ANALYS when calling PREEMP, so it* appears that multiple people wrote different parts of this LPC10 code,* and that they didn't necessarily have equivalent knowledge of Fortran* (not surprising).* *  NOTE: There is excessive buffering here, BSYNZ and DEEMP should be*        changed to operate on variable positions within SOUT.  Also,*        the output length parameter is bogus, and PITSYN should be*        rewritten to allow a constant frame length output.** Input:*  VOICE  - Half frame voicing decisions*           Indices 1 through 2 read.* Input/Output:*  PITCH  - Pitch*           PITCH is restricted to range 20 to 156, inclusive,*           before calling subroutine PITSYN, and then PITSYN*           can modify it further under some conditions.*  RMS    - Energy*           Only use is for debugging, and passed to PITSYN.*           See comments there for how it can be modified.*  RC     - Reflection coefficients*           Indices 1 through ORDER restricted to range -.99 to .99,*           before calling subroutine PITSYN, and then PITSYN*           can modify it further under some conditions.* Output:*  SPEECH - Synthesized speech samples.*           Indices 1 through the final value of K are written.*  K      - Number of samples placed into array SPEECH.*           This is always MAXFRM.*           	SUBROUTINE SYNTHS(VOICE, PITCH, RMS, RC, SPEECH, K)	INCLUDE 'config.fh'	INCLUDE 'contrl.fh'*       Arguments	INTEGER VOICE(2), PITCH	REAL RMS, RC(ORDER), SPEECH(MAXFRM)	INTEGER K*       Parameters/constants	REAL GPRIME	PARAMETER (GPRIME = .7)	INTEGER TWOFRM	PARAMETER (TWOFRM = 2*MAXFRM)*       Local variables that need not be saved	INTEGER I, J, NOUT	REAL RATIO, G2PASS	REAL PC(MAXORD)	INTEGER IPITI(16), IVUV(16)	REAL RCI(MAXORD,16), RMSI(16)*       Local state*       BUF is a buffer of speech samples that would have been returned*       by the older version of SYNTHS, but the newer version doesn't,*       so that the newer version can always return MAXFRM samples on*       every call.  This has the effect of delaying the return of*       samples for one additional frame time.*       *       Indices 1 through BUFLEN contain samples that are left over from*       the last call to SYNTHS.  Given the way that PITSYN works,*       BUFLEN should always be in the range MAXFRM-MAXPIT+1 through*       MAXFRM, inclusive, after a call to SYNTHS is complete.*       *       On the first call to SYNTHS (or the first call after*       reinitializing with the entry INITSYNTHS), BUFLEN is MAXFRM, and*       a frame of silence is always returned.	REAL BUF(TWOFRM)	INTEGER BUFLEN	SAVE BUF, BUFLEN	DATA BUF /TWOFRM*0./, BUFLEN /MAXFRM/*	IF (LISTL.GE.3) THEN*	   WRITE(FDEBUG,400) NFRAME, VOICE, PITCH, RMS, RC*400	   FORMAT(1X/' SYNTHESIS DATA -- FRAME',I6,*     1    T32,2I3,I6,1X,F5.0,10F8.3/)*	   IF (LISTL.GE.4) WRITE(FDEBUG,410)*410	   FORMAT(' EPOCH  G2PASS  RATIO PSCALE')*	END IF	pitch = max(min(pitch,156),20)	do i = 1, order	    rc(i) = max(min(rc(i),.99),-.99)	end do	CALL PITSYN(ORDER, VOICE, PITCH, RMS, RC, LFRAME,      1              IVUV, IPITI, RMSI, RCI, NOUT, RATIO)	IF (NOUT.GT.0) THEN	   DO J = 1,NOUT*             *             Add synthesized speech for pitch period J to the end of*             BUF.*             *	      IF (LISTL.GE.3) THEN*	         IF (LISTL.EQ.3) THEN*	            WRITE(FDEBUG,420) J, NOUT, IVUV(J), IPITI(J), RMSI(J),*     1             (RCI(I,J),I=1,ORDER)*420	            FORMAT(1X,'PITSYN EPOCH ',I2,' OF ',I2,T32,I4,I8,1X,*     1             F5.0,T50,10F8.3)*	         ELSE*	            WRITE(FDEBUG,422) J, NOUT, IVUV(J), IPITI(J), RMSI(J),*     1             (RCI(I,J),I=1,ORDER)*422	            FORMAT(1X,I2,'/',I2,T32,I4,I8,1X,*     1             F5.0,T50,10F8.3)*	         END IF*	      END IF	      CALL IRC2PC(RCI(1,J), PC, ORDER, GPRIME, G2PASS)*	      IF (LISTL.GE.4) WRITE(FDEBUG,430) G2PASS, RATIO, 1.0, PC*430	      FORMAT(T7,3F7.3,T50,10F8.1)	      CALL BSYNZ(PC, IPITI(J), IVUV(J), BUF(BUFLEN+1), RMSI(J),     1       RATIO, G2PASS)	      CALL DEEMP(BUF(BUFLEN+1), IPITI(J))	      BUFLEN = BUFLEN + IPITI(J)	   END DO*          *          Copy first MAXFRM samples from BUF to output array SPEECH*          (scaling them), and then remove them from the beginning of*          BUF.*          	   DO I = 1,MAXFRM	      SPEECH(I) = BUF(I) / 4096.	   END DO	   K = MAXFRM	   BUFLEN = BUFLEN - MAXFRM	   DO I = 1,BUFLEN	      BUF(I) = BUF(MAXFRM+I)	   END DO	END IF	RETURN	ENTRY INITSYNTHS ()	DO I = 1,TWOFRM	   BUF(I) = 0.	END DO	BUFLEN = MAXFRM* Initialize local state inside of the following subroutines.	CALL INITPITSYN ()	CALL INITBSYNZ ()	CALL INITDEEMP ()	RETURN	END@1.4log@Changed so that MAXFRM samples are always returned in the output arraySPEECH.This required delaying the returned samples by MAXFRM sample times,and remembering any "left over" samples returned by PITSYN from onecall of SYNTHS to the next.Changed size of SPEECH from 2*MAXFRM to MAXFRM.  Removed localvariable SOUT.  Added local state variables BUF and BUFLEN.@text@d6 11d48 1a48 1* and that they didn't necessarily have equivalent knowledge Fortrand127 7a133 7	IF (LISTL.GE.3) THEN	   WRITE(FDEBUG,400) NFRAME, VOICE, PITCH, RMS, RC400	   FORMAT(1X/' SYNTHESIS DATA -- FRAME',I6,     1    T32,2I3,I6,1X,F5.0,10F8.3/)	   IF (LISTL.GE.4) WRITE(FDEBUG,410)410	   FORMAT(' EPOCH  G2PASS  RATIO PSCALE')	END IFd148 15a162 13	      IF (LISTL.GE.3) THEN	         IF (LISTL.EQ.3) THEN	            WRITE(FDEBUG,420) J, NOUT, IVUV(J), IPITI(J), RMSI(J),     1             (RCI(I,J),I=1,ORDER)420	            FORMAT(1X,'PITSYN EPOCH ',I2,' OF ',I2,T32,I4,I8,1X,     1             F5.0,T50,10F8.3)	         ELSE	            WRITE(FDEBUG,422) J, NOUT, IVUV(J), IPITI(J), RMSI(J),     1             (RCI(I,J),I=1,ORDER)422	            FORMAT(1X,I2,'/',I2,T32,I4,I8,1X,     1             F5.0,T50,10F8.3)	         END IF	      END IFd164 4a167 2	      IF (LISTL.GE.4) WRITE(FDEBUG,430) G2PASS, RATIO, 1.0, PC430	      FORMAT(T7,3F7.3,T50,10F8.1)@1.3log@Added comments about the range of possible return values for argumentK, and increased the size of the arrays filled in by PITSYN from 11 to16, as has been already done inside of PITSYN.@text@d6 5d24 16a39 1*d64 1a64 7*           *           After fairly careful examination of PITSYN, I have*           determined that the total number of samples returned from N*           calls to PITSYN is in the range N*MAXFRM-MAXPIT+1 through*           N*MAXFRM, inclusive.  This implies that on any single call,*           the number of samples returned is in the range*           MAXFRM-MAXPIT+1 = 25 through MAXFRM+MAXPIT-1 = 335.d73 1a73 1	REAL RMS, RC(ORDER), SPEECH(2*MAXFRM)d80 2d87 1a87 1	REAL PC(MAXORD), SOUT(MAXFRM)d91 24a128 1	K = 0d133 4d153 1a153 1	      CALL BSYNZ(PC, IPITI(J), IVUV(J), SOUT, RMSI(J),d155 15a169 5	      CALL DEEMP(SOUT, IPITI(J))	      DO I = 1,IPITI(J)	         K = K + 1	         SPEECH(K) = SOUT(I) / 4096.	      END DOd177 5@1.2log@Added comments explaining meanings of input and output parameters, andindicating which array indices can be read or written.Added entry INITSYNTHS, which does nothing except call thecorresponding initialization entries for subroutines PITSYN, BSYNZ,and DEEMP.@text@d6 8d44 8a51 2*           What range of values can this have?  I don't know yet.*d72 2a73 2	INTEGER IPITI(11), IVUV(11)	REAL RCI(MAXORD,11), RMSI(11)d76 1a76 1	IF(LISTL.GE.3) THENd80 1a80 1	   IF(LISTL.GE.4) WRITE(FDEBUG,410)d92 1a92 1	IF(NOUT.GT.0) THENd94 2a95 2	      IF(LISTL.GE.3) THEN	         IF(LISTL.EQ.3) THENd108 1a108 1	      IF(LISTL.GE.4) WRITE(FDEBUG,430) G2PASS, RATIO, 1.0, PC@1.1log@Initial revision@text@d5 4a8 1* $Log$d15 22a36 1*        rewritten to allow a constant frame length outputd41 3d46 10a55 1	INTEGER I, J, K, NOUT, IPITI(11), IVUV(11)d57 4a60 3	REAL RCI(MAXORD,11), RMSI(11), PC(MAXORD), SOUT(MAXFRM)	REAL GPRIME	DATA GPRIME/.7/d107 12@

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -