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 = Int(0, desc='Order of spherical harmonic') # noqa: N815¶
Order of the spherical harmonic representation. Default is
0
.
- alpha = CArray(desc='coefficients of the (lOrder,) spherical harmonic mode')¶
Coefficients of the spherical harmonic modes for the given
lOrder
.
- direction = Tuple((1.0, 0.0, 0.0), desc='Spherical Harmonic orientation')¶
Vector defining the orientation of the spherical harmonic source. Default is
(1.0, 0.0, 0.0)
.
- prepadding = Enum('loop', desc='Behaviour for negative time indices.')¶
Behavior of the signal for negative time indices. Currently only supports loop. Default is
'loop'
.
- 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:
- signals
numpy.ndarray
Input signal array of shape (
num_samples
,num_channels
).
- signals
- 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:
- num
int
, optional Number of samples per block to be yielded. Default is
128
.
- num
- 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 ifnum_samples
is not a multiple ofnum
.
- Raises:
IndexError
If no more samples are available from the signal source.