Track#

class ansys.sound.core.sound_composer.Track(name='', gain=0.0, source=None, filter=None)#

Sound Composer track class.

This class creates a track for the Sound Composer. A track is made of a source (including its source control) and an optional filter (which models the transfer from source to receiver).

A track allows the generation of the sound corresponding to the source, optionally filtered with the associated filter.

Examples

Create a track with an audio source and a filter.

>>> from ansys.sound.core.sound_composer import Track
>>> track_filter = Filter(sampling_frequency=48000.0)
>>> track = Track(
...     name="Sound Composer track",
...     gain=-3.0,
...     source=my_source,
...     filter=my_filter
... )

See also

Use an existing Sound Composer project file

Example demonstrating how to load and work with an existing Sound Composer project.

Create a Sound Composer project

Example demonstrating how to create a Sound Composer project from scratch.

Class instantiation takes the following parameters.

Parameters:
namestr, default: “”

Name of the track.

gainfloat, default: 0.0

Gain to apply to the track’s generated sound, in dB.

sourceSourceSpectrum, SourceBroadbandNoise, SourceBroadbandNoiseTwoParameters, SourceHarmonics, SourceHarmonicsTwoParameters or SourceAudio, default: None

Source of the track.

filterFilter, default: None

Filter of the track.

Methods

Track.get_as_generic_data_containers()

Get the track data as a generic data container.

Track.get_output()

Get the generated signal of the track as a DPF field.

Track.get_output_as_nparray()

Get the generated signal of the track, as a NumPy array.

Track.plot()

Plot the resulting signal.

Track.process([sampling_frequency])

Generate the signal of the track, using the source and filter currently set.

Track.set_from_generic_data_containers(...)

Set the track data from a generic data container.

Attributes

Track.filter

Filter object of the track.

Track.gain

Track gain in dB.

Track.name

Name of the track.

Track.source

Source object associated with the track.