// Copyright (C) 1999 Jean-Marc Valin #include "BufferedNode.h" #include "Buffer.h" #include "Vector.h" #include #include #include "FFTWrap.h" using namespace std; namespace FD { class LPC2PS; DECLARE_NODE(LPC2PS) /*Node * * @name LPC2PS * @category DSP:Adaptive * @require FFT * @description Calculates the spectral envelope corresponding to an all-pole filter (LPC coefficients) * * @input_name INPUT * @input_type Vector * @input_description LPC coefficients (including the '1' as first coefficient) * * @output_name OUTPUT * @output_type Vector * @output_description Points of the spectral envelope * * @parameter_name OUTPUTLENGTH * @parameter_type int * @parameter_description Number of points for the spectral envelope * END*/ class LPC2PS : public BufferedNode { int inputID; int outputID; int outputLength; float *hamming; int SAMP_SIZE; int SAMP_SIZE_2; float *response; float *ps; public: LPC2PS(string nodeName, ParameterSet params) : BufferedNode(nodeName, params) { inputID = addInput("INPUT"); outputID = addOutput("OUTPUT"); outputLength = dereference_cast (parameters.get("OUTPUTLENGTH")); SAMP_SIZE_2 = outputLength; SAMP_SIZE = 2 * SAMP_SIZE_2; response=new float[SAMP_SIZE]; ps=new float[SAMP_SIZE]; hamming = new float[SAMP_SIZE]; for (int i=0;i &in = object_cast > (inputValue); int inputLength = in.size(); Vector &output = *Vector::alloc(outputLength); out[count] = &output; for (int i=0;i