Exemple #1
0
 private void allocate()
 {
     if (this.weights == null)
     {
         this.allocateWeights();
     }
     if (this.means == null)
     {
         this.loglikes = new float[this.ngauss];
         int   num   = this.ngauss;
         int   num2  = this.ncoefs;
         int[] array = new int[2];
         int   num3  = num2;
         array[1]   = num3;
         num3       = num;
         array[0]   = num3;
         this.means = (float[][])ByteCodeHelper.multianewarray(typeof(float[][]).TypeHandle, array);
         int num4 = this.ngauss;
         int num5 = this.ncoefs;
         array      = new int[2];
         num3       = num5;
         array[1]   = num3;
         num3       = num4;
         array[0]   = num3;
         this.covar = (float[][])ByteCodeHelper.multianewarray(typeof(float[][]).TypeHandle, array);
         this.logPreComputedGaussianFactor = new float[this.ngauss];
     }
 }
Exemple #2
0
        public KMP(string str)
        {
            this.R   = 256;
            this.pat = str;
            int num      = java.lang.String.instancehelper_length(str);
            int arg_35_0 = this.R;
            int arg_30_0 = num;

            int[] array = new int[2];
            int   num2  = arg_30_0;

            array[1] = num2;
            num2     = arg_35_0;
            array[0] = num2;
            this.dfa = (int[][])ByteCodeHelper.multianewarray(typeof(int[][]).TypeHandle, array);
            this.dfa[(int)java.lang.String.instancehelper_charAt(str, 0)][0] = 1;
            int num3 = 0;

            for (int i = 1; i < num; i++)
            {
                for (int j = 0; j < this.R; j++)
                {
                    this.dfa[j][i] = this.dfa[j][num3];
                }
                this.dfa[(int)java.lang.String.instancehelper_charAt(str, i)][i] = i + 1;
                num3 = this.dfa[(int)java.lang.String.instancehelper_charAt(str, i)][num3];
            }
        }
Exemple #3
0
        private void computeMllrTransforms(double[][][][][] array, double[][][][] array2)
        {
            for (int c = 0; c < this.nrOfClusters; c++)
            {
                this.As[c] = new float[this.loader.getNumStreams()][][];
                this.Bs[c] = new float[this.loader.getNumStreams()][];
                for (int i = 0; i < this.loader.getNumStreams(); i++)
                {
                    int         len    = this.loader.getVectorLength()[i];
                    float[][][] array3 = this.As[c];
                    int         num2   = i;
                    int         num3   = len;
                    int         num4   = len;
                    int[]       array4 = new int[2];
                    int         num5   = num4;
                    array4[1]     = num5;
                    num5          = num3;
                    array4[0]     = num5;
                    array3[num2]  = (float[][])ByteCodeHelper.multianewarray(typeof(float[][]).TypeHandle, array4);
                    this.Bs[c][i] = new float[len];

                    for (int j = 0; j < len; j++)
                    {
#if USE_MAPACK
                        //TODO: need to check if the math is correct
                        Matrix m = new Matrix(array[c][i][j]);

                        int rs = array2[c][i][j].Length;

                        Matrix rv = new Matrix(rs, 1);

                        for (int r = 0; r < rs; r++)
                        {
                            rv[r, 0] = array2[c][i][j][r];
                        }

                        Matrix solved = m.Solve(rv);

                        for (int k = 0; k < len; k++)
                        {
                            this.As[c][i][j][k] = (float)solved[k, 0];
                        }
                        //TODO: there may be a problem of index out of range?
                        //(index == len)?
                        this.Bs[c][i][j] = (float)solved[len, 0];
#else
                        Array2DRowRealMatrix matrix     = new Array2DRowRealMatrix(array[c][i][j], false);
                        DecompositionSolver  solver     = new LUDecomposition(matrix).getSolver();
                        ArrayRealVector      rv         = new ArrayRealVector(array2[c][i][j], false);
                        RealVector           realVector = solver.solve(rv);
                        for (int k = 0; k < len; k++)
                        {
                            this.As[c][i][j][k] = (float)realVector.getEntry(k);
                        }
                        this.Bs[c][i][j] = (float)realVector.getEntry(len);
#endif
                    }
                }
            }
        }
