예제 #1
0
        public static FloatData DoubleData2FloatData(DoubleData data)
        {
            int num = data.getValues().Length;

            float[]  array  = new float[num];
            double[] values = data.getValues();
            for (int i = 0; i < values.Length; i++)
            {
                array[i] = (float)values[i];
            }
            return(new FloatData(array, data.getSampleRate(), data.getFirstSampleNumber()));
        }
예제 #2
0
        public override Data getData()
        {
            object obj = this.getPredecessor().getData();

            if (((Data)obj) is DoubleData && String.instancehelper_equals(this.convMode, "d2f"))
            {
                DoubleData doubleData = (DoubleData)((Data)obj);
                obj = new FloatData(MatrixUtils.double2float(doubleData.getValues()), doubleData.getSampleRate(), doubleData.getFirstSampleNumber());
            }
            else if (((Data)obj) is FloatData && String.instancehelper_equals(this.convMode, "f2d"))
            {
                FloatData floatData = (FloatData)((Data)obj);
                obj = new DoubleData(MatrixUtils.float2double(floatData.getValues()), floatData.getSampleRate(), floatData.getFirstSampleNumber());
            }
            object obj2 = obj;
            Data   result;

            if (obj2 != null)
            {
                if ((result = (obj2 as Data)) == null)
                {
                    throw new IncompatibleClassChangeError();
                }
            }
            else
            {
                result = null;
            }
            return(result);
        }
        protected internal override Data computeNextFeature()
        {
            DoubleData doubleData = this.cepstraBuffer[this.currentPosition];

            float[] array = new float[(this.window * 2 + 1) * doubleData.getValues().Length];
            int     num   = 0;

            for (int i = -this.window; i <= this.window; i++)
            {
                int      num2 = this.currentPosition + i + this.cepstraBufferSize;
                int      cepstraBufferSize = this.cepstraBufferSize;
                int      num3   = (cepstraBufferSize != -1) ? (num2 % cepstraBufferSize) : 0;
                double[] values = this.cepstraBuffer[num3].getValues();
                double[] array2 = values;
                int      num4   = array2.Length;
                for (int j = 0; j < num4; j++)
                {
                    double  num5   = array2[j];
                    float[] array3 = array;
                    int     num6   = num;
                    num++;
                    array3[num6] = (float)num5;
                }
            }
            int num7 = this.currentPosition + 1;
            int cepstraBufferSize2 = this.cepstraBufferSize;

            this.currentPosition = ((cepstraBufferSize2 != -1) ? (num7 % cepstraBufferSize2) : 0);
            return(new FloatData(array, doubleData.getSampleRate(), doubleData.getFirstSampleNumber()));
        }
        private DoubleData process(DoubleData doubleData)
        {
            double[] values = doubleData.getValues();
            if (this.criticalBandFilter == null || this.sampleRate != doubleData.getSampleRate())
            {
                this.numberFftPoints = values.Length - 1 << 1;
                this.sampleRate      = doubleData.getSampleRate();
                this.buildCriticalBandFilterbank();
                this.buildEqualLoudnessScalingFactors();
            }
            else if (values.Length != (this.numberFftPoints >> 1) + 1)
            {
                string text = new StringBuilder().append("Window size is incorrect: in.length == ").append(values.Length).append(", numberFftPoints == ").append((this.numberFftPoints >> 1) + 1).toString();

                throw new IllegalArgumentException(text);
            }
            double[] array = new double[this.numberFilters];
            for (int i = 0; i < this.numberFilters; i++)
            {
                array[i] = this.criticalBandFilter[i].filterOutput(values);
                double[] array2 = array;
                int      num    = i;
                double[] array3 = array2;
                array3[num] *= this.equalLoudnessScaling[i];
            }
            return(new DoubleData(array, doubleData.getSampleRate(), doubleData.getFirstSampleNumber()));
        }
