Exemplo n.º 1
0
        public static DoubleData FloatData2DoubleData(FloatData data)
        {
            int num = data.getValues().Length;

            double[] array  = new double[num];
            float[]  values = data.getValues();
            for (int i = 0; i < values.Length; i++)
            {
                array[i] = (double)values[i];
            }
            return(new DoubleData(array, data.getSampleRate(), data.getFirstSampleNumber()));
        }
Exemplo n.º 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);
        }
        public override Data getData()
        {
            Data data = this.getPredecessor().getData();

            if (null == this.transform || null == data || !(data is FloatData))
            {
                return(data);
            }
            FloatData floatData = (FloatData)data;

            float[] array = floatData.getValues();
            if (array.Length > this.transform[0].Length + 1)
            {
                string text = "dimenstion mismatch";

                throw new IllegalArgumentException(text);
            }
            float[] array2 = new float[this.transform.Length];
            for (int i = 0; i < this.transform.Length; i++)
            {
                for (int j = 0; j < array.Length; j++)
                {
                    float[] array3 = array2;
                    int     num    = i;
                    float[] array4 = array3;
                    array4[num] += this.transform[i][j] * array[j];
                }
            }
            if (array.Length > this.transform[0].Length)
            {
                for (int i = 0; i < this.transform.Length; i++)
                {
                    float[] array5 = array2;
                    int     num    = i;
                    float[] array4 = array5;
                    array4[num] += this.transform[i][array.Length];
                }
            }
            return(new FloatData(array2, floatData.getSampleRate(), floatData.getFirstSampleNumber()));
        }
Exemplo n.º 4
0
 public virtual float getScore(FloatData feature)
 {
     return(this.getScore(feature.getValues()));
 }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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]();
     }
 }