Exemple #4
0
        public Picture(File f)
        {
            this.isOriginUpperLeft = true;
            IOException ex;

            try
            {
                this.image = ImageIO.read(f);
            }
            catch (IOException arg_20_0)
            {
                ex = ByteCodeHelper.MapException <IOException>(arg_20_0, ByteCodeHelper.MapFlags.NoRemapping);
                goto IL_2A;
            }
            if (this.image == null)
            {
                string arg_82_0 = new StringBuilder().append("Invalid image file: ").append(f).toString();

                throw new RuntimeException(arg_82_0);
            }
            this.width    = this.image.getWidth(null);
            this.height   = this.image.getHeight(null);
            this.filename = f.getName();
            return;

IL_2A:
            IOException this2 = ex;

            Throwable.instancehelper_printStackTrace(this2);
            string arg_55_0 = new StringBuilder().append("Could not open file: ").append(f).toString();

            throw new RuntimeException(arg_55_0);
        }
Exemple #5
0
 protected internal virtual void computeSpectrogram()
 {
     try
     {
         AudioDataInputStream audioDataInputStream = new AudioDataInputStream(this.audio);
         this.dataSource.setInputStream(audioDataInputStream);
         ArrayList arrayList = new ArrayList();
         double    num       = double.Epsilon;
         Data      data      = this.frontEnd.getData();
         int       i;
         while (!(data is DataEndSignal))
         {
             if (data is DoubleData)
             {
                 double[] values = ((DoubleData)data).getValues();
                 double[] array  = new double[values.Length];
                 for (i = 0; i < array.Length; i++)
                 {
                     array[i] = Math.max(Math.log(values[i]), (double)0f);
                     if (array[i] > num)
                     {
                         num = array[i];
                     }
                 }
                 arrayList.add(array);
             }
             data = this.frontEnd.getData();
         }
         audioDataInputStream.close();
         int num2 = arrayList.size();
         int num3 = ((double[])arrayList.get(0)).Length;
         i = num3 - 1;
         Dimension dimension = new Dimension(num2, num3);
         this.setMinimumSize(dimension);
         this.setMaximumSize(dimension);
         this.setPreferredSize(dimension);
         this.spectrogram = new BufferedImage(num2, num3, 1);
         double num4 = (255.0 + this.offsetFactor) / num;
         for (int j = 0; j < num2; j++)
         {
             double[] array2 = (double[])arrayList.get(j);
             for (int k = i; k >= 0; k--)
             {
                 int num5 = ByteCodeHelper.d2i(array2[k] * num4 - this.offsetFactor);
                 num5 = Math.max(num5, 0);
                 num5 = 255 - num5;
                 int num6 = (num5 << 16 & 16711680) | (num5 << 8 & 65280) | (num5 & 255);
                 this.spectrogram.setRGB(j, i - k, num6);
             }
         }
         ReplicateScaleFilter replicateScaleFilter = new ReplicateScaleFilter(ByteCodeHelper.f2i(this.zoom * (float)num2), num3);
         this.scaledSpectrogram = this.createImage(new FilteredImageSource(this.spectrogram.getSource(), replicateScaleFilter));
         Dimension size = this.getSize();
         this.repaint(0L, 0, 0, size.width - 1, size.height - 1);
     }
     catch (System.Exception ex)
     {
         Throwable.instancehelper_printStackTrace(ex);
     }
 }
    private void clearBuffer()
    {
        if (this.N == 0)
        {
            return;
        }
        if (this.N > 0)
        {
            this.buffer <<= 8 - this.N;
        }
        IOException ex;

        try
        {
            [email protected](this.buffer);
        }
        catch (IOException arg_40_0)
        {
            ex = ByteCodeHelper.MapException <IOException>(arg_40_0, ByteCodeHelper.MapFlags.NoRemapping);
            goto IL_4A;
        }
        goto IL_56;
IL_4A:
        IOException this2 = ex;

        Throwable.instancehelper_printStackTrace(this2);
IL_56:
        this.N      = 0;
        this.buffer = 0;
    }
