Mixer¶
- class acoular.tprocess.Mixer¶
Bases:
TimeOut
Mix signals from multiple sources into a single output.
This class takes a
primary time signal source
and a list ofadditional sources
with the same sampling rates and channel counts across allprimary time signal source
, and outputs a mixed signal. The mixing process is performed block-wise using a generator.If one of the
additional sources
holds a shorter signal than the other sources theresult()
method will stop yielding mixed time signal at that point.- source = Instance(SamplesGenerator)¶
The primary time signal source. It must be an instance of a
SamplesGenerator
-derived class.
- sources = List(Instance(SamplesGenerator, ()))¶
A list of additional time signal sources to be mixed with the primary source, each must be an instance of
SamplesGenerator
.
- sample_freq = Delegate('source')¶
The sampling frequency of the primary time signal, delegated from
source
.
- digest = Property(depends_on=['source.digest', 'sdigest'])¶
A unique identifier for the Mixer instance, based on the
primary source
and thelist of additional sources
.
- result(num)¶
Generate mixed time signal data in blocks of
num
samples.This generator method retrieves time signal data from all sources and sums them together to produce a combined output. The data from each source is processed in blocks of the same size, ensuring synchronized mixing.
Note
Yielding stops when one of the additionally provied signals ends; i.e. if one of the additional sources holds a signal of shorter length than that of the
primary source
that (shorter) signal forms the lower bound of the length of the mixed time signal yielded.- Parameters:
- num
int
Number of samples per block.
- num
- Yields:
numpy.ndarray
An array containing the mixed time samples in blocks of shape (
num
,num_channels
), wherenum_channels
is inhereted from theTimeOut
base class. The last block may contain fewer samples if the total number of samples is not a multiple ofnum
.