XtractTonal#

class ansys.sound.core.xtract.XtractTonal(input_signal=None, input_parameters=None)#

Extract tonal components using the Xtract algorithm.

Examples

Extract tonal components from a signal, and display the tonal and non-tonal components.

>>> from ansys.sound.core.xtract import XtractTonal
>>> xtract_tonal = XtractTonal(input_signal=my_signal_field, input_parameters=my_parameters)
>>> xtract_tonal.process()
>>> tonal_signals, non_tonal_signals = xtract_tonal.get_output()
>>> xtract_tonal.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 extract tonal components from as a DPF field or fields container. When inputting a fields container, each signal (each field of the fields container) is processed individually.

input_parametersXtractTonalParameters, default: None

Structure that contains the parameters of the algorithm:

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

  • Regularity setting (float) between 0 and 1.

  • 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.

Methods

XtractTonal.get_output()

Get the output of the tonal analysis.

XtractTonal.get_output_as_nparray()

Get the output of the tonal analysis as NumPy arrays.

XtractTonal.plot()

Plot the output of the tonal analysis.

XtractTonal.process()

Process the tonal analysis.

Attributes

XtractTonal.input_parameters

Input parameters.

XtractTonal.input_signal

Input signal.

XtractTonal.output_non_tonal_signals

Output non-tonal signals.

XtractTonal.output_tonal_signals

Output tonal signals.