Exemple #7
0
        private Pool createDummyMatrixPool(string text)
        {
            Pool pool = new Pool(text);
            int  num  = this.vectorLength;
            int  num2 = this.vectorLength;

            int[] array = new int[2];
            int   num3  = num2;

            array[1] = num3;
            num3     = num;
            array[0] = num3;
            float[][] array2 = (float[][])ByteCodeHelper.multianewarray(typeof(float[][]).TypeHandle, array);
            this.logger.info(new StringBuilder().append("creating dummy matrix pool ").append(text).toString());
            for (int i = 0; i < this.vectorLength; i++)
            {
                for (int j = 0; j < this.vectorLength; j++)
                {
                    if (i == j)
                    {
                        array2[i][j] = 1f;
                    }
                    else
                    {
                        array2[i][j] = 0f;
                    }
                }
            }
            pool.put(0, array2);
            return(pool);
        }
        private static short[] getRecordedAudio(Microphone microphone)
        {
            short[] array = new short[0];
            int     num   = 8000;

            while (microphone.hasMoreData())
            {
                try
                {
                    Data data = microphone.getData();
                    if (data is DoubleData)
                    {
                        num = ((DoubleData)data).getSampleRate();
                        double[] values = ((DoubleData)data).getValues();
                        short[]  array2 = Arrays.copyOf(array, array.Length + values.Length);
                        for (int i = 0; i < values.Length; i++)
                        {
                            array2[array.Length + i] = (short)ByteCodeHelper.d2i(values[i]);
                        }
                        array = array2;
                    }
                }
                catch (System.Exception ex)
                {
                    Throwable.instancehelper_printStackTrace(ex);
                }
                continue;
            }
            if (num > 8000)
            {
                [email protected](new StringBuilder().append("Downsampling from ").append(num).append(" to 8000.").toString());
                array = Downsampler.downsample(array, num / 1000, 16);
            }
            return(array);
        }
Exemple #9
0
 public virtual void update(Transform transform, ClusteredDensityFileData clusters)
 {
     for (int i = 0; i < this.meansPool.size(); i++)
     {
         int     classIndex = clusters.getClassIndex(i);
         float[] array      = new float[this.getVectorLength()[0]];
         float[] array2     = (float[])this.meansPool.get(i);
         for (int j = 0; j < this.numStreams; j++)
         {
             for (int k = 0; k < this.getVectorLength()[j]; k++)
             {
                 array[k] = 0f;
                 int     num;
                 float[] array4;
                 for (int l = 0; l < this.getVectorLength()[j]; l++)
                 {
                     float[] array3 = array;
                     num          = k;
                     array4       = array3;
                     array4[num] += transform.getAs()[classIndex][j][k][l] * array2[l];
                 }
                 float[] array5 = array;
                 num          = k;
                 array4       = array5;
                 array4[num] += transform.getBs()[classIndex][j][k];
             }
             ByteCodeHelper.arraycopy_primitive_4(array, 0, array2, 0, array.Length);
         }
     }
 }
