SphericalHarmonicSource#
- class acoular.sources.SphericalHarmonicSource
Bases:
PointSourceDefine a fixed spherical harmonic source emitting a signal.
The
SphericalHarmonicSourceclass 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:
- signals
numpy.ndarray Input signal array of shape (
num_samples,num_channels).
- signals
- Returns:
numpy.ndarrayTransformed 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.ndarrayA 2D array of shape (
num,num_channels) containing the signal detected at the microphones. The last block may have fewer samples ifnum_samplesis not a multiple ofnum.
- Raises:
IndexErrorIf no more samples are available from the signal source.
- signal
Instance of the
SignalGeneratorclass defining the emitted signal.
- loc
Coordinates
(x, y, z)of the source. Default isnp.array([[0.0], [0.0], [1.0]]).
- num_channels
Number of output channels, automatically set based on the
microphone geometry.
- mics
MicGeomobject defining the positions of the microphones.
- env
An
Environmentor derived object providing sound propagation details, such asspeed of sound in the medium. Default isEnvironment.
- 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
signalgenerator.
- sample_freq
Sampling frequency of the signal, derived from the
signalgenerator.