예제 #5
0
        public IData getData()
        {
            IData inputData = getPredecessor().getData();
            int   i;

            if (inputData is DataStartSignal)
            {
                power = null;
                noise = null;
                floor = null;
                peak  = null;
                return(inputData);
            }
            if (!(inputData is DoubleData))
            {
                return(inputData);
            }

            DoubleData inputDoubleData = (DoubleData)inputData;

            double[] input  = inputDoubleData.getValues();
            int      length = input.Length;

            if (power == null)
            {
                initStatistics(input, length);
            }

            updatePower(input);

            estimateEnvelope(power, noise);

            double[] signal = new double[length];
            for (i = 0; i < length; i++)
            {
                signal[i] = Math.Max(power[i] - noise[i], 0.0);
            }

            estimateEnvelope(signal, floor);

            tempMasking(signal);

            powerBoosting(signal);

            double[] gain = new double[length];
            for (i = 0; i < length; i++)
            {
                gain[i] = signal[i] / (power[i] + EPS);
                gain[i] = Math.Min(Math.Max(gain[i], 1.0 / maxGain), maxGain);
            }
            double[] smoothGain = smooth(gain);

            for (i = 0; i < length; i++)
            {
                input[i] *= smoothGain[i];
            }

            return(inputData);
        }
        private void process(DoubleData doubleData)
        {
            double[]   values     = doubleData.getValues();
            int        i          = this.overflowBuffer.getOccupancy() + values.Length;
            LinkedList linkedList = new LinkedList();

            linkedList.add(doubleData);
            Data data = null;

            while (i < this.cosineWindow.Length)
            {
                Data data2 = this.getPredecessor().getData();
                if (data2 is DoubleData)
                {
                    linkedList.add((DoubleData)data2);
                    i += ((DoubleData)data2).getValues().Length;
                }
                else
                {
                    if (data2 is DataEndSignal || data2 is SpeechEndSignal)
                    {
                        data = data2;
                        break;
                    }
                    this.outputQueue.add(data2);
                }
            }
            double[] array = values;
            int      num;

            if (i != values.Length)
            {
                array = new double[i];
                ByteCodeHelper.arraycopy_primitive_8(this.overflowBuffer.getBuffer(), 0, array, 0, this.overflowBuffer.getOccupancy());
                num = this.overflowBuffer.getOccupancy();
                Iterator iterator = linkedList.iterator();
                while (iterator.hasNext())
                {
                    DoubleData doubleData2 = (DoubleData)iterator.next();
                    double[]   values2     = doubleData2.getValues();
                    ByteCodeHelper.arraycopy_primitive_8(values2, 0, array, num, values2.Length);
                    num += values2.Length;
                }
            }
            num = this.applyRaisedCosineWindow(array, i);
            this.overflowBuffer.reset();
            if (i - num > 0)
            {
                this.overflowBuffer.append(array, num, i - num);
            }
            if (data != null)
            {
                this.processUtteranceEnd();
                this.outputQueue.add(data);
            }
        }
        public override Data getData()
        {
            object obj = this.getPredecessor().getData();

            if ((Data)obj != null && ((Data)obj) is DoubleData)
            {
                DoubleData doubleData = (DoubleData)((Data)obj);
                if (!this.isNumberFftPointsSet)
                {
                    if (this.numberDataPoints != doubleData.getValues().Length)
                    {
                        this.numberDataPoints = doubleData.getValues().Length;
                        this.numberFftPoints  = DiscreteFourierTransform.getNumberFftPoints(this.numberDataPoints);
                        this.initializeFFT();
                    }
                }
                else if (this.numberDataPoints != doubleData.getValues().Length)
                {
                    this.numberDataPoints = doubleData.getValues().Length;
                    int num = DiscreteFourierTransform.getNumberFftPoints(this.numberDataPoints);
                    if (num != this.numberFftPoints)
                    {
                        this.logger.warning(new StringBuilder().append("User set numberFftPoints (").append(this.numberFftPoints).append(") is not ideal (").append(num).append(')').toString());
                    }
                }
                obj = this.process(doubleData);
            }
            object obj2 = obj;
            Data   result;

            if (obj2 != null)
            {
                if ((result = (obj2 as Data)) == null)
                {
                    throw new IncompatibleClassChangeError();
                }
            }
            else
            {
                result = null;
            }
            return(result);
        }