Exemple #10
0
        public virtual double[] getBilinearCepstra(double warp, int nbilincepstra)
        {
            int num = this.cepstrumOrder;

            int[] array = new int[2];
            int   num2  = num;

            array[1] = num2;
            array[0] = nbilincepstra;
            double[][] array2 = (double[][])ByteCodeHelper.multianewarray(typeof(double[][]).TypeHandle, array);
            double[]   array3 = Arrays.copyOf(this.cepstra, this.cepstrumOrder);
            this.bilinearCepstra[0] = array3[0];
            array3[0] = (double)0f;
            array2[0][this.cepstrumOrder - 1] = array3[this.cepstrumOrder - 1];
            for (int i = 1; i < nbilincepstra; i++)
            {
                array2[i][this.cepstrumOrder - 1] = (double)0f;
            }
            for (int i = this.cepstrumOrder - 2; i >= 0; i--)
            {
                array2[0][i] = warp * array2[0][i + 1] + array3[i];
                array2[1][i] = ((double)1f - warp * warp) * array2[0][i + 1] + warp * array2[1][i + 1];
                for (int j = 2; j < nbilincepstra; j++)
                {
                    array2[j][i] = warp * (array2[j][i + 1] - array2[j - 1][i]) + array2[j - 1][i + 1];
                }
            }
            for (int i = 1; i <= nbilincepstra; i++)
            {
                this.bilinearCepstra[i] = array2[i][0];
            }
            return(this.bilinearCepstra);
        }
 public string execute(CommandInterpreter commandInterpreter, string[] array)
 {
     if (array.Length == 2)
     {
         try
         {
             try
             {
                 float num = Float.parseFloat(array[1]);
                 Thread.sleep(ByteCodeHelper.f2l(num * 1000f));
             }
             catch (NumberFormatException)
             {
                 this.this_0.putResponse("Usage: delay time-in-seconds");
             }
         }
         catch (InterruptedException)
         {
         }
     }
     else
     {
         this.this_0.putResponse("Usage: delay time-in-seconds");
     }
     return("");
 }
Exemple #12
0
 public static void Main(string[] args)
 {
     try
     {
         var minecraftserver = new MinecraftServer();
         if (!GraphicsEnvironment.isHeadless() &&
             ((args.Length <= 0) || !String.instancehelper_equals(args[0], "nogui")))
         {
             ServerGUI.initGui(minecraftserver);
         }
         new ThreadServerApplication("Server thread", minecraftserver).start();
     }
     catch (java.lang.Exception exception1)
     {
         var local1 = ByteCodeHelper.MapException <java.lang.Exception>(exception1, ByteCodeHelper.MapFlags.None);
         if (local1 == null)
         {
             throw;
         }
         java.lang.Exception exception  = local1;
         java.lang.Exception exception2 = exception;
         logger.log(Level.SEVERE, "Failed to start the minecraft server", exception2);
         return;
     }
 }
Exemple #13
0
        public virtual double[] reflectionCoeffsToARParameters(double[] RC, int lpcorder)
        {
            int num  = lpcorder + 1;
            int num2 = lpcorder + 1;

            int[] array = new int[2];
            int   num3  = num2;

            array[1] = num3;
            num3     = num;
            array[0] = num3;
            double[][] array2 = (double[][])ByteCodeHelper.multianewarray(typeof(double[][]).TypeHandle, array);
            this.order            = lpcorder;
            this.reflectionCoeffs = (double[])RC.Clone();
            for (int i = 1; i <= lpcorder; i++)
            {
                for (int j = 1; j < i; j++)
                {
                    array2[i][j] = array2[i - 1][j] - RC[i] * array2[i - 1][i - j];
                }
                array2[i][i] = RC[i];
            }
            this.ARParameters[0] = (double)1f;
            for (int i = 1; i <= lpcorder; i++)
            {
                this.ARParameters[i] = array2[i][i];
            }
            return(this.ARParameters);
        }
