C# Class Accord.Audio.Signal

Represents a PCM sound discrete signal (measured in time). A real discrete-time signal is defined as any real-valued function of the integers.

In signal processing, sampling is the reduction of a continuous signal to a discrete signal. A common example is the conversion of a sound wave (a continuous-time signal) to a sequence of samples (a discrete-time signal).

A sample refers to a value or set of values at a point in time and/or space.

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

Public Methods

Method Description
CopyTo ( Array array ) : void

Copies this signal to a given array.

CopyTo ( double array ) : void

Copies this signal to a given array.

CopyTo ( float array ) : void

Copies this signal to a given array.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

DurationOfSamples ( int samples, int samplingRate ) : int

Gets the duration of each sample in a signal with the given number of samples and sampling rate.

FromArray ( Array signal, int sampleRate, SampleFormat format = SampleFormat.Format32BitIeeeFloat ) : Signal

Creates a new Signal from a float array.

FromArray ( Array signal, int channels, int sampleRate, SampleFormat format = SampleFormat.Format32BitIeeeFloat ) : Signal

Creates a new Signal from a float array.

FromArray ( Array signal, int size, int channels, int sampleRate, SampleFormat format = SampleFormat.Format32BitIeeeFloat ) : Signal

Creates a new Signal from a float array.

GetEnergy ( ) : double

Computes the signal energy.

GetSample ( int channel, int position ) : float

Gets the value of the specified sample in the Signal.

GetSampleSize ( SampleFormat format ) : int

Gets the size (in bits) of a sample format.

NumberOfSamples ( int duration, int samplingRate ) : int

Gets the number of samples contained in a signal of given duration and sampling rate.

SetSample ( int channel, int position, float value ) : void

Sets the value of the specified sample in the Signal.

Signal ( byte data, int channels, int length, int sampleRate, SampleFormat format ) : System

Constructs a new signal.

Signal ( int channels, int length, int sampleRate, SampleFormat format ) : System

Constructs a new Signal.

ToComplex ( ) : ComplexSignal

Converts this signal to a ComplexSignal object.

ToDouble ( ) : double[]

Converts this signal into a array of floating-point samples.

ToFloat ( ) : float[]

Converts this signal into a array of floating-point samples.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases unmanaged and - optionally - managed resources

Private Methods

Method Description
init ( byte data, int channels, int length, int sampleRate, SampleFormat format ) : void

Method Details

CopyTo() public method

Copies this signal to a given array.
public CopyTo ( Array array ) : void
array System.Array
return void

CopyTo() public method

Copies this signal to a given array.
public CopyTo ( double array ) : void
array double
return void

CopyTo() public method

Copies this signal to a given array.
public CopyTo ( float array ) : void
array float
return void

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

Dispose() protected method

Releases unmanaged and - optionally - managed resources
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed /// and unmanaged resources; false to release only unmanaged /// resources.
return void

DurationOfSamples() public static method

Gets the duration of each sample in a signal with the given number of samples and sampling rate.
public static DurationOfSamples ( int samples, int samplingRate ) : int
samples int
samplingRate int
return int

FromArray() public static method

Creates a new Signal from a float array.
public static FromArray ( Array signal, int sampleRate, SampleFormat format = SampleFormat.Format32BitIeeeFloat ) : Signal
signal System.Array
sampleRate int
format SampleFormat
return Signal

FromArray() public static method

Creates a new Signal from a float array.
public static FromArray ( Array signal, int channels, int sampleRate, SampleFormat format = SampleFormat.Format32BitIeeeFloat ) : Signal
signal System.Array
channels int
sampleRate int
format SampleFormat
return Signal

FromArray() public static method

Creates a new Signal from a float array.
public static FromArray ( Array signal, int size, int channels, int sampleRate, SampleFormat format = SampleFormat.Format32BitIeeeFloat ) : Signal
signal System.Array
size int
channels int
sampleRate int
format SampleFormat
return Signal

GetEnergy() public method

Computes the signal energy.
public GetEnergy ( ) : double
return double

GetSample() public method

Gets the value of the specified sample in the Signal.
public GetSample ( int channel, int position ) : float
channel int The channel's index of the sample to set.
position int The position of the sample to set.
return float

GetSampleSize() public static method

Gets the size (in bits) of a sample format.
public static GetSampleSize ( SampleFormat format ) : int
format SampleFormat
return int

NumberOfSamples() public static method

Gets the number of samples contained in a signal of given duration and sampling rate.
public static NumberOfSamples ( int duration, int samplingRate ) : int
duration int
samplingRate int
return int

SetSample() public method

Sets the value of the specified sample in the Signal.
public SetSample ( int channel, int position, float value ) : void
channel int The channel's index of the sample to set.
position int The position of the sample to set.
value float A floating-point value ranging from -1 to 1 /// specifying the value to set. Conversion will be done automatically /// to the underlying signal sample format if supported.
return void

Signal() public method

Constructs a new signal.
public Signal ( byte data, int channels, int length, int sampleRate, SampleFormat format ) : System
data byte The raw data for the signal.
channels int The number of channels for the signal.
length int The length of the signal.
sampleRate int The sample date of the signal.
format SampleFormat The sample format for the signal.
return System

Signal() public method

Constructs a new Signal.
public Signal ( int channels, int length, int sampleRate, SampleFormat format ) : System
channels int The number of channels for the signal.
length int The length of the signal.
sampleRate int The sample date of the signal.
format SampleFormat The sample format for the signal.
return System

ToComplex() public method

Converts this signal to a ComplexSignal object.
public ToComplex ( ) : ComplexSignal
return ComplexSignal

ToDouble() public method

Converts this signal into a array of floating-point samples.
public ToDouble ( ) : double[]
return double[]

ToFloat() public method

Converts this signal into a array of floating-point samples.
public ToFloat ( ) : float[]
return float[]