예제 #8
0
        public override Data getData()
        {
            Data data = this.getPredecessor().getData();

            if (data is DataStartSignal)
            {
                this.sampleRate = ((DataStartSignal)data).getSampleRate();
            }
            if (data is DataStartSignal || (data is SpeechStartSignal && this.captureUtts))
            {
                this.baos = new ByteArrayOutputStream();
                this.dos  = new DataOutputStream(this.baos);
            }
            if ((data is DataEndSignal && !this.captureUtts) || (data is SpeechEndSignal && this.captureUtts))
            {
                string nextFreeIndex;
                if (this.isCompletePath)
                {
                    nextFreeIndex = this.outFileNamePattern;
                }
                else
                {
                    nextFreeIndex = WavWriter.getNextFreeIndex(this.outFileNamePattern);
                }
                this.writeFile(nextFreeIndex);
                this.isInSpeech = false;
            }
            if (data is SpeechStartSignal)
            {
                this.isInSpeech = true;
            }
            if ((data is DoubleData || data is FloatData) && (this.isInSpeech || !this.captureUtts))
            {
                DoubleData doubleData = (!(data is DoubleData)) ? DataUtil.FloatData2DoubleData((FloatData)data) : ((DoubleData)data);
                double[]   values     = doubleData.getValues();
                double[]   array      = values;
                int        num        = array.Length;
                int        i          = 0;
                while (i < num)
                {
                    double num2 = array[i];
                    try
                    {
                        this.dos.writeShort((int)new Short((short)ByteCodeHelper.d2i(num2)).shortValue());
                    }
                    catch (IOException ex)
                    {
                        Throwable.instancehelper_printStackTrace(ex);
                    }
                    i++;
                    continue;
                }
            }
            return(data);
        }
예제 #9
0
        public override Data getData()
        {
            Data data = this.getPredecessor().getData();

            if (data is DataStartSignal)
            {
                this.power = null;
                this.noise = null;
                this.floor = null;
                this.peak  = null;
                return(data);
            }
            if (!(data is DoubleData))
            {
                return(data);
            }
            DoubleData doubleData = (DoubleData)data;

            double[] values = doubleData.getValues();
            int      num    = values.Length;

            if (this.power == null)
            {
                this.initStatistics(values, num);
            }
            this.updatePower(values);
            this.estimateEnvelope(this.power, this.noise);
            double[] array = new double[num];
            for (int i = 0; i < num; i++)
            {
                array[i] = java.lang.Math.max(this.power[i] - this.noise[i], (double)0f);
            }
            this.estimateEnvelope(array, this.floor);
            this.tempMasking(array);
            this.powerBoosting(array);
            double[] array2 = new double[num];
            for (int i = 0; i < num; i++)
            {
                array2[i] = array[i] / (this.power[i] + 1E-10);
                array2[i] = java.lang.Math.min(java.lang.Math.max(array2[i], (double)1f / this.maxGain), this.maxGain);
            }
            double[] array3 = this.smooth(array2);
            for (int i = 0; i < num; i++)
            {
                double[] array4 = values;
                int      num2   = i;
                double[] array5 = array4;
                array5[num2] *= array3[i];
            }
            return(data);
        }
예제 #10
0
        private DoubleData process(Data data)
        {
            if (!Dither.assertionsDisabled && !(data is DoubleData))
            {
                throw new AssertionError();
            }
            DoubleData doubleData = (DoubleData)data;

            double[] values = doubleData.getValues();
            double[] array  = new double[values.Length];
            for (int i = 0; i < values.Length; i++)
            {
                array[i] = (double)(this.r.nextFloat() * 2f) * this.ditherMax - this.ditherMax + values[i];
                array[i] = Math.max(Math.min(array[i], this.maxValue), this.minValue);
            }
            return(new DoubleData(array, doubleData.getSampleRate(), doubleData.getFirstSampleNumber()));
        }
 private bool isAudioStreamContinuous(Data data)
 {
     if (data is DoubleData)
     {
         DoubleData doubleData = (DoubleData)data;
         if (this.lastSampleNum != -1L && this.lastSampleNum != doubleData.getFirstSampleNumber())
         {
             return(false);
         }
         this.lastSampleNum = doubleData.getFirstSampleNumber() + (long)doubleData.getValues().Length;
     }
     else if (data is DataStartSignal)
     {
         this.lastSampleNum = -1L;
     }
     return(true);
 }
        private Data process(DoubleData doubleData)
        {
            double[] values = doubleData.getValues();
            if (values.Length != this.numberPLPFilters)
            {
                string text = new StringBuilder().append("PLPSpectrum size is incorrect: plpspectrum.length == ").append(values.Length).append(", numberPLPFilters == ").append(this.numberPLPFilters).toString();

                throw new IllegalArgumentException(text);
            }
            double[]        array           = this.powerLawCompress(values);
            double[]        autocor         = this.applyCosine(array);
            LinearPredictor linearPredictor = new LinearPredictor(this.LPCOrder);

            linearPredictor.getARFilter(autocor);
            double[] data = linearPredictor.getData(this.cepstrumSize);
            return(new DoubleData(data, doubleData.getSampleRate(), doubleData.getFirstSampleNumber()));
        }