Exemple #14
0
        public static void log(string message, string extra, bool newLine, int index, bool time)
        {
            int num = (int)newLine;

            try
            {
                extra = new StringBuilder().append("{").append(new SimpleDateFormat("MM/dd|HH:mm:ss").format(Calendar.getInstance().getTime())).append("}=> ").append(extra).append(": ").toString();
                System.get_out().println(new StringBuilder().append(extra).append(message).toString());
                if (file_logging)
                {
                    File file = new File(new StringBuilder().append(log_path).append(file_name).append((index > 0) ? Integer.valueOf(index) : "").append(".log").toString());
                    if (!file.exists())
                    {
                        File.__ <clinit>();
                        new File(log_path).mkdirs();
                        file.createNewFile();
                    }
                    OpenOption[] optionArray1 = new OpenOption[] { StandardOpenOption.APPEND };
                    Files.write(file.toPath(), String.instancehelper_getBytes(new StringBuilder().append(extra).append(message).append((num == 0) ? "" : "\r\n").toString(), "utf-8"), optionArray1);
                }
            }
            catch (Exception exception1)
            {
                if (ByteCodeHelper.MapException <Exception>(exception1, 2) == null)
                {
                    throw;
                }
                return;
            }
        }
 public virtual void mousePressed(MouseEvent evt)
 {
     this.xDragStart = java.lang.Math.max(0, evt.getX());
     this.setSelectionStart(ByteCodeHelper.f2i((float)this.xDragStart / this.xScale));
     this.setSelectionEnd(ByteCodeHelper.f2i((float)this.xDragStart / this.xScale));
     this.repaint();
 }
Exemple #16
0
        private LogMath()
        {
            this.naturalLogBase        = (float)Math.log((double)LogMath.logBase);
            this.inverseNaturalLogBase = 1f / this.naturalLogBase;
            if (LogMath.useTable)
            {
                int num = ByteCodeHelper.d2i(-Math.rint((double)this.linearToLog(this.logToLinear(0.5f) - (double)1f)));
                if (num > 150000)
                {
                    num = 150000;
                }
                if (num <= 0)
                {
                    string text = new StringBuilder().append("The log base ").append(LogMath.logBase).append(" yields a very small addTable. Either choose not to use the addTable, or choose a logBase closer to 1.0").toString();

                    throw new IllegalArgumentException(text);
                }
                this.theAddTable = new float[num];
                for (int i = 0; i < num; i++)
                {
                    float num2 = (float)this.logToLinear((float)(-(float)i));
                    num2 += 1f;
                    this.theAddTable[i] = this.linearToLog((double)num2);
                }
            }
        }
Exemple #17
0
        public KMP(char[] charr, int i)
        {
            this.R       = i;
            this.pattern = new char[charr.Length];
            int j;

            for (j = 0; j < charr.Length; j++)
            {
                this.pattern[j] = charr[j];
            }
            j = charr.Length;
            int arg_41_0 = j;

            int[] array = new int[2];
            int   num   = arg_41_0;

            array[1] = num;
            array[0] = i;
            this.dfa = (int[][])ByteCodeHelper.multianewarray(typeof(int[][]).TypeHandle, array);
            this.dfa[(int)charr[0]][0] = 1;
            int num2 = 0;

            for (int k = 1; k < j; k++)
            {
                for (int l = 0; l < i; l++)
                {
                    this.dfa[l][k] = this.dfa[l][num2];
                }
                this.dfa[(int)charr[k]][k] = k + 1;
                num2 = this.dfa[(int)charr[k]][num2];
            }
        }
    private void writeByte(int num)
    {
        if (!BinaryOut.s_assertionsDisabled && (num < 0 || num >= 256))
        {
            throw new AssertionError();
        }
        if (this.N == 0)
        {
            IOException ex;
            try
            {
                [email protected](num);
            }
            catch (IOException arg_37_0)
            {
                ex = ByteCodeHelper.MapException <IOException>(arg_37_0, ByteCodeHelper.MapFlags.NoRemapping);
                goto IL_41;
            }
            return;

IL_41:
            IOException this2 = ex;
            Throwable.instancehelper_printStackTrace(this2);
            return;
        }
        for (int i = 0; i < 8; i++)
        {
            int num2 = (((uint)num >> 8 - i - 1 & 1u) == 1u) ? 1 : 0;
            this.writeBit(num2 != 0);
        }
    }
