ComplexSignal Class |
Namespace: Accord.Audio
The ComplexSignal type exposes the following members.
Name | Description | |
---|---|---|
ComplexSignal(Int32, Int32, Int32) |
Constructs a new Complex Signal
| |
ComplexSignal(Byte, Int32, Int32, Int32) |
Constructs a new Complex Signal
| |
ComplexSignal(Byte, Int32, Int32, Int32, ComplexSignalStatus) |
Constructs a new Complex Signal
|
Name | Description | |
---|---|---|
Channels |
Gets the number of channels of this signal.
(Inherited from Signal.) | |
Data |
Gets a pointer to the first sample of the signal.
(Inherited from Signal.) | |
Duration |
Gets the signal duration in milliseconds.
(Inherited from Signal.) | |
Length |
Gets the number of samples in each channel of this signal,
as known as the number of frames in the signal.
(Inherited from Signal.) | |
RawData |
Gets the raw binary data representing the signal.
(Inherited from Signal.) | |
SampleFormat |
Gets the sample format used by this signal.
(Inherited from Signal.) | |
SampleRate |
Gets the number of samples per second for this signal.
(Inherited from Signal.) | |
Samples |
Gets the total number of samples in this signal.
(Inherited from Signal.) | |
Status |
Gets the status of the signal - Fourier transformed,
Hilbert transformed (analytic) or real.
|
Name | Description | |
---|---|---|
BackwardFourierTransform |
Applies backward fast Fourier transformation to the complex signal.
| |
BackwardHilbertTransform |
Applies backward Hilbert transformation to the complex signal.
| |
Combine |
Combines a set of windows into one full signal.
| |
CopyTo(Array) |
Copies this signal to a given array.
(Inherited from Signal.) | |
CopyTo(Double) |
Copies this signal to a given array.
(Inherited from Signal.) | |
CopyTo(Single) |
Copies this signal to a given array.
(Inherited from Signal.) | |
Dispose |
Performs application-defined tasks associated with freeing,
releasing, or resetting unmanaged resources.
(Inherited from Signal.) | |
Dispose(Boolean) |
Releases unmanaged and - optionally - managed resources
(Inherited from Signal.) | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize |
Releases unmanaged resources and performs other cleanup operations
before the Signal is reclaimed by garbage collection.
(Inherited from Signal.) | |
ForwardFourierTransform |
Applies forward fast Fourier transformation to the complex signal.
| |
ForwardHilbertTransform |
Applies forward Hilbert transformation to the complex signal.
| |
FromArray(Complex, Int32) |
Create complex signal from complex array.
| |
FromArray(Single, Int32) |
Create multichannel complex signal from floating-point matrix.
| |
FromArray(Complex, Int32, ComplexSignalStatus) |
Create complex signal from complex array.
| |
FromSignal |
Create multichannel complex signal from floating-point matrix.
| |
GetChannel |
Extracts a channel from the signal.
| |
GetEnergy |
Computes the signal energy.
(Inherited from Signal.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetSample |
Gets the value of the specified sample in the Signal.
(Inherited from Signal.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
SetSample |
Sets the value of the specified sample in the Signal.
(Inherited from Signal.) | |
ToArray |
Converts the complex signal to a complex array.
| |
ToArray(Int32) |
Converts the complex signal to a complex array.
| |
ToComplex |
Converts this signal to a ComplexSignal object.
(Inherited from Signal.) | |
ToDouble |
Converts this signal into a array of floating-point samples.
(Inherited from Signal.) | |
ToFloat |
Converts this signal into a array of floating-point samples.
(Inherited from Signal.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
Split(Int32, Int32) | Overloaded.
Splits a signal using a window
(Defined by Extensions.) | |
Split(Int32, Int32) | Overloaded.
Splits a signal using a window
(Defined by Extensions.) | |
Split(IWindow, Int32) | Overloaded.
Splits a signal using a window
(Defined by Extensions.) | |
Split(IWindow, Int32) | Overloaded.
Splits a signal using a window
(Defined by Extensions.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
A complex discrete-time signal is any complex-valued function of integers. This class is used to keep audio signals represented in complex numbers so they are suitable to be converted to and from the frequency domain in either analytic or Fourier transformed forms.
References:
If your signal has a length that is a power of two, you can use the following code directly to create your audio signal and obtain its spectrogram:
// Create complex audio signal ComplexSignal complexSignal = ComplexSignal.FromSignal( signal ); // Do forward Fourier transformation complexSignal.ForwardFourierTransform( ); // Generate spectrogram complexSignal.ToBitmap(512,512);
However, if your signal is too lengthy, or if your signal is not yet in a power of two size, you can use a temporal window to slice your signal into smaller cuts, as shown below. In the example, an audio file is being read and its contents are being decoded and stored into a Signal object. Afterwards, an audio window is being used to cut the signal into smaller, power-of-two size signals which can then be transformed into the frequency (Fourier) domain.
string fileName = "audio.wav"; WaveDecoder sourceDecoder = new WaveDecoder(fileName); // Decode the file and store into a signal Signal sourceSignal = sourceDecoder.Decode(); // Create Hamming window so that signal will fit into power of 2: RaisedCosineWindow window = RaisedCosineWindow.Hamming(1024); // Splits the source signal by walking each 512 samples, then creating // a 1024 sample window. Note that this will result in overlapped windows. Signal[] windows = sourceSignal.Split(window, 512); // You might need to import Accord.Math in order to call this: ComplexSignal[] complex = windows.Apply(ComplexSignal.FromSignal); // Forward to the Fourier domain complex.ForwardFourierTransform();