예제 #13
0
        private void liftCepstrum(DoubleData doubleData)
        {
            double[] values = doubleData.getValues();
            if (this.lifterWeights == null)
            {
                this.cepstrumSize = values.Length;
                this.computeLifterWeights();
            }
            else if (values.Length != this.cepstrumSize)
            {
                string text = new StringBuilder().append("MelCepstrum size is incorrect: melcepstrum.length == ").append(values.Length).append(", cepstrumSize == ").append(this.cepstrumSize).toString();

                throw new IllegalArgumentException(text);
            }
            for (int i = 0; i < values.Length; i++)
            {
                values[i] *= this.lifterWeights[i];
            }
        }
 private DoubleData process(DoubleData doubleData)
 {
     double[] values = doubleData.getValues();
     if (this.numberFftPoints < values.Length)
     {
         int i;
         for (i = 0; i < this.numberFftPoints; i++)
         {
             this.inputFrame[i].set(values[i], (double)0f);
         }
         while (i < values.Length)
         {
             this.tempComplex.set(values[i], (double)0f);
             Complex[] array   = this.inputFrame;
             int       num     = i;
             int       num2    = this.numberFftPoints;
             Complex   complex = array[(num2 != -1) ? (num % num2) : 0];
             Complex[] array2  = this.inputFrame;
             int       num3    = i;
             int       num4    = this.numberFftPoints;
             complex.addComplex(array2[(num4 != -1) ? (num3 % num4) : 0], this.tempComplex);
             i++;
         }
     }
     else
     {
         int i;
         for (i = 0; i < values.Length; i++)
         {
             this.inputFrame[i].set(values[i], (double)0f);
         }
         while (i < this.numberFftPoints)
         {
             this.inputFrame[i].reset();
             i++;
         }
     }
     double[] array3 = new double[(this.numberFftPoints >> 1) + 1];
     this.recurseFft(this.inputFrame, array3, this.numberFftPoints, this.invert);
     return(new DoubleData(array3, doubleData.getSampleRate(), doubleData.getFirstSampleNumber()));
 }
예제 #15
0
        private DoubleData process(DoubleData doubleData)
        {
            double[] values = doubleData.getValues();
            if (this.melcosine == null)
            {
                this.numberMelFilters = values.Length;
                this.computeMelCosine();
            }
            else if (values.Length != this.numberMelFilters)
            {
                string text = new StringBuilder().append("MelSpectrum size is incorrect: melspectrum.length == ").append(values.Length).append(", numberMelFilters == ").append(this.numberMelFilters).toString();

                throw new IllegalArgumentException(text);
            }
            for (int i = 0; i < values.Length; i++)
            {
                values[i] = Math.log(values[i] + 0.0001);
            }
            double[] values2 = this.applyMelCosine(values);
            return(new DoubleData(values2, doubleData.getSampleRate(), doubleData.getFirstSampleNumber()));
        }
        private DoubleData process(DoubleData doubleData)
        {
            double[] values = doubleData.getValues();
            if (this.filter == null || this.sampleRate != doubleData.getSampleRate())
            {
                this.numberFftPoints = values.Length - 1 << 1;
                this.sampleRate      = doubleData.getSampleRate();
                this.buildFilterbank(this.numberFftPoints, this.numberFilters, this.minFreq, this.maxFreq);
            }
            else if (values.Length != (this.numberFftPoints >> 1) + 1)
            {
                string text = new StringBuilder().append("Window size is incorrect: in.length == ").append(values.Length).append(", numberFftPoints == ").append((this.numberFftPoints >> 1) + 1).toString();

                throw new IllegalArgumentException(text);
            }
            double[] array = new double[this.numberFilters];
            for (int i = 0; i < this.numberFilters; i++)
            {
                array[i] = this.filter[i].filterOutput(values);
            }
            return(new DoubleData(array, this.sampleRate, doubleData.getFirstSampleNumber()));
        }
