C# Class Accord.Audio.SampleConverter

Static methods to convert between different sample formats.

Code is mainly based on information available on the original C source code pa_converters.c from Portable Audio I/O Library.

This class try to be as fast as possible without using unsafe code.

Dither isn't currently supported. Currently supported conversions are 'to' and 'from' conversions between the following most common PCM format:

Integer 8-bit (byte) Integer 16-bit (Int16) Integer 32-bit (Int32) Single precision 32-bit floating point (float)

Mostrar archivo Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
Convert ( Int16 from, Int32 to ) : void

Converts a matrix of signed 16-bit integer samples into a matrix of 32-bit signed integer samples.

Convert ( Int16 from, byte to ) : void

Converts a matrix of signed 16-bit integer samples into a matrix of 8-bit unsigned byte samples.

Convert ( Int16 from, double to ) : void

Converts a matrix of signed 16-bit integer samples into a matrix of 64-bit floating point samples.

Convert ( Int16 from, float to ) : void

Converts a matrix of signed 16-bit integer samples into a matrix of 32-bit floating point samples.

Convert ( Int32 from, Int16 to ) : void

Converts a matrix of signed 32-bit integer samples into a matrix of 16-bit signed integer samples.

Convert ( Int32 from, Int32 to ) : void

Converts a array of signed 32-bit integer samples into a array of 32-bit floating point samples.

Convert ( Int32 from, byte to ) : void

Converts a matrix of signed 32-bit integer samples into a matrix of 8-bit unsigned byte samples.

Convert ( Int32 from, float to ) : void

Converts a matrix of signed 32-bit integer samples into a matrix of 32-bit float-point samples.

Convert ( byte from, Int16 to ) : void

Converts a matrix of unsigned 8-bit byte samples into a array of 16-bit short integer samples.

Convert ( byte from, float to ) : void

Converts a matrix of unsigned 8-bit byte samples into a matrix of 32-bit floating-point samples.

Convert ( byte from, int to ) : void

Converts a matrix of unsigned 8-bit byte samples into a matrix of 32-bit integer samples.

Convert ( float from, Int32 to ) : void

Converts a matrix of signed 32-bit integer samples into a matrix of 32-bit floating point samples.

Convert ( float from, byte to ) : void

Converts a matrix of signed 32-bit float samples into a matrix of 8-bit unsigned byte samples.

Convert ( float from, short to ) : void

Converts a matrix of 32-bit float samples into a matrix of 16-bit integer samples.

Method Details

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

Convert() public static method

Converts a matrix of signed 16-bit integer samples into a matrix of 8-bit unsigned byte samples.
public static Convert ( Int16 from, byte to ) : void
from System.Int16 The original sample.
to byte The resulting sample.
return void

Convert() public static method

Converts a matrix of signed 16-bit integer samples into a matrix of 64-bit floating point samples.
public static Convert ( Int16 from, double to ) : void
from System.Int16 The original sample.
to double The resulting sample.
return void

Convert() public static method

Converts a matrix of signed 16-bit integer samples into a matrix of 32-bit floating point samples.
public static Convert ( Int16 from, float to ) : void
from System.Int16 The original sample.
to float The resulting sample.
return void

Convert() public static method

Converts a matrix of signed 32-bit integer samples into a matrix of 16-bit signed integer samples.
public static Convert ( Int32 from, Int16 to ) : void
from System.Int32 The original sample.
to System.Int16 The resulting sample.
return void

Convert() public static method

Converts a array of signed 32-bit integer samples into a array of 32-bit floating point samples.
public static Convert ( Int32 from, Int32 to ) : void
from System.Int32 The original sample.
to System.Int32 The resulting sample.
return void

Convert() public static method

Converts a matrix of signed 32-bit integer samples into a matrix of 8-bit unsigned byte samples.
public static Convert ( Int32 from, byte to ) : void
from System.Int32 The original sample.
to byte The resulting sample.
return void

Convert() public static method

Converts a matrix of signed 32-bit integer samples into a matrix of 32-bit float-point samples.
public static Convert ( Int32 from, float to ) : void
from System.Int32 The original sample.
to float The resulting sample.
return void

Convert() public static method

Converts a matrix of unsigned 8-bit byte samples into a array of 16-bit short integer samples.
public static Convert ( byte from, Int16 to ) : void
from byte The original sample.
to System.Int16 The resulting sample.
return void

Convert() public static method

Converts a matrix of unsigned 8-bit byte samples into a matrix of 32-bit floating-point samples.
public static Convert ( byte from, float to ) : void
from byte The original sample.
to float The resulting sample.
return void

Convert() public static method

Converts a matrix of unsigned 8-bit byte samples into a matrix of 32-bit integer samples.
public static Convert ( byte from, int to ) : void
from byte The original sample.
to int The resulting sample.
return void

Convert() public static method

Converts a matrix of signed 32-bit integer samples into a matrix of 32-bit floating point samples.
public static Convert ( float from, Int32 to ) : void
from float The original sample.
to System.Int32 The resulting sample.
return void

Convert() public static method

Converts a matrix of signed 32-bit float samples into a matrix of 8-bit unsigned byte samples.
public static Convert ( float from, byte to ) : void
from float The original sample.
to byte The resulting sample.
return void

Convert() public static method

Converts a matrix of 32-bit float samples into a matrix of 16-bit integer samples.
public static Convert ( float from, short to ) : void
from float The original sample.
to short The resulting sample.
return void