Xtract#

class ansys.sound.core.xtract.Xtract(input_signal=None, parameters_denoiser=None, parameters_tonal=None, parameters_transient=None)#

Extract signal components using the Xtract algorithm.

This algorithm chains a denoising step, a tonal extraction step, and a transient extraction step. It allows separating the noise, tonal, transient, and remainder components of a signal. The Xtract algorithm is the same as that which is implemented in Ansys Sound Analysis and Specification (SAS).

Examples

Extract and display the different signal components using the Xtract algorithm.

>>> from ansys.sound.core import Xtract
>>> xtract = Xtract(
...     input_signal=my_signal,
...     parameters_denoiser=my_denoiser_params,
...     parameters_tonal=my_tonal_params,
...     parameters_transient=my_transient_params,
... )
>>> xtract.process()
>>> noise_signal, tonal_signal, transient_signal, remainder_signal = xtract.get_output()
>>> xtract.plot()

See also

Extract tonal, transient, and noise components (Xtract)

Example demonstrating how to use Xtract to extract the various components of a signal.

Class instantiation takes the following parameters.

Parameters:
input_signalFieldsContainer | Field, default: None

One or more signals to apply Xtract processing on as a DPF field or fields container.

parameters_denoiserXtractDenoiserParameters, default: None

Structure that contains the parameters of the denoising step:

  • Noise PSD (Field) is the power spectral density (PSD) of the noise.

This structure is of the XtractDenoiserParameters type. For more information, see this class.

parameters_tonalXtractTonalParameters, default: None

Structure that contains the parameters of the tonal extraction step:

  • NFFT (int) is the number of points used for the FFT computation.

  • Regularity setting (float) in percent.

  • Maximum slope (float) in dB/Hz.

  • Minimum duration (float) in seconds.

  • Intertonal gap (float) in Hz.

  • Local emergence (float) in dB.

This structure is of the XtractTonalParameters type. For more information, see this class.

parameters_transientXtractTransientParameters, default: None

Structure that contains the parameters of the transient extraction step:

  • Lower threshold (float), which is between 0 and 100 percent.

  • Upper threshold (float), which is between 0 and 100 percent.

This structure is of the XtractTransientParameters type. For more information, see this class.

Methods

Xtract.get_output()

Get the output of the Xtract algorithm in a tuple as DPF fields containers or fields.

Xtract.get_output_as_nparray()

Get the output of the Xtract algorithm in a tuple as NumPy arrays.

Xtract.plot()

Plot the Xtract algorithm results.

Xtract.process()

Process the Xtract algorithm.

Attributes

Xtract.input_signal

Input signal.

Xtract.output_noise_signal

Noise signal.

Xtract.output_remainder_signal

Remainder signal.

Xtract.output_tonal_signal

Tonal signal.

Xtract.output_transient_signal

Transient signal.

Xtract.parameters_denoiser

Parameters of the denoiser step.

Xtract.parameters_tonal

Parameters of the tonal extraction step.

Xtract.parameters_transient

Parameters of the transient extraction step.