예제 #17
0
        protected internal virtual SpeechClassifiedData classify(DoubleData audio)
        {
            double num = SpeechClassifier.logRootMeanSquare(audio.getValues());

            this._isSpeech = false;
            if (num >= this.minSignal)
            {
                this.level = (this.level * (double)1f + num) / 2.0;
                if (num < this.background)
                {
                    this.background = num;
                }
                else
                {
                    this.background += (num - this.background) * this.adjustment;
                }
                if (this.level < this.background)
                {
                    this.level = this.background;
                }
                this._isSpeech = (this.level - this.background > this.threshold);
            }
            SpeechClassifiedData speechClassifiedData = new SpeechClassifiedData(audio, this._isSpeech);

            if (this.logger.isLoggable(Level.FINEST))
            {
                string text = "";
                if (speechClassifiedData.isSpeech())
                {
                    text = "*";
                }
                this.logger.finest(new StringBuilder().append("Bkg: ").append(this.background).append(", level: ").append(this.level).append(", current: ").append(num).append(' ').append(text).toString());
            }
            this.collectStats(this._isSpeech);
            return(speechClassifiedData);
        }
        protected internal override Data computeNextFeature()
        {
            int        num = this.currentPosition - 1 + this.cepstraBufferSize;
            int        cepstraBufferSize = this.cepstraBufferSize;
            int        num2 = (cepstraBufferSize != -1) ? (num % cepstraBufferSize) : 0;
            int        num3 = this.currentPosition - 2 + this.cepstraBufferSize;
            int        cepstraBufferSize2 = this.cepstraBufferSize;
            int        num4 = (cepstraBufferSize2 != -1) ? (num3 % cepstraBufferSize2) : 0;
            int        num5 = this.currentPosition - 3 + this.cepstraBufferSize;
            int        cepstraBufferSize3 = this.cepstraBufferSize;
            int        num6 = (cepstraBufferSize3 != -1) ? (num5 % cepstraBufferSize3) : 0;
            int        num7 = this.currentPosition - 4 + this.cepstraBufferSize;
            int        cepstraBufferSize4 = this.cepstraBufferSize;
            int        num8 = (cepstraBufferSize4 != -1) ? (num7 % cepstraBufferSize4) : 0;
            int        num9 = this.currentPosition + 1;
            int        cepstraBufferSize5 = this.cepstraBufferSize;
            int        num10 = (cepstraBufferSize5 != -1) ? (num9 % cepstraBufferSize5) : 0;
            int        num11 = this.currentPosition + 2;
            int        cepstraBufferSize6 = this.cepstraBufferSize;
            int        num12 = (cepstraBufferSize6 != -1) ? (num11 % cepstraBufferSize6) : 0;
            int        num13 = this.currentPosition + 3;
            int        cepstraBufferSize7 = this.cepstraBufferSize;
            int        num14 = (cepstraBufferSize7 != -1) ? (num13 % cepstraBufferSize7) : 0;
            int        num15 = this.currentPosition + 4;
            int        cepstraBufferSize8 = this.cepstraBufferSize;
            int        num16      = (cepstraBufferSize8 != -1) ? (num15 % cepstraBufferSize8) : 0;
            DoubleData doubleData = this.cepstraBuffer[this.currentPosition];

            double[] values             = this.cepstraBuffer[num16].getValues();
            double[] values2            = this.cepstraBuffer[num14].getValues();
            double[] values3            = this.cepstraBuffer[num12].getValues();
            double[] values4            = this.cepstraBuffer[num10].getValues();
            double[] values5            = doubleData.getValues();
            double[] values6            = this.cepstraBuffer[num2].getValues();
            double[] values7            = this.cepstraBuffer[num4].getValues();
            double[] values8            = this.cepstraBuffer[num6].getValues();
            double[] values9            = this.cepstraBuffer[num8].getValues();
            float[]  array              = new float[values5.Length * 3];
            int      num17              = this.currentPosition + 1;
            int      cepstraBufferSize9 = this.cepstraBufferSize;

            this.currentPosition = ((cepstraBufferSize9 != -1) ? (num17 % cepstraBufferSize9) : 0);
            int num18 = 0;

            double[] array2 = values5;
            int      num19  = array2.Length;

            for (int i = 0; i < num19; i++)
            {
                double  num20  = array2[i];
                float[] array3 = array;
                int     num21  = num18;
                num18++;
                array3[num21] = (float)num20;
            }
            for (int j = 0; j < values3.Length; j++)
            {
                float[] array4 = array;
                int     num22  = num18;
                num18++;
                array4[num22] = (float)(2.0 * values3[j] + values4[j] - values6[j] - 2.0 * values7[j]) / 10f;
            }
            for (int j = 0; j < values2.Length; j++)
            {
                float[] array5 = array;
                int     num23  = num18;
                num18++;
                array5[num23] = (float)(4.0 * values[j] + 4.0 * values2[j] + values3[j] - 4.0 * values4[j] - 10.0 * values5[j] + (4.0 * values9[j] + 4.0 * values8[j] + values7[j] - 4.0 * values6[j])) / 100f;
            }
            return(new FloatData(array, doubleData.getSampleRate(), doubleData.getFirstSampleNumber()));
        }
