Capsim Block Documentation
This routine produces the lpcanalysis of the input buffer. The samples are analyzed a window at a time.
iip_Curve_Pt curveTime_P; iip_Curve_Pt curve_P; int samples; int numberPoints; int i,j,ii; float tmp; complex val; float wind; char title1[80]; char fname[80]; char curveSubTitle[80]; float* mag_P; float* phase_P; FILE *time_F; FILE *freq_F; |
---|
/* store as state the number of input/output buffers */ if((numberInputBuffers = NO_INPUT_BUFFERS()) <= 0) { fprintf(stderr,"lpcanalysis: no inputs connected\n"); return(1); } if(numberInputBuffers > 1) { fprintf(stderr,"lpcanalysis: only one input allowed \n"); return(2); } if((numberOutputBuffers = NO_OUTPUT_BUFFERS()) > numberInputBuffers) { fprintf(stderr,"lpcanalysis: too many outputs connected\n"); return(3); } if(samplingRate) dx=1.0/samplingRate; else dx=1.0; if (control) { /* * allocate arrays */ xpts = (float* )calloc(BLOCK_SIZE,sizeof(float)); ypts = (float* )calloc(BLOCK_SIZE,sizeof(float)); if(xpts==NULL || ypts ==NULL) { fprintf(stderr,"Spectrogram could not allocate space\n"); return(4); } } count = 0; totalCount = 0; switch(bufferType) { case FLOAT_BUFFER: SET_CELL_SIZE_IN(0,sizeof(float)); if(numberOutputBuffers == 1) SET_CELL_SIZE_OUT(0,sizeof(float)); break; case INTEGER_BUFFER: SET_CELL_SIZE_IN(0,sizeof(int)); if(numberOutputBuffers == 1) SET_CELL_SIZE_OUT(0,sizeof(int)); break; default: fprintf(stderr,"Bad buffer type specified in lpcanalysis \n"); return(5); break; } |
---|
for(samples = MIN_AVAIL(); samples > 0; --samples) { for(i=0; i |
---|
if(control == 0) return(0); if((totalCount - skip) > 0 ) { /* * callup the plot routine */ if(iip_hdr_P ) { /* * if in graphic mode callup iip */ xpts = (float *) realloc((char *) xpts, sizeof(float) * (blockOff + bufi)); ypts = (float *) realloc((char *) ypts, sizeof(float) * (blockOff + bufi)); if(xpts == NULL || ypts==NULL) { fprintf(stderr,"lpcanalysis: could not allocate space\n"); return(6); } curveTime_P = IIP_NewInitedCurveRec(); curveTime_P->qpCurveFlag = TRUE; curveTime_P->x_P = xpts; curveTime_P->y_P = ypts; curveTime_P->points = count; curveTime_P->note_A = NULL; curveTime_P->funcType = PLT_GROUP_TIME_DOMAIN; sprintf(title1,"%s Time Domain %s",spectTitle,SNAME(0)); IIP_SetTitles(curveTime_P,title1,NULL); if(timeFlag) IIP_AppendCurve(curveTime_P); IIP_LPCAnalysis(ypts,count, "LPC Analysis",method+1,m,windowLength,npts,0, samplingRate, dBFlag,expandFlag,surfaceFlag, imageFlag,reflectionFlag,residualFlag, poleZeroFlag,formantFlag,zeroCrossingFlag, 0,"lpcresults.dat", 0,NULL); } } |
---|
/* Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks) Copyright (C) 1989-2002 XCAD Corporation This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA http://www.xcad.com XCAD Corporation Raleigh, North Carolina */ |
---|
/* lpcanalysis.s */ /********************************************************************** lpcanalysis() *********************************************************************** inputs: (One channel) outputs: (optional feed-through of input channels) parameters: int npts, the number of points to plot int skip, number of points to skip before first plot file title, the title of the plot dB flag (0=linear 1=dB) window flag (0=Rect 1= Hamming ) ************************************************************************* This routine produces the lpcanalysis of the input buffer. The first parameter represents the number of points plotted from the channel. Default is set to (int 128). The second parameter is the number of points to skip before the first plot set is presented. This enables skipping of any transient period. Default is set to (int 0). The third parameter represents the title for the plot. Default is set to "PLOT". The fourth parameter is the dB flag (0 for linear, 1 for dB ); The fifth parameter is the window flag ( 0 for Rectangular 1 for hammming) Programmer: Sasan Ardalan Date: Dec. 4, 1993 */ |
---|