Accord.Audio.SampleConverter.Convert C# (CSharp) Method

Convert() public static method

Converts a matrix of signed 16-bit integer samples into a matrix of 32-bit signed integer samples.
public static Convert ( Int16 from, Int32 to ) : void
from System.Int16 The original sample.
to System.Int32 The resulting sample.
return void
        public static void Convert(Int16[][] from, Int32[][] to)
        {
            for (int i = 0; i < from.Length; i++)
                for (int j = 0; j < from[0].Length; j++)
                    to[i][j] = (byte)(((from[i][j]) >> 8) + 128);
        }

Same methods

SampleConverter::Convert ( Int16 from, byte to ) : void
SampleConverter::Convert ( Int16 from, double to ) : void
SampleConverter::Convert ( Int16 from, float to ) : void
SampleConverter::Convert ( Int32 from, Int16 to ) : void
SampleConverter::Convert ( Int32 from, Int32 to ) : void
SampleConverter::Convert ( Int32 from, byte to ) : void
SampleConverter::Convert ( Int32 from, float to ) : void
SampleConverter::Convert ( byte from, Int16 to ) : void
SampleConverter::Convert ( byte from, float to ) : void
SampleConverter::Convert ( byte from, int to ) : void
SampleConverter::Convert ( float from, Int32 to ) : void
SampleConverter::Convert ( float from, byte to ) : void
SampleConverter::Convert ( float from, short to ) : void

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        ///   Copies this signal to a given array.
        /// </summary>
        ///
        public void CopyTo(double[] array)
        {
            if (format == Audio.SampleFormat.Format64BitIeeeFloat)
            {
                Buffer.BlockCopy(rawData, 0, array, 0, rawData.Length);
            }
            else if (format == Audio.SampleFormat.Format32BitIeeeFloat)
            {
                float[] source = new float[Samples];
                Buffer.BlockCopy(rawData, 0, source, 0, rawData.Length);
                for (int i = 0; i < source.Length; i++)
                {
                    array[i] = source[i];
                }
            }
            else if (format == Audio.SampleFormat.Format16Bit)
            {
                short[] source = new short[Samples];
                Buffer.BlockCopy(rawData, 0, source, 0, rawData.Length);
                SampleConverter.Convert(source, array);
            }

            else
            {
                throw new InvalidOperationException();
            }
        }
All Usage Examples Of Accord.Audio.SampleConverter::Convert
SampleConverter