Exemple #19
0
        private void paintVUMeter(Graphics graphics)
        {
            int num  = ByteCodeHelper.d2i(this.vu.getRmsDB() / this.vu.getMaxDB() * 50.0);
            int num2 = ByteCodeHelper.d2i(this.vu.getPeakDB() / this.vu.getMaxDB() * 50.0);

            if (!VUMeterPanel.assertionsDisabled && num < 0)
            {
                throw new AssertionError();
            }
            if (!VUMeterPanel.assertionsDisabled && num >= 50)
            {
                throw new AssertionError();
            }
            Dimension size  = this.getSize();
            int       width = size.width;
            int       num3  = size.height / 50;

            graphics.setColor(Color.BLACK);
            graphics.fillRect(0, 0, size.width - 1, size.height - 1);
            for (int i = 0; i < num; i++)
            {
                this.setLevelColor(i, graphics);
                graphics.fillRect(1, size.height - i * num3 + 1, width - 2, num3 - 2);
            }
            this.setLevelColor(num2, graphics);
            graphics.fillRect(1, size.height - num2 * num3 + 1, width - 2, num3 - 2);
        }
        private DoubleData readNextFrame()
        {
            int num  = 0;
            int num2 = this.bytesPerRead;

            byte[]     array             = new byte[this.bytesPerRead];
            long       firstSampleNumber = this.totalValuesRead;
            DoubleData result;

            try
            {
                int num3;
                do
                {
                    num3 = this.dataStream.read(array, num, num2 - num);
                    if (num3 > 0)
                    {
                        num += num3;
                    }
                }while (num3 != -1 && num < num2);
                if (num > 0)
                {
                    long num4 = this.totalValuesRead;
                    int  num5 = num;
                    int  num6 = this.bytesPerValue;
                    this.totalValuesRead = num4 + (long)((num6 != -1) ? (num5 / num6) : (-(long)num5));
                    if (num < num2)
                    {
                        bool flag = num != 0;
                        int  num7 = 2;
                        num = ((num7 != -1 && (flag ? 1 : 0) % num7 != 0) ? (num + 3) : (num + 2));
                        byte[] array2 = new byte[num];
                        ByteCodeHelper.arraycopy_primitive_1(array, 0, array2, 0, num);
                        array = array2;
                        this.closeDataStream();
                    }
                    goto IL_B9;
                }
                this.closeDataStream();
                result = null;
            }
            catch (IOException ex)
            {
                throw new DataProcessingException("Error reading data", ex);
            }
            return(result);

IL_B9:
            double[] values;
            if (this.bigEndian)
            {
                values = DataUtil.bytesToValues(array, 0, num, this.bytesPerValue, this.signedData);
            }
            else
            {
                values = DataUtil.littleEndianBytesToValues(array, 0, num, this.bytesPerValue, this.signedData);
            }
            return(new DoubleData(values, this.sampleRate, firstSampleNumber));
        }
