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

📄 synths.c,v

📁 lpc10-15为美军2400bps语音压缩标准的C语音源代码。
💻 C,V
📖 第 1 页 / 共 2 页
字号:
/* unvoiced frames, with no change in the coding rate, and no noticeable *//* quality difference in the decoded speech. *//* 	integer quant, nbits *//* *** Read/write: variables for debugging, not needed for LPC algorithm *//*  Current frame, Unstable frames, Output clip count, Max onset buffer, *//*    Debug listing detail level, Line count on listing page *//* nframe is not needed for an embedded LPC10 at all. *//* nunsfm is initialized to 0 in SETUP, and incremented in subroutine *//* ERROR, which is only called from RCCHK.  When LPC10 is embedded into *//* an application, I would recommend removing the call to ERROR in RCCHK, *//* and remove ERROR and nunsfm completely. *//* iclip is initialized to 0 in SETUP, and incremented in entry SWRITE in *//* sread.f.  When LPC10 is embedded into an application, one might want *//* to cause it to be incremented in a routine that takes the output of *//* SYNTHS and sends it to an audio device.  It could be optionally *//* displayed, for those that might want to know what it is. *//* maxosp is never initialized to 0 in SETUP, although it probably should *//* be, and it is updated in subroutine ANALYS.  I doubt that its value *//* would be of much interest to an application in which LPC10 is *//* embedded. *//* listl and lincnt are not needed for an embedded LPC10 at all. *//* 	integer nframe, nunsfm, iclip, maxosp, listl, lincnt *//* 	common /contrl/ fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug *//* 	common /contrl/ quant, nbits *//* 	common /contrl/ nframe, nunsfm, iclip, maxosp, listl, lincnt *//*       Parameters/constants *//*       Local variables that need not be saved *//*       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. */    /* Parameter adjustments */    if (voice) {	--voice;	}    if (rc) {	--rc;	}    if (speech) {	--speech;	}    /* Function Body */    buf = &(st->buf[0]);    buflen = &(st->buflen);/* Computing MAX */    i__1 = min(*pitch,156);    *pitch = max(i__1,20);    i__1 = contrl_1.order;    for (i__ = 1; i__ <= i__1; ++i__) {/* Computing MAX *//* Computing MIN */	r__2 = rc[i__];	r__1 = min(r__2,.99f);	rc[i__] = max(r__1,-.99f);    }    pitsyn_(&contrl_1.order, &voice[1], pitch, rms, &rc[1], &contrl_1.lframe, 	    ivuv, ipiti, rmsi, rci, &nout, &ratio, st);    if (nout > 0) {	i__1 = nout;	for (j = 1; j <= i__1; ++j) {/*             Add synthesized speech for pitch period J to the end of *//*             BUF. */	    irc2pc_(&rci[j * 10 - 10], pc, &contrl_1.order, &c_b2, &g2pass);	    bsynz_(pc, &ipiti[j - 1], &ivuv[j - 1], &buf[*buflen], &rmsi[j - 1]		    , &ratio, &g2pass, st);	    deemp_(&buf[*buflen], &ipiti[j - 1], st);	    *buflen += ipiti[j - 1];	}/*          Copy first MAXFRM samples from BUF to output array SPEECH *//*          (scaling them), and then remove them from the beginning of *//*          BUF. */	for (i__ = 1; i__ <= 180; ++i__) {	    speech[i__] = buf[i__ - 1] / 4096.f;	}	*k = 180;	*buflen += -180;	i__1 = *buflen;	for (i__ = 1; i__ <= i__1; ++i__) {	    buf[i__ - 1] = buf[i__ + 179];	}    }    return 0;} /* synths_ */@1.1log@Initial revision@text@d3 4a6 1$Log$d11 1a11 2extern int synths_(integer *voice, integer *pitch, real *rms, real *rc, real *speech, integer *k);extern int initsynths_(void);d46 4a49 1/* $Log: synths.f,v $ */d124 2a125 2/* Subroutine */ int synths_0_(int n__, integer *voice, integer *pitch, real *	rms, real *rc, real *speech, integer *k)d129 2a130 24    static real buf[360] = { 0.f,0.f,0.f,0.f,0.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f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,	    0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,	    0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,	    0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,	    0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,	    0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,	    0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f };    static integer buflen = 180;d139 1a139 1    extern /* Subroutine */ int deemp_(real *, integer *);d142 2a143 2    extern /* Subroutine */ int initdeemp_(void), bsynz_(real *, integer *, 	    integer *, real *, real *, real *, real *), irc2pc_(real *, real *a145 1    extern /* Subroutine */ int initbsynz_(void);d149 1a149 1	    integer *, real *), initpitsyn_(void);d152 4a155 1/* $Log: config.fh,v $ */d169 4a172 1/* $Log: contrl.fh,v $ */d288 2a289 3    switch(n__) {	case 1: goto L_initsynths;	}a290 7/* 	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 */d303 1a303 1	    ivuv, ipiti, rmsi, rci, &nout, &ratio);a311 16/* 	      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 */d313 4a316 7/* 	      IF (LISTL.GE.4) WRITE(FDEBUG,430) G2PASS, RATIO, 1.0, PC *//* 430	      FORMAT(T7,3F7.3,T50,10F8.1) */	    bsynz_(pc, &ipiti[j - 1], &ivuv[j - 1], &buf[buflen], &rmsi[j - 1]		    , &ratio, &g2pass);	    deemp_(&buf[buflen], &ipiti[j - 1]);	    buflen += ipiti[j - 1];d329 2a330 2	buflen += -180;	i__1 = buflen;a335 11L_initsynths:    for (i__ = 1; i__ <= 360; ++i__) {	buf[i__ - 1] = 0.f;    }    buflen = 180;/* Initialize local state inside of the following subroutines. */    initpitsyn_();    initbsynz_();    initdeemp_();    return 0;a336 13/* Subroutine */ int synths_(integer *voice, integer *pitch, real *rms, real *	rc, real *speech, integer *k){    return synths_0_(0, voice, pitch, rms, rc, speech, k);    }/* Subroutine */ int initsynths_(void){    return synths_0_(1, (integer *)0, (integer *)0, (real *)0, (real *)0, (	    real *)0, (integer *)0);    }@

⌨️ 快捷键说明

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