예제 #19
0
        public override Data getData()
        {
            object obj = this.readData();

            if ((Data)obj != null)
            {
                if (!(((Data)obj) is Signal))
                {
                    int num  = this.id;
                    int num2 = this.dropEveryNthFrame;
                    if (((num2 != -1) ? (num % num2) : 0) == this.dropEveryNthFrame - 1)
                    {
                        if (this.replaceNthWithPrevious)
                        {
                            if (((Data)obj) is FloatData)
                            {
                                FloatData floatData = (FloatData)this.lastFeature;
                                obj = new FloatData(floatData.getValues(), floatData.getSampleRate(), floatData.getFirstSampleNumber());
                            }
                            else
                            {
                                DoubleData doubleData = (DoubleData)this.lastFeature;
                                obj = new DoubleData(doubleData.getValues(), doubleData.getSampleRate(), doubleData.getFirstSampleNumber());
                            }
                        }
                        else
                        {
                            obj = this.readData();
                        }
                    }
                }
                if (obj != null)
                {
                    if (obj is DataEndSignal)
                    {
                        this.id = -1;
                    }
                    if (obj is FloatData)
                    {
                        object obj2 = obj;
                        Data   data;
                        if (obj2 != null)
                        {
                            if ((data = (obj2 as Data)) == null)
                            {
                                throw new IncompatibleClassChangeError();
                            }
                        }
                        else
                        {
                            data = null;
                        }
                        this.lastFeature = data;
                    }
                    else
                    {
                        this.lastFeature = null;
                    }
                }
                else
                {
                    this.lastFeature = null;
                }
            }
            object obj3 = obj;
            Data   result;

            if (obj3 != null)
            {
                if ((result = (obj3 as Data)) == null)
                {
                    throw new IncompatibleClassChangeError();
                }
            }
            else
            {
                result = null;
            }
            return(result);
        }
