New Tools For Aspect Oriented Programming in Music and Media
New Tools For Aspect Oriented Programming in Music and Media
- 1587 -
Proceedings ICMC|SMC|2014 14-20 September 2014, Athens, Greece
Body Advice
Body
Figure 1: On the left, we see the typical dataflow through Figure 2: o.aspect.print
an abstraction in Max. On the right, the use of o.in and
o.out to forward incoming and outgoing data to aspects.
4. MAX/MSP IMPLEMENTATION
In figure 1a, we see the skeleton of a module in Max, The implementation of AOP in Max that we introduce here
while in figure 1b o.in and o.out provide join points where makes use of Open Sound Control [7] as a rich, composite
advice can be applied. Data enters a module and is for- data type, and the odot library [8] for providing contex-
warded by o.in to o.aspect.receive where advice is applied. tual information and high-level processing of OSC data.
After processing, it is sent back to where it came from, in AOP is implemented in Max using a pair of Max “abstrac-
this case o.in, by o.aspect.receive. o.in then forwards the tions” or shims called o.in and o.out which are placed im-
(possibly modified) data to the body of the Max abstrac- mediately after and before each inlet and outlet in a mod-
tion. o.out behaves identically to o.in with the exception of ule, respectively. o.in and o.out are thin wrappers around
its contextual information. o.port which collects contextual information from its en-
vironment such as the name of the module it is in and the
name of the parent patch, as well as the arguments to those
3. APPLICATIONS
patches. This data is added to the OSC bundle along with a
As programs grow in complexity, the need to understand “return address” and sent, using Max’s built-in “send” ob-
what is going on inside of submodules nested deep in the ject, to the global location “o.aspect”, i.e., [send o.aspect].
patcher hierarchy can present serious difficulties. For ex- We provide two additional abstractions that aid in writ-
ample, we may suspect that something is going wrong in ing aspects: o.aspect.receive which simply wraps [receive
an abstraction and wish to see the values that are being sent o.aspect], and o.aspect.send which uses the “return address”
into it as a way to determine whether the problem occurs to set the forward object to send to that location (see figure
inside or outside the abstraction. This requires one of two 3).
- 1588 -
Proceedings ICMC|SMC|2014 14-20 September 2014, Athens, Greece
ule.
The following enumerated items correspond to those in
figure 4.
1. OSC bundles are processed and all other non-OSC
data is simply passed through untouched.
2. The port type, “inlet” or “outlet”, is bound to /o port/type
and blended into the incoming OSC stream.
3. The context information for this port is blended into
the incoming OSC stream.
4. The bundle is passed to the join point.
Figure 3: o.aspect.send 5. All contextual information is stripped off before out-
putting.
4.1 o.port
4
Figure 5: o.aspect.joinpoint
- 1589 -
Proceedings ICMC|SMC|2014 14-20 September 2014, Athens, Greece
variable and blended into the OSC bundle. 4. Choose a random frequency from the spectrum us-
4. Contextual information is generated using o.context ing the amplitudes as a (categorical) probability dis-
and blended into the OSC bundle. tribution.
5. The bundle is sent to the named global location “o.aspect”. 5. Sonify a grain at the chosen frequency.
6. If a bundle is received here, the “return address” is
removed and it is sent to o.collect which will com-
bine it with the original. 1
3
5. A MORE DETAILED EXAMPLE
- 1590 -
Proceedings ICMC|SMC|2014 14-20 September 2014, Athens, Greece
Acknowledgments
This work was supported in part by the TerraSwarm Re-
Figure 8: An aspect used to visualize the data computed
search Center, one of six centers supported by the STAR-
in spec-sample.
net phase of the Focus Center Research Program (FCRP) a
Semiconductor Research Corporation program spon-sored
by adding a random value to the chosen frequency. We by MARCO and DARPA.
may want to experiment with different families of proba-
bility distributions, and ultimately we may wish to discard 7. REFERENCES
this behavior if it proves to be uninteresting. Rather than
[1] A. Cockburn, Agile Software Development: The Coop-
perform many edits on a working patch, we can contain
erative Game, 2nd ed. Addison-Wesley Professional,
this speculative work in an aspect as seen in figure 9.
2006.
We first look for OSC bundles that came from the outlet
of the spec-sample patch. We then blend in the name of a [2] R. E. Filman, T. Elrad, S. Clarke, and M. Akşit, Eds.,
probability distribution and its parameters which is used to Aspect-Oriented Software Development. Boston:
generate a random value that is added to the value of /freq. Addison-Wesley, 2005.
[3] “Principles behind the agile manifesto,”
http://agilemanifesto.org/principles.html, accessed:
2014-03-29.
[4] G. Kiczales, J. Lamping, A. Mendhekar, C. Maeda,
C. Lopes, J. marc Loingtier, and J. Irwin, “Aspect-
oriented programming,” in ECOOP. SpringerVerlag,
1997.
[5] I. Akkaya, P. Derler, and E. Lee, “Aspect-oriented fault
modelling and anomaly detection in Ptolemy II.”
[6] D. Patterson and A. Fox, Engineering Software as a
Service: An Agile Approach Using Cloud Computing.
Strawberry Canyon LLC. Kindle Edition, 2014.
[7] M. Wright and A. Freed, “Open sound control: A
new protocol for communicating with sound synthe-
sizers,” in Proceedings of the International Computer
Music Conference, (Thessaloniki, Hellas), 1997, pp.
Figure 9: An aspect used to experiment with different 101–104.
probability distributions for smearing the spectrum.
[8] A. Freed, J. MacCallum, and A. Schmeder, “A dy-
namic, instance-based, object-oriented programming
in max/msp using open sound control message dele-
6. CONCLUSIONS AND FUTURE WORK gation,” in Proceedings of the International Computer
Music Conference, 2011.
We have presented an implementation of aspect-oriented
programming for data-flow languages such as Max/MSP
and PD, which can simplify a variety of tasks in arts/media
programming of an agile and speculative nature.
- 1591 -