/* $Id: separa.h,v 1.1 1998/10/05 14:49:26 schwarz Exp $ include/separa.h 24.6.1998 Diemo Schwarz Definition of parameter data structures for the spectral envelope library. $Log: separa.h,v $ Revision 1.1 1998/10/05 14:49:26 schwarz Split up specenv.h into smaller include files seclasses.h, sefiles.h, separa.h, seutil.h to facilitate selective including and editing. New separate data structure seSpecEnv for spectral envelopes, which is no longer part of the estimation parameter structures. */ #ifndef _SEPARA_H_ #define _SEPARA_H_ #ifdef __cplusplus extern "C" { #endif #include "seutil.h" /* for float type aliases Frequency, Amplitude, Time */ #include "sefiles.h" #include "seclasses.h" #include /* defines UDI_object */ /* // DATA GROUP: PARAMETERS */ /*DOC: Estimation method and spectral envelope type */ typedef enum { seEtNone = 0, seEtDcep = 1, seEtFreq = 2, seEtPhase = 3, seEtLpc = 4, seEtGeneric = 5, seEtNum /* seEtNum MUST be last */ } seEstimationType; extern const char *seEstimationTypeName [seEtNum]; /*DOC: Discrete cepstrum parameter structure */ typedef struct { /* in */ seEstimationType type; Frequency sr; /* sampling rate f_s */ int numenv; /* number of points for envelope */ int order; float regfact; /* regularization factor */ int cloud; /* use cloud smoothing */ float safetymargin; /* margin factor for border points */ seScale scale; /* frequency scale */ Frequency breakfreq; /* break frequency for log scale */ int debuglevel; /* computed by init */ float freq_shift; float ampl_factor; /* from input file */ int maxpartials; /* number of partials to allocate */ int numpartials; /* number of partials present */ Frequency *freq; /* partial frequencies for amp and freq env */ Amplitude *ampl; /* partial amplitudes for amp env */ Phase *phase; /* partial phases for phase env */ /* out */ float *coef; /* cepstral coefficients */ Time time; /* input time in processed file */ int streamid; /* stream ID for sdif file */ } seDcepEstimation; /*DOC: Window type for LPC */ typedef enum { seWtRectangle, seWtHamming, seWtHanning, seWtBlackman, seWtNum } seWindowType; extern const char *seWindowName [seWtNum]; /*DOC: LPC parameter structure */ typedef struct { /* in */ Frequency sr; /* sampling rate f_s */ int numenv; /* number of points for envelope */ int order; float *signal; /* winsize samples */ int winsize; seWindowType wintype; int debuglevel; /* init */ float *window; float winfactor; /* out */ float gain; float *a, *k, *r; /* lpc coefficients (number = order) */ Time time; /* input time in processed file */ int streamid; /* stream ID for sdif file */ } seLpcEstimation; /*DOC: Filter parameter structure */ typedef struct { Time time; /* input time in processed file */ Frequency sr; int winsize; float *inbuf, *outbuf; /* may point to the same memory */ seSpecEnv *trans; /* transfer function = input env stretched to winsize */ int debuglevel; UDI_object fftweights; UDI_object zero, one; UDI_object compfilter; UDI_object realfilter; UDI_object compsignal; UDI_object realsignal; } seFilterParameters; /*DOC: Flags for seReadEnvInit */ typedef enum { seIoNone = 0, seIoAutoOpen = 1, seIoAutoAlloc = 2, seIoInterpolate = 4, seIoBuffer = 8, } seIoFlags; /*DOC: Structure for file I/O */ typedef struct { int streamid; Time time; seSpecEnv *env; /* must be allocated for seReadEnvInit, or seIoAutoAlloc must be set */ Boolean present; seIoFlags flags; seEstimationType type; seDcepEstimation dcep; /* only one of dcep or lpc is valid, */ seLpcEstimation lpc; /* according to type */ seSpecEnv *last, *current; /* for interpolated reading */ Time lasttime, curtime; /* times of above envs */ } seSpecEnvIO; /*DOC: Default parameters (so far, there's only one type of default) */ typedef enum { sePdtDefault, sePdtNum } seParaDefaultType; /* // FUNCTION GROUP: ESTIMATION PARAMETERS */ /*DOC: Get general estimation parameters from file infile. */ seReturn seGetEstimationPara (seFile *infile, seDcepEstimation *out); /*DOC: Set para to default estimation parameters. */ seReturn seGetDefaultDcepEstimation (seDcepEstimation *para, seParaDefaultType pdt); /*DOC: Print discrete cepstrum estimation parameters. [in] source file name is just for printing */ seReturn sePrintDcepEstimationPara (seDcepEstimation *p, const char *source); /*DOC: Get discrete cepstrum estimation parameters from file infile. */ seReturn seGetDcepEstimationPara (seFile *infile, seDcepEstimation *out); /*DOC: Set para to default estimation parameters. */ seReturn seGetDefaultLpcEstimation (seLpcEstimation *para, seParaDefaultType pdt); /*DOC: Print LPC estimation parameters. [in] source file name is just for printing */ seReturn sePrintLpcEstimationPara (seLpcEstimation *p, const char *source); /*DOC: Get general estimation parameters from file infile. */ seReturn seGetLpcEstimationPara (seFile *infile, seLpcEstimation *out); /*DOC: Print general estimation parameters. [in] source file name is just for printing */ seReturn sePrintEstimationPara (seSpecEnvIO *p, const char *source); /*DOC: Load estimation parameters from file given by fname. [return] estimation-types found */ seEstimationType seLoadEstimationPara (const char *fname, seDcepEstimation *dceppara, seLpcEstimation *lpcpara); #ifdef __cplusplus } #endif #endif /* _SEPARA_H_ */