Information Technology Reference
In-Depth Information
Figure 4. MarSystem and corresponding slices
for spectral processing
The third idea was the unification of Sources
and Sinks as regular MarSystems that have both
input and output. Sources are processing objects
that have only output, and Sinks only have input.
In order to be able to use them as any MarSystem
we extend them in the following way: Sources mix
their output with their input and Sinks propagate
their input to their output while at the same time
playing/writing their input as a side-effect. This
way, for example, one can connect a SoundFileSink
to an AudioSink in series and the data will be
written both to a sound file and played using the
audio device. Basically this way both Sources and
Sinks can be used anywhere inside a network.
Implicit Patching is made feasible by the inte-
gration of these three ideas. In this approach, each
MarSystem has only one input port and one output
port and consumes/produces only one token. How-
ever because of the extended semantics of Slices
one can essentially have multiple input/output
ports (as observations) and consume/produce
multiple tokens (as samples). This enables non-
trivial Composites such as Fanout to be created.
The expressive power of composition is increased
and a large variety of complex dataflow networks
can be expressed only using object composition
and therefore no Explicit Patching . Another side
benefit of Implicit Patching is that it enforces the
creation of trees and therefore avoids problems
with cycles in the dataflow graph.
Figure 5 shows how a Series Composite con-
sisting of a SoundFileSource src, Gain g and
AudioSink dest can be assembled in C++. At each
iteration of the loop, the audio rate is incremented
starting from 1 sample (similar to Chuck or STK)
until the block size of 1000 samples is reached.
All the intermediate shared buffers between the
MarSystems are adjusted automatically and the
sound plays without interruption. Even though this
example might seem artificial the need for dynami-
cally adjusting window sizes occurs frequently in
audio analysis for example in pitch-synchronous
overlap-add (PSOLA).
to the MarSystem shown in Figure 4 to 1024 and
the MarSystem will automatically determine that
the number of observations of the output Slice is
also 1024.
The second major idea behind Implicit
Patching is the use of the Composite design pat-
tern (Gamma et al., 1995) as a mechanism for
constructing dataflow networks. The extended
semantics of Slices require careful manipulation
of buffer sizes especially if run-time changes are
desired. The most important composite is Series,
which connects a list of MarSystems in series so
that the output of the first one becomes the input
to the second and so forth. (similarly to UNIX
pipes). The pseudo-code in Figure 3 uses a Series
composite. Initially composites were used as
programming shortcuts. However, gradually we
discovered that they offer many advantages and
we decided to make them the main mechanism
for constructing complicated MarSystems out of
simpler ones. Their advantages include hierarchi-
cal encapsulation, automatic dynamic handling
of all internal buffers and run-time instantiation.
More specifically, any dataflow network, no mat-
ter how complicated, is represented as a single
MarSystem that is hierarchically composed of
simpler MarSystems . Multiple instance of any
MarSystem can be instantiated at run-time and
all internal patching and memory handling is
encapsulated.
Search WWH ::




Custom Search