SphericalHarmonicSource#

class acoular.sources.SphericalHarmonicSource

Bases: PointSource

Define a fixed spherical harmonic source emitting a signal.

The SphericalHarmonicSource class models a stationary sound source that emits a signal with spatial properties represented by spherical harmonics. This source can simulate directionality and orientation in sound emission, making it suitable for advanced acoustic simulations.

The output is being generated via the result() generator.

lOrder

Order of the spherical harmonic representation. Default is 0.

alpha

Coefficients of the spherical harmonic modes for the given lOrder.

direction

Vector defining the orientation of the spherical harmonic source. Default is (1.0, 0.0, 0.0).

prepadding

Behavior of the signal for negative time indices. Currently only supports loop. Default is 'loop'.

digest

A unique identifier for the current state of the source, based on its properties. (read-only)

transform(signals)

Apply spherical harmonic transformation to input signals.

The transform() method modifies the input signals using the spherical harmonic modes, taking into account the specified coefficients (alpha), order (lOrder), and source orientation (direction).

Parameters:
signalsnumpy.ndarray

Input signal array of shape (num_samples, num_channels).

Returns:
numpy.ndarray

Transformed signal array of the same shape as signals.

See also

get_modes()

Method for computing spherical harmonic modes.

Notes

  • The spherical harmonic modes are computed using the get_modes() function, which requires the microphone positions, source position, and source orientation.

  • The transformation applies the spherical harmonic coefficients (alpha) to the signal in the frequency domain.

result(num=128)

Generate output signal at microphones in blocks, incorporating propagation effects.

The result() method provides a generator that yields blocks of the signal detected at microphones. The signal is adjusted for the distances between the source and microphones, as well as any environmental propagation effects.

Parameters:
numint, optional

Number of samples per block to be yielded. Default is 128.

Yields:
numpy.ndarray

A 2D array of shape (num, num_channels) containing the signal detected at the microphones. The last block may have fewer samples if num_samples is not a multiple of num.

Raises:
IndexError

If no more samples are available from the signal source.

signal

Instance of the SignalGenerator class defining the emitted signal.

loc

Coordinates (x, y, z) of the source. Default is np.array([[0.0], [0.0], [1.0]]).

num_channels

Number of output channels, automatically set based on the microphone geometry.

mics

MicGeom object defining the positions of the microphones.

env

An Environment or derived object providing sound propagation details, such as speed of sound in the medium. Default is Environment.

start_t

Start time of the signal in seconds. Default is 0.0.

start

Start time of data acquisition at the microphones in seconds. Default is 0.0.

up

Internal upsampling factor for finer signal resolution. Default is 16.

num_samples

Total number of samples in the emitted signal, derived from the signal generator.

sample_freq

Sampling frequency of the signal, derived from the signal generator.