예제 #20
0
        protected internal override Data computeNextFeature()
        {
            int        num = this.currentPosition - 1 + this.cepstraBufferSize;
            int        cepstraBufferSize = this.cepstraBufferSize;
            int        num2 = (cepstraBufferSize != -1) ? (num % cepstraBufferSize) : 0;
            int        num3 = this.currentPosition - 2 + this.cepstraBufferSize;
            int        cepstraBufferSize2 = this.cepstraBufferSize;
            int        num4 = (cepstraBufferSize2 != -1) ? (num3 % cepstraBufferSize2) : 0;
            int        num5 = this.currentPosition - 3 + this.cepstraBufferSize;
            int        cepstraBufferSize3 = this.cepstraBufferSize;
            int        num6 = (cepstraBufferSize3 != -1) ? (num5 % cepstraBufferSize3) : 0;
            int        num7 = this.currentPosition + 1;
            int        cepstraBufferSize4 = this.cepstraBufferSize;
            int        num8 = (cepstraBufferSize4 != -1) ? (num7 % cepstraBufferSize4) : 0;
            int        num9 = this.currentPosition + 2;
            int        cepstraBufferSize5 = this.cepstraBufferSize;
            int        num10 = (cepstraBufferSize5 != -1) ? (num9 % cepstraBufferSize5) : 0;
            int        num11 = this.currentPosition + 3;
            int        cepstraBufferSize6 = this.cepstraBufferSize;
            int        num12      = (cepstraBufferSize6 != -1) ? (num11 % cepstraBufferSize6) : 0;
            DoubleData doubleData = this.cepstraBuffer[this.currentPosition];

            double[] values             = this.cepstraBuffer[num12].getValues();
            double[] values2            = this.cepstraBuffer[num10].getValues();
            double[] values3            = this.cepstraBuffer[num8].getValues();
            double[] values4            = doubleData.getValues();
            double[] values5            = this.cepstraBuffer[num2].getValues();
            double[] values6            = this.cepstraBuffer[num4].getValues();
            double[] values7            = this.cepstraBuffer[num6].getValues();
            float[]  array              = new float[values4.Length * 3];
            int      num13              = this.currentPosition + 1;
            int      cepstraBufferSize7 = this.cepstraBufferSize;

            this.currentPosition = ((cepstraBufferSize7 != -1) ? (num13 % cepstraBufferSize7) : 0);
            int num14 = 0;

            double[] array2 = values4;
            int      num15  = array2.Length;

            for (int i = 0; i < num15; i++)
            {
                double  num16  = array2[i];
                float[] array3 = array;
                int     num17  = num14;
                num14++;
                array3[num17] = (float)num16;
            }
            for (int j = 0; j < values2.Length; j++)
            {
                float[] array4 = array;
                int     num18  = num14;
                num14++;
                array4[num18] = (float)(values2[j] - values6[j]);
            }
            for (int j = 0; j < values.Length; j++)
            {
                float[] array5 = array;
                int     num19  = num14;
                num14++;
                array5[num19] = (float)(values[j] - values5[j] - (values3[j] - values7[j]));
            }
            return(new FloatData(array, doubleData.getSampleRate(), doubleData.getFirstSampleNumber()));
        }
예제 #21
0
 private void dumpData(Data data)
 {
     if (data == null)
     {
         [email protected]("Data: null");
     }
     else if (data is Signal)
     {
         if (this.outputSignals)
         {
             [email protected](new StringBuilder().append("Signal: ").append(data).toString());
         }
     }
     else if (data is DoubleData)
     {
         DoubleData doubleData = (DoubleData)data;
         double[]   values     = doubleData.getValues();
         [email protected](new StringBuilder().append("Frame ").append(values.Length).toString());
         double[] array = values;
         int      num   = array.Length;
         for (int i = 0; i < num; i++)
         {
             double num2 = array[i];
             [email protected](new StringBuilder().append(' ').append(this.formatter.format(num2)).toString());
         }
         [email protected]();
     }
     else if (data is SpeechClassifiedData)
     {
         SpeechClassifiedData speechClassifiedData = (SpeechClassifiedData)data;
         double[]             values = speechClassifiedData.getValues();
         [email protected]("Frame ");
         if (speechClassifiedData.isSpeech())
         {
             [email protected]('*');
         }
         else
         {
             [email protected](' ');
         }
         [email protected](new StringBuilder().append(" ").append(values.Length).toString());
         double[] array = values;
         int      num   = array.Length;
         for (int i = 0; i < num; i++)
         {
             double num2 = array[i];
             [email protected](new StringBuilder().append(' ').append(this.formatter.format(num2)).toString());
         }
         [email protected]();
     }
     else if (data is FloatData)
     {
         FloatData floatData = (FloatData)data;
         float[]   values2   = floatData.getValues();
         [email protected](new StringBuilder().append("Frame ").append(values2.Length).toString());
         float[] array2 = values2;
         int     num    = array2.Length;
         for (int i = 0; i < num; i++)
         {
             float num3 = array2[i];
             [email protected](new StringBuilder().append(' ').append(this.formatter.format((double)num3)).toString());
         }
         [email protected]();
     }
 }