/* $Id: specenv.h,v 0.2 1998/10/05 14:49:32 schwarz Exp $ include/specenv.h 6.4.1998 Diemo Schwarz LIBRARY specenv DESCRIPTION Global include file for the spectral envelope library libspecenv. LOG $Log: specenv.h,v $ Revision 0.2 1998/10/05 14:49:32 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 _SPECENV_H_ #define _SPECENV_H_ #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include #include "seutil.h" #include "sefiles.h" #include "seclasses.h" #include "separa.h" #define seLibraryVersion "0.2" #define seStypeFile "/u/formes/schwarz/src/specenv/library/newSdifTypes.STYP" /* // FUNCTION GROUP: P A R T I A L S */ /*DOC: Initialise discrete cepstrum estimation */ seReturn sePartialsToEnvInit (seDcepEstimation *p); /*DOC: Deinitialise discrete cepstrum estimation */ seReturn sePartialsToEnvDeInit (seDcepEstimation *p); /*DOC: Perform discrete cepstrum estimation */ seReturn sePartialsToEnv (/*in */ seDcepEstimation *p, /*out*/ seSpecEnv *env); /* // FUNCTION GROUP: L P C */ /*DOC: Compute standard weighting windows [in] wt window type n length of window [out] win float vector [0 .. (n-1)] containing the window gain window factor 2 / sum (win) */ seReturn seWindow (seWindowType wt, int n, float *win, float *gain); /*DOC: Initialise LPC spectral envelope estimation */ seReturn seSignalToEnvInit (seLpcEstimation *p); /*DOC: Deinitialise LPC spectral envelope estimation */ seReturn seSignalToEnvDeInit (seLpcEstimation *p); /*DOC: Perform LPC spectral envelope estimation */ seReturn seSignalToEnv (seLpcEstimation *p, seSpecEnv *env); /* // FUNCTION GROUP: I N T E R P O L A T I O N */ /*DOC: Return amplitude value at freq, interpolated between env1 and env2 according to given interpolation factor: factor = 0 -> result = env1 factor = 1 -> result = env2 factor = x -> result = env1 * (1 - x) + env2 * x logscale switches from linear to logarithmic interpolation */ Amplitude seInterpolateAtFreq (seSpecEnv *env1, seSpecEnv *env2, float factor, Boolean logscale, Frequency freq); /*DOC: Set env3 to spectral envelope interpolated between env1 and env2 according to given interpolation factor. Env3 must have been properly allocated with seNewSpecEnv. The numenv of env3 is kept, maxfreq is set to the maximum of env1 and env2. factor = 0 -> env3 = env1 factor = 1 -> env3 = env2 factor = x -> env3 = env1 * (1 - x) + env2 * x logscale switches from linear to logarithmic interpolation */ seReturn seInterpolate (seSpecEnv *env1, seSpecEnv *env2, float factor, Boolean logscal, seSpecEnv *env3); /*DOC: Return crossfade of env1 and env2, given at time1 and time2, at time3. logscale switches from linear to logarithmic interpolation. */ seReturn seInterpolateTime (seSpecEnv *env1, Time time1, seSpecEnv *env2, Time time2, seSpecEnv *env3, Time time3, Boolean logscale); /* // FUNCTION GROUP: S Y N T H E S I S */ /*DOC: Frequency domain filtering for partial data from additive synthesis. */ seReturn seApplySpecEnv (seSpecEnv *env, PmPartialSet partials); /*DOC: Initialise frequency domain filtering for signals. */ seReturn seFilterSignalInit (seFilterParameters *p); /*DOC: Deinitialise frequency domain filtering for signals. */ seReturn seFilterSignalDeInit (seFilterParameters *p); /*DOC: Perform frequency domain filtering for signals. */ seReturn seFilterSignal (seFilterParameters *p, seSpecEnv *env); /* // FUNCTION GROUP: E N V E L O P E I / O */ /*DOC: Initialise writing spectral envelopes. [in] in file to read from numio gives the number of seSpecEnvIO blocks at address iobuf iobuf contains numio i/o specifications to be written flags control flags */ seReturn seWriteEnvInit (/*in */ seFile *out, /*in */ int numio, /*in */ seSpecEnvIO *iobuf, /*in */ seIoFlags flags); /*DOC: Deinitialise writing spectral envelopes. */ seReturn seWriteEnvDeinit(/*in */ seFile *in, /*in */ int iomax, /*in */ seSpecEnvIO *iobuf); /*DOC: Write spectral envelopes in ASCII or SDIF format. */ seReturn seWriteEnv (/*in */ seFile *out, /*in */ int numio, /*in */ seSpecEnvIO *iobuf); /*DOC: Initialise reading spectral envelopes. [in] in file to read from numio gives the number of seSpecEnvIO blocks at address iobuf flags control flags [out] iobuf contains numio i/o specifications to be written numiopresent pointer to integer receiving the number of iobuf actually read */ seReturn seReadEnvInit (/*in */ seFile *in, /*in */ int iomax, /*out*/ seSpecEnvIO *iobuf, /*out*/ int *numiopresent, /*in */ seIoFlags flags); /*DOC: Deinitialise reading spectral envelopes. */ seReturn seReadEnvDeinit (/*in */ seFile *in, /*in */ int iomax, /*in */ seSpecEnvIO *iobuf); /*DOC: Read spectral envelope frame types from at most iomax streams. seReadEnv returns when iomax frames are read or when a stream id which has already been read is encountered. Whether a stream was actually read or not is returned in the present flag of iobuf. On eof, seError is returned (without printing a message). */ seReturn seReadEnv (/*in */ seFile *in, /*in */ int iomax, /*out*/ seSpecEnvIO *iobuf); /*DOC: Read envelope frame from file if time is greater than the last frame's time. If not, return last frame. If interpolate flag is set in iobuf, returns env interpolated between last and next frame. */ seReturn seReadEnvAtTime (/*in */ seFile *f, /*in */ Time time, /*in */ int iomax, /*out*/ seSpecEnvIO *iobuf); #ifdef __cplusplus } #endif #endif /* _SPECENV_H_ */