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

📄 spspaper.vme

📁 speech signal process tools
💻 VME
📖 第 1 页 / 共 3 页
字号:
consider the following sequence of ESPS commands:  .nf	%refco data.sd data.fana	%anaspec data.fana data.spec	%plotspecm data.spec .fi.lpThe first command causes the reflection coefficients computed fromdata frames in the SD file data.sd to be placed in the FEA_ANA filedata.fana.  The second command computes spectra for each set ofreflection coefficients and puts the results in the SPEC filedata.spec.  The third command plots all the spectra on the screenusing a single set of axes.  If there is no need to retain theintermediate FEA_ANA and SPEC files, one could do the followinginstead:.nf	%refco data.sd \- | anaspec \- \- | plotspecm \- .fi.lpSimilarly, if only the SPEC file is wanted, the first two commands could be replaced by:.nf	%refco data.sd \- | anaspec \- data.spec.fi.lpAn important consideration in using pipes with ESPS programs is thatrecord keeping is not compromised.  Thus, the file header fordata.spec in the command above will include the header of the file produced by \fIrefco\fP (i.e., the header of data.fana in the first version of this sequence of operations, above).  .sh 1 "PARAMETERS FOR ESPS PROGRAMS".lpSignal processing programs often are affected by a large set of inputparameters.  Rather than requiring that all parameters be specifiedon the command line, which is not only error-prone but leads toridiculously-long command lines, ESPS provides a mechanism that usesa distinguished ASCII file called the parameter file.  Parameters arespecified in this file using a C-like syntax that allows the usereither to provide specific values for the parameters within theparameter file or to have the program prompt the user for theirvalues at run time.  The default convention for the parameter filename is "params" in the current directory, but for all programs thiscan be changed using the \fB\-P\fP command-line option..lpFor example, \fIrefco\fP (1\-\s-1ESPS\s+1) computes reflection coefficients for fixed-length segments of sampled-data.  To do so it requires parameters that specify the starting point,the segment size, the number of segments, the coefficients of a pole-zero filter than optionally can be used to pre-filter thedata, and the method used for computing reflection coefficients.  The call.nf    %refco \-P params.3 john.sd john.fana.fiindicates that reflection coefficients are to be computed for data inthe file john.sd using parameter values in the file params.3 (theuser may be prompted for some of the values), and that the resultsare to be written to the file john.fana..lpThe ESPS parameter file provides a convenient means for users tocommunicate parameter values to signal processing programs.  In manysignal processing applications, however, there is also a need for oneprogram to communicate parameter values to another program that is runsubsequently.  In ESPS, this need is met by the ESPS common file.  If the common file exists and was written more recently than the parameter file, then parameter values in the common file supersede those in the parameter file.  Thus, a program can write a value intothe common file and have that value be used by a subsequent program.  For example, suppose that.i plotsd(1\-\s-1ESPS\s+1) is used to plot the first 10,000 points of an SDfile in a graphics window:.nf 	%plotsd \-p1:10000 file.sd .fiAfter this plot is made, the user can run.i range(1\-\s-1ESPS\s+1) to select a portion of the displayed data (using the mouse).When .i rangeexits, it writes the selected range and the filename "file.sd" into theESPS common file.  If the user then runs .nf 	%plotsd.fi(i.e., without any command line options), the selected range of the samefile will be displayed.  Similarly, if the user runs .nf	%play.fi(again, without options), the selected range of the same file will be played out over the system D/A converter.  .lpThe default ESPS common file is ".spscom " in the user's homedirectory, but this default can be changed by using the \s-1UNIX\s+1shell environment variable SPSCOM.  Thus, for csh users, .nf 	%setenv SPSCOM /u/shore/common.3.firesets the common file to /u/shore/common.3.  This facility forchanging the common file is needed so that users can prepare and runseveral shell scripts without having them interfere with each other..lpTo summarize, ESPS programs get their parameters from three sources:.SM .5i.ip \(bu 3the ESPS parameter file.ip \(bu 3the ESPS common file.ip \(bu 3command line options.RM.lpIn general, if a command-line option is available to set a parametervalue, its use overrides any of the other mechanisms by which programsget parameter values.  .sh 1 "PROGRAMMING WITH ESPS FILES".lpThis section contains a brief introduction to the C structures usedfor ESPS headers and records, as well as to some of the ESPS libraryroutines that facilitate ESPS file processing.  If you are notinterested in ESPS programming, skip to Section 7..sh 2 "ESPS File Headers".lpThe standard ESPS file header consists of two primary parts, theuniversal section and the type-specific section.  All headeritems (including generics) are referred to by name in programs.This makes it easier to write, read, and maintain programs.Also, when headers are output in ASCII form using.i psps(1\-\s-1ESPS\s+1), all of the items (including generics) are identified by name.  .sh 3 "The Universal Section of the Header".lpAs the name implies, the universal section of the ESPS header has thesame definition for all ESPS file types.  This section of the headeris divided into a fixed-length portion called the \fIcommon\fPsection, and a variable-length portion called the \fIvariable\fPsection..lpThe universal section of an ESPS header contains information about thetype of data in the file, the program that created the file, the userwho created the file, the creation date, version information,housekeeping information required by the header access routines,history data, etc.  When user programs need to refer directly tothese items, they do so by name.  For example, consider the items"tag" in the common portion and "refer" in the variable portion."Tag" determines whether or not the records in the file each containa tag pointing to a particular record in some pre-existing sourcefile; if they do, then "refer" is the name of the source file towhich they refer.  Here is an example of how these header items arereferred to in source code:.vS.nf    #include <esps/sps.h>    struct header *h;    . . .    if (h->common.tag) printf("source file for tags is %s\n", h->variable.refer);.fi.vEIn most cases, ESPS programs do not refer directly to items in theuniversal section of the header because these items are maintained directly or indirectly by utility routines in the ESPS library.  For example, the universal section of the header contains avariable-length comment field that is used to record arbitraryASCII comments.  Programs add comments to an existing header though use of \fIadd_comment\fP (3\-\s-1ESPS\s+1), as in.vS.nf    add_comment(h, "This file contains clipped values.\n");.fi.vEThe user-level program \fIcomment\fP (1\-\s-1ESPS\s+1), mentioned in Section 3 above, is implemented by means of calls to\fIadd_comment\fP.  .sh 3 "The Type-Specific Section of the Header".lpAs the name implies, this section of the header is used to record information relevant to the specific file type.  The items defined for a particular file type are described in the manual page forthat file type in Section 5 of the ESPS Manual.  For example, seeSD (5\-\s-1ESPS\s+1) for the type-specific header definition for sampled data files.  .lpTo facilitate a standard form for referring to the type-specificheader items, a C union is used.  For example, here is a codefragment that might apply to a program that processes a SD(sampled-data) file and produces a SPEC (spectral record) file ("sf" is a SD-header item giving the sampling frequency, and "nan" is SPEC-header item giving the number of points analyzed):.vS.nf    struct header *ih;	    /*SD input file header*/    struct header *oh;	    /*SPEC output file header*/    long seconds;	    /*amount of input data to process (seconds)*/    . . .    /*now compute number of points of data*/    oh->hd.spec->nan = seconds * ih->hd.sd->sf;.fi .vE .sh 3 "Generic Header Items" .lp The pre-defined items in the universal and type-specific headersections are intended to be useful in a broad range of typicalapplications.  However, they cannot anticipate every application.For example, the SD file type does not make provision for storing inthe file header the average rate of zero crossings, but applicationsarise when it is convenient to do so.  To address such needs, ESPSprovides generic header items..lp Generic header items provide programmers with theability to create arbitrary named fields in the header of any ESPSfile.  Utility functions in the ESPS library facilitate the creationand manipulation of generics.  For example, the function .i add_genhd_f (3\-\s-1ESPS\s+1) can be used to create a generic header comprisingone or more floats.  Here's one example of its use to createand fill an item called "zero_cross_rate":  .vS.nf    struct header *hd;    float time;    long nzeros;    . . .    *add_genhd_f("zero_cross_rate", NULL, 1L, hd) = nzeros / time;.fi.vE.lpSimilarly, \fIget_genhd\fP (3\-\s-1ESPS\s+1) returns a pointer toan existing generic and might be used as follows:.vS.nf    struct header *hd;    long estim_zeros;    float time;    . . .    /*compute estimated number of zeros*/    estim_zeros = time * (*(float *) get_genhd("zero_cross_rate", hd));.fi.vE.lpGeneric header items can store any type of C variable values, includingcharacters (and strings).  Also provided are generic header items to store enumerated types (also called coded types).  These headeritems store an integer value but allow those values to be expressedsymbolically via a set of pre-defined strings.	For example, this code creates and fills a generic header item called "filter_type":.vS.nf    /*defined constants for filter_type*/    #define MISC	0    #define LOW_PASS	1    #define HIGH_PASS	2    #define BAND_PASS	3

⌨️ 快捷键说明

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