Exemple #21
0
 private void copyVector(float[] array, float[] array2)
 {
     if (!HMMPoolManager.assertionsDisabled && array.Length != array2.Length)
     {
         throw new AssertionError();
     }
     ByteCodeHelper.arraycopy_primitive_4(array, 0, array2, 0, array.Length);
 }
        internal static int getRandomValueFromInterval(double num1, double num6, int num5)
        {
            double num  = num1 * num5;
            double num2 = num5 - num;
            double num3 = num5 + num;

            return(ByteCodeHelper.d2i(num2 + (num6 * ((num3 - num2) + 1f))));
        }
        protected override void paintComponent(Graphics g)
        {
            base.paintComponent(g);
            Dimension size = this.getSize();
            int       num  = size.height / 2;

            short[]   audioData = this.audio.getAudioData();
            JViewport viewport  = this.getViewport();
            int       num2;
            int       num3;

            if (viewport != null)
            {
                Rectangle viewRect = viewport.getViewRect();
                num2 = ByteCodeHelper.d2i(viewRect.getX());
                num3 = ByteCodeHelper.d2i(viewRect.getWidth());
            }
            else
            {
                num2 = 0;
                num3 = ByteCodeHelper.f2i((float)audioData.Length * this.xScale);
            }
            g.setColor(Color.WHITE);
            g.fillRect(num2, 0, num3, size.height - 1);
            int num4 = java.lang.Math.max(0, this.getSelectionStart());
            int num5 = ByteCodeHelper.f2i((float)num4 * this.xScale);

            num4 = this.getSelectionEnd();
            if (num4 == -1)
            {
                num4 = audioData.Length - 1;
            }
            int num6 = ByteCodeHelper.f2i((float)num4 * this.xScale);

            g.setColor(Color.LIGHT_GRAY);
            g.fillRect(num5, 0, num6 - num5, size.height - 1);
            int[] array  = new int[num3];
            int[] array2 = new int[num3];
            for (int i = 0; i < num3; i++)
            {
                array[i] = num2;
                num4     = ByteCodeHelper.f2i((float)num2 / this.xScale);
                if (num4 >= audioData.Length)
                {
                    break;
                }
                array2[i] = num - ByteCodeHelper.f2i((float)audioData[num4] * this.yScale);
                num2++;
            }
            g.setColor(Color.RED);
            g.drawPolyline(array, array2, num3);
            for (int i = 0; i < this.labelTimes.Length; i++)
            {
                num2 = ByteCodeHelper.f2i(this.xScale * this.labelTimes[i] * this.audio.getAudioFormat().getSampleRate());
                g.drawLine(num2, 0, num2, size.height - 1);
                g.drawString(this.labels[i], num2 + 5, size.height - 5);
            }
        }
            public AudioInputStream nextElement()
            {
                AudioInputStream result = null;

                if (this.lastFile == null)
                {
                    ConcatAudioFileDataSource.access_002(this.this_0, this.readNext());
                }
                if (ConcatAudioFileDataSource.access_000(this.this_0) != null)
                {
                    try
                    {
                        try
                        {
                            AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(ConcatAudioFileDataSource.access_000(this.this_0));
                            AudioFormat      format           = audioInputStream.getFormat();
                            if (!ConcatAudioFileDataSource.access_100(this.this_0))
                            {
                                ConcatAudioFileDataSource.access_102(this.this_0, true);
                                this.this_0.bigEndian     = format.isBigEndian();
                                this.this_0.sampleRate    = ByteCodeHelper.f2i(format.getSampleRate());
                                this.this_0.signedData    = format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED);
                                this.this_0.bytesPerValue = format.getSampleSizeInBits() / 8;
                            }
                            if (format.getSampleRate() != (float)this.this_0.sampleRate || format.getChannels() != 1 || format.isBigEndian() != this.this_0.bigEndian)
                            {
                                string text = "format mismatch for subsequent files";

                                throw new RuntimeException(text);
                            }
                            result = audioInputStream;
                            ConcatAudioFileDataSource.access_200(this.this_0).finer(new StringBuilder().append("Strating processing of '").append(this.lastFile.getFile()).append('\'').toString());
                            Iterator iterator = this.this_0.__fileListeners.iterator();
                            while (iterator.hasNext())
                            {
                                AudioFileProcessListener audioFileProcessListener  = (AudioFileProcessListener)iterator.next();
                                AudioFileProcessListener audioFileProcessListener2 = audioFileProcessListener;
                                audioFileProcessListener2.audioFileProcStarted(new File(ConcatAudioFileDataSource.access_000(this.this_0).getFile()));
                            }
                            this.lastFile = ConcatAudioFileDataSource.access_000(this.this_0);
                            ConcatAudioFileDataSource.access_002(this.this_0, null);
                        }
                        catch (IOException ex)
                        {
                            Throwable.instancehelper_printStackTrace(ex);

                            throw new Error(new StringBuilder().append("Cannot convert ").append(ConcatAudioFileDataSource.access_000(this.this_0)).append(" to a FileInputStream").toString());
                        }
                    }
                    catch (UnsupportedAudioFileException ex3)
                    {
                        Throwable.instancehelper_printStackTrace(ex3);
                    }
                    return(result);
                }
                return(result);
            }
