Guido Kramann


Download -- Processing library
Download -- recent BlueJ project


The present Java library ComposingForEveryone is part of the project "Composing for Everyone" (cfe) and is intended to be used within processing (see Its components offer support for applications in sound generation, simple web-cam-image processing, numerical simulation and -- provided by examples -- especially for algorithmic real-time composition of music. Special features are:
1) Support of multi channel sound on the PC (2.0, 4.0, 5.1, 7.1),
2) polyphonal sequencing of wav sounds and an integrated instrumental wav library,
3) for the most part this library shows the same behaviour on the PC as on Android devices.
Among other things, the examples are intended to demonstrate the possibilities offered by a certain form of generative grammar, namely "Arithmetic Operation Grammar" (AOG). A scientific paper on this topic can be found here on pages 346 to 360 (Generative Grammar Based on Arithmetic Operations for Realtime Composition), and 993 to 999 (MODULO):

LICENSE (MIT, see also

Copyright 2020 Guido Kramann (website: e-mail:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.



The package processchains in this library conveys a concept for building several communicating process chains that are controlled by different threads. There are special examples with the prefix Test_ ... which show up how to build up those process chains. Other examples hide away these structures in a special tab called wrapper, but provide easy to use methods for the main sketch. The reason for the development of the concept was the difficulty to design time-critical program parts both efficiently and to keep them flexible and transparent. For example, one would like to have simple methods like play(midi_pitch) for the implementation of a polyphonal musical instrument, but also the possibility to write directly into the buffer of the sound card or to change the assignment of the audio channels.

One solution to problems of this kind is to divide the mentioned functionalities into modules and to couple them with each other. In this coupling, the data objects of a source module are registered with a subsequent module so that no unnecessary multiple data storage is necessary, not to mention implementations in which data objects are allocated again in each time step.

Furthermore, there must be a mechanism that allows a preceding element to ensure that after a separate processing step, all subsequently attached modules also perform a processing step in their turn. The solution of both basic problems is given in the library by an interface called iConvertor.

The library contains classes that mostly all implement the iConvertor interface and can be used to implement process chains in several application areas.

Examples are provided for each individual type of process chain and also for combinations. Since the data types of the data objects passed on from module to module are generally different, the option of using generic data types, which has been available since Java 8, was used.

The concatenation of modules is basically done on the level of the sketch (thus, not hidden). Thus, more experienced application programmers are able to build their own process chains or to modify the exemplary process chains.

ComposingForEveryone uses other contributed processing libraries, but does not contain them

A further concern in connection with the didactic use of this library was to make the mostly hardware-related elements platform-independent. Therefore it was necessary to use libraries of other developers on the one hand and to write switches to use one or the other library depending on the hardware. The foreign libraries are not embedded in this library, but someone who uses this library should install the following libraries into his processing installation before: Ketai and oscP5. Therefore you can find the corresponding import commands sometimes in the example sketches.

ComposingForEveryone uses wav-files from "VS Chamber Orchestra: Community Edition" which was distributed under CC0 license

Since this library should also offer the possibility to create high quality sounds, a Wav-Sample library was integrated into the library. This makes the library relatively large at first (actually long sustains were shortened to three seconds). But you get the possibility to use the musical the library immediately and don't have to copy the whole wav-files with every new sketch.

The sample library contains a selection of stereo samples with 16Bit and 44100Hz sample rate for different classical musical instruments in different midi pitches and partly also for different playing styles. The class processchain.wavfiles.WavLoader offers methods to load both these library samples and also others from your sketch. The object method processchain.wavfiles.WavLoader.printAllAvailableWavFiles() outputs the samples available in the library to the console. Except the ones I've produced myself (pandrum, bajan) the samples were taken from the sample library "VS Chamber Orchestra: Community Edition" (VSCO-2-CE, Recorded by Sam Gossner & Simon Dalzell; Sample Cutting by Elan Hickler/Soundemote, used in ProcessChain: violin, piano, contrabass, clarinet, organ, tuba, marimba, glockenspiel, xylophone). The sample library VSCO-2-CE was published under CC0 license and can therefore be used here without hesitation. For more information about VSCO-2-CE, please visit the following website:

Update for version v6 September 2020: Versilstudios provides a newer sample library under CC0 license: VERSILIAN COMMUNITY SAMPLE LIBRARY (VCSL), see Xylophone, Marimbaphone and Vibraphone were added from there to ComposingForEveryone now.

Furthermore the library contains a selection of vibraphoe samples from
License: Creative Commons Attribution 3.0 Unported "Has to give attribution"
"The Sounds Are From BandLab. And Sound Realistic, You Can Make A Vibraphone Soundfont With It. Enjoy"

Finally the text font DejaVuSansMono.ttf is included in this library.
License: DejaVu Fonts License v1.00
This license can also be found at this permalink:


April 2020 (v1)

It has not (yet) been succeeded in achieving all the good goals set everywhere in a nice way ;-)

The library was compiled with oracle java 1.8.0_202 and tested on Linux, Windows and Android.
All examples run on the PC and on Android devices without changes in the source code.
As there is currently no possibility to use generic data types within Processing, it is not possible to implement the iConvertor interface, which is very central to the project, directly in a sketch. However, it is possible to inherit from existing classes in the library -- especially the abstract classes ConvertorDD, ConvertorII, ConvertorI2I2 -- or to extend a copy of the project. The source folder contains a BlueJ project for ComposingForEveryone (The wav-files except of marimba were deleted here to keep it small, but you could extract the others from .jar-file in folder library).

To get it running, it is necessary to set the paths of the user libraries used. The role of the Sketch takes the class Pap in the BlueJ project. This class is located in the root directory and inherits from PApplet. To test the current program, you can go to Pap with the right mouse button and start main(String[] args).

Above you can find a screenshot from BlueJ (and in the actual folder). Sometimes this UML-like representation is better suited to understand the relationship between the individual classes.

April 2020 (v1.0.1)

New classes: ConvertorII, ConvertorI2I2, ConvertorLI, Interconnections, FontLoader (provides DejaVuSansMono.ttf)
Class Utilities extended.
Font DejaVuSansMono.ttf added to library.
Example CFE added. You could try out first something like this:

Screenshot from example sketch CFE.

... other nice configuration.

April 2020 (v1.0.3)

New class: Interconnections
Class Segmentation modified / improved.
Example ComposingWithCamera added (see screenshot below).

Availability was improved by ensuring every example runs first on PC without installing any further third party library, respectively Ketai.
The commentary on the examples was continued

Mai 2020 (v1.0.4)

New class: SimplePiano
Classes WavLoader, WavInstrument modified / improved.
Examples modified / improved, new: BASIC_Sound_of_N_simplified ... using SimplePiano.

More instruments added, all licenses now available in root folder of library.
The commentary on the examples was continued.

Screenshot from example sketch ComposingWithCamera.

Mai 2020 (v1.0.5)

New classes: PianoRoll, InsertionSort, Gradus.
Improved / modified classes: WavInstrument, WavLoader.
Examples modified / improved: ComposingWithCamera.
Examples new: DEMO_ComposingWithDiashow.

FontLoader does not work with Android. Thus, to make a sketch working on PC and Android without change it is nescessary at this moment to have copy the font DejaVuSansMono.ttf in the individual sketch folder.
There are youtube videos available for ComposingWithCamera and DEMO_ComposingWithDiashow: (ComposingWithCamera) (MEIN WEG ZUR ARBEIT (MY WAY TO WORK) corresponds to DEMO_ComposingWithDiashow but using physical modeling, only showing the images on screen.) (MEIN WEG ZUR ARBEIT (MY WAY TO WORK) corresponds to DEMO_ComposingWithDiashow but using physical modeling, also visualizing the algorithm at work.)

DIY Working with ComposingWithCamera for children: Light table for laying technique as with stop motion made up with an Android tablet, a stand and a neon lamp.

Mai 2020 (v1.0.6)

Improved / modified class: Segmentation.
In the previous version the limitations for minimum and maximum pixels of a segmented area was erroneously disregarded.

New example: ComposingWithSpheres.
For more information see:

September 2020 (v1.0.7)

Extension of AOG to a script language AOGdogma by parameterizing the formulas.
See example AOGdogma
See also a corresponding tutorial:
... and a rudimentary web application:

Example made with AOGdogma: AOGdogma#2
AOGdogma#2 mp3-audio-file
AOGdogma#2 score and parts

Update for version v6 September 2020: Versilstudios provides a newer sample library under CC0 license: VERSILIAN COMMUNITY SAMPLE LIBRARY (VCSL), see Xylophone, Marimbaphone and Vibraphone were added from there to ComposingForEveryone now.