Exemple #25
0
        public CommandAPDU(byte[] apdu, int apduOffset, int apduLength)
        {
            CommandAPDU commandApdu = this;

            CheckArrayBounds(apdu, apduOffset, apduLength);
            _apdu = new byte[apduLength];
            ByteCodeHelper.ArrayCopy(apdu, apduOffset, _apdu, 0, apduLength);
            Parse();
        }
Exemple #26
0
            public override void run()
            {
                this.totalSamplesRead = 0L;
                Microphone.access_200(this.this_0).info("started recording");
                if (Microphone.access_300(this.this_0))
                {
                    Microphone.access_402(this.this_0, new Utterance("Microphone", Microphone.access_500(this.this_0).getFormat()));
                }
                Microphone.access_700(this.this_0).add(new DataStartSignal(Microphone.access_600(this.this_0)));
                Microphone.access_800(this.this_0).info("DataStartSignal added");
                IOException ex2;

                try
                {
                    Microphone.access_100(this.this_0).start();
                    while (!this.done)
                    {
                        Data data = this.readData(Microphone.access_400(this.this_0));
                        if (data == null)
                        {
                            this.done = true;
                            break;
                        }
                        Microphone.access_700(this.this_0).add(data);
                    }
                    Microphone.access_100(this.this_0).flush();
                    if (Microphone.access_900(this.this_0))
                    {
                        Microphone.access_500(this.this_0).close();
                        Microphone.access_100(this.this_0).close();
                        java.lang.System.err.println("set to null");
                        Microphone.access_102(this.this_0, null);
                    }
                }
                catch (IOException ex)
                {
                    ex2 = ex;
                    goto IL_138;
                }
                goto IL_173;
IL_138:
                IOException ex3 = ex2;

                Microphone.access_1000(this.this_0).warning(new StringBuilder().append("IO Exception ").append(Throwable.instancehelper_getMessage(ex3)).toString());
                Throwable.instancehelper_printStackTrace(ex3);
IL_173:
                long duration = ByteCodeHelper.d2l((double)this.totalSamplesRead / (double)Microphone.access_500(this.this_0).getFormat().getSampleRate() * 1000.0);

                Microphone.access_700(this.this_0).add(new DataEndSignal(duration));
                Microphone.access_1100(this.this_0).info("DataEndSignal ended");
                Microphone.access_1200(this.this_0).info("stopped recording");
                lock (this.@lock)
                {
                    Object.instancehelper_notify(this.@lock);
                }
            }
        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);
            }
        }
Exemple #28
0
 public virtual byte[] cleanData()
 {
     if ((this.offset == 0) && (this.len == this.data.Length))
     {
         return(this.data);
     }
     byte[] buffer = new byte[this.len];
     ByteCodeHelper.arraycopy_primitive_1(this.data, this.offset, buffer, 0, this.len);
     return(buffer);
 }
        public Sinusoid(double frequency, double phase, double amplitude, double duration)
        {
            this.shorts = new short[ByteCodeHelper.d2i(8000.0 * duration)];
            double num = frequency * 2.0 * 3.1415926535897931 / 8000.0;

            for (int i = 0; i < this.shorts.Length; i++)
            {
                this.shorts[i] = (short)ByteCodeHelper.d2i(amplitude * java.lang.Math.cos(num * (double)i + phase));
            }
        }
Exemple #30
0
        private float addTable(float num)
        {
            int num2 = ByteCodeHelper.d2i((double)num + 0.5);

            if (num2 < this.theAddTable.Length)
            {
                return(this.theAddTable[num2]);
            }
            return(0f);
        }