© Guido Kramann

Login: Passwort:

© Guido Kramann

Login: Passwort:

Arithmetic Operation Grammar (AOG) - Selected and thematically arranged examples

(EN google-translate)

(PL google-translate)

This is a preprint of "Composing by Laypeople: A Broader Perspective Provided by Arithmetic Operation Grammar". The article is published in Computer Music Journal Volume 44, No. 1, Spring of 2021, published by The MIT Press.

The example music piece for violin and vibraphone "AOGdogma#3" from this article is below at #11.

The system "THE FLIPPIN' POMPOMS" described in the article can be found in #5.

Meanwhile, the principle of "THE FLIPPIN' POMPOMS" has been transferred to a web-based program that allows distant users to interact with each other:

Of_Renouncing__by_Guido_Kramann_29minutes.mp4 -- long version -- This video was prepared for the Ubiquitous Music Workshop 2020 November 9-13, online, see also: -- Ubiquitous Music Workshop 2020 -- Ubiquitous Music and Everyday Creativity, November 9 - 13, 2020 (online).

Arithmetic Operation Grammar (AOG) was presented for the first time at the CMMR 2019, see:

Kramann, G.: Generative Grammar Based on Arithmetic Operations for Realtime Composition. CMMR 2019, pp. 346--360.

AOG takes the natural numbers as starting point as a time sequence. There are no explicitly formulated harmonic or contrapuntal rules in AOG. Instead, one assumes that the organization of the divisors within the natural numbers satisfies rules that are similarly good. Other pieces of music are now created by changing this basic element through the application of arithmetic operations and additionally by using the modulo division and finally -- to obtain a tone pitch -- by performing a kind of selective division (symbol //) in which from a so-called base number those powers of 2,3,5 and 7 are removed which are contained in the value resulting from the preceding operations for a specific formula at a specific tick t. Thus, in AOG, "composing" then means defining formulas according to which the basic element id(N) is modified. Several formulas can be used to generate several voices.

#1 Compilation of some characteristic compositional results based on AOG

S E S S I O N 3 (S E S S I O N 3 -- video) (S E S S I O N 3 -- score) (S E S S I O N 3 -- audio file)

elegie (elegie -- video) (elegie -- audio) (elegie -- score)

Sonification of a drone flight IV (Sonification of a drone flight IV -- video)

#2 Use of a formula editor as user interface (AOG formula editor "Composing for everyone" as an adroid app on google play) (TEDx talk "Komponieren für alle" (Composing for Everyone) -- Unfortunately the slides are not visible and the following event is missing, where parts of the audience were able to compose cooperatively with AOG formula editors (Android devices connected via W-LAN to the sound producing PC)) (Demonstration of AOG formula editors connected to the sound producing PC via W-LAN in german)

#3 Game based user interfaces

M O D U L O (M O D U L O -- android app) (M O D U L O -- video) (M O D U L O -- score) (M O D U L O -- audio) (M O D U L O -- processing sketch for android devices) (M O D U L O -- developer and info link) (M O D U L O v2 -- audio example)

#4 Automatic generation of music from pictures and videos


ComposingWithImages (ComposingWithImages -- video)

Sonification of a drone flight (3rd version) ( Sonification of a drone flight (3rd version) -- video )

Sonification of a drone flight (Sonification of a drone flight -- video)

#5 User interfaces suitable for primary school children


ComposingWithSpheres (ComposingWithSpheres -- project link)

#6 User interface for musicians to enable them to create their own compositions

kaleidophone for vibraphone (kaleidophone for vibraphone -- video) (kaleidophone for vibraphone -- processing sketch)

#7 Use of a number block as melodic drum

A Feedback machanism aims to optimize the AOG generation formulas so that they would reproduce past sound events, including those of the user.

S E S S I O N 1 (S E S S I O N 1 -- video) (S E S S I O N 1 -- score) (S E S S I O N 1 -- audio)

S E S S I O N 2 (S E S S I O N 2 -- video) (S E S S I O N 2 -- score) (S E S S I O N 2 -- audio)

S E S S I O N 3 (S E S S I O N 3 -- video) (S E S S I O N 3 -- score) (S E S S I O N 3 -- audio)

S E S S I O N 4 (S E S S I O N 4 -- video) (S E S S I O N 4 -- score) (S E S S I O N 4 -- audio)

S E S S I O N 5 (S E S S I O N 5 -- video) (S E S S I O N 5 -- score) (S E S S I O N 5 -- audio)

S E S S I O N 6 (S E S S I O N 6 -- video) (S E S S I O N 6 -- score) (S E S S I O N 6 -- audio)

S E S S I O N 7 (S E S S I O N 7 -- video) (S E S S I O N 7 -- score) (S E S S I O N 7 -- audio)

#8 Approaches to find a suitable set of AOG formulas for given musical phrases that reproduce these phrases in a given section of id(N) (inverse problem)

The following audio example shows the result of representing the canon Brother Jacques with AOG formulas. Once the motif is heard in all four voices, the voices diverge again as t progresses. The formulas and the starting point t0 were found using an optimization algorithm. Four formulas with 16 operations each provide the desired result. (Searching suitable AOG-formulas for reproducing a given phrase -- audio) (Processing sketch to find the AOG formulas) (Processing sketch to play the result)

#9 Sample source code and class libraries, provided to enable deeper analysis and your own developments

ComposingForEveryone -- Processing library -- see (ComposingForEveryone -- library / project link)

M O D U L O (M O D U L O -- developer and info link)

#10 Further examples with higher claims on the compositional form, in which sequences other than id(N) were also used as basic elements

groove (groove -- audio)
Algorithmic compositions album at (groove -- description in german)

taichi (taichi -- video)


#11 Extension of AOG to a Script Language AOGdogma by Parameterizing the Formulas


  • AOGdogma#2 by G.Kramann 09/2020

alg_AOGdogma2_xyl_vib_mar_092020_kramann.mp3 -- AOGdogma#2 mp3-audio-file -- AOGdogma#2 score and parts

animation of AOGdogma#2 on youtube

10 ~ dt
0 ~ t0
48000 ~ t1

8000 100 ! t
0 8000 ! tm

tm %10 ~ MM
10 -MM ~ NN

tm /9  %3 ~ UU
tm /12 %3 ~ VV
tm /18 %3 ~ WW
tm /24 +12 ~ XX
tm /48 +1 *6 +66 ~ YY

3 - UU ~ PP
3 +VV ~ QQ
2 +WW ~ RR

3 2 1 1 NN 100 19 65 108 0 70 30 : xy
3 2 1 1 NN 100 19 53 89 2 50 50 : ma
3 2 1 1 NN 100 19 45 108 1 15 35 : vb

t *PP  %72 /3 +4  ~ vb
t +tm *QQ  %XX ~ ma
t +tm *RR  %XX /2 ~ xy

16 -DD /2 +CC /4 %3  xy
16 -DD /2 +CC /4 %3  ma
16 -DD /2 +CC /4 %3  vb

Code 0-1: AOGdogma#2 by G.Kramann 09/2020

  • AOGdogma#3 by G.Kramann 09/2020

AOGdogma#3 is for violin and vibraphone. Thus, it could not be rendered exactly by the processing script in ComposingForEveryone. There was made a variant sending midi commands to a physical modeling software.

animation of AOGdogma#3 on youtube (for violin and vibraphone)

alg_AOGdogma3_violin_vib_092020_kramann.mp3 -- AOGdogma#3 mp3-audio-file -- AOGdogma#3 score and parts

10 ~ dt
0 ~ t0
23700 ~ t1

# 35000 30 ! t
70000 100 ! t
0 1000 ! tm

tm /8 %20 +2 ~ VC

tm /36 %4 +3 ~ PP
tm /48 %4 +1 ~ QQ

tm /8 %43 +21 ~ EE
tm /12 %43 +28 ~ FF

5 2 1 1 PP 100 14 65 108 0 70 30 : xy 
5 2 1 1 PP 100 14 55 91 1 60 40 : vl
5 2 1 1 PP 100 14 48 94 2 30 70 : vb

t +8 /2 *FF %48 *QQ ~vl
t +16 /2 *30 %48 *VC ~vb

3 -DD /3 +CC /3 %3  vl
3 -DD /3 +CC /3 %3  vb

Code 0-2: AOGdogma#3 by G.Kramann 09/2020 (for violin and vibraphone)

#12 An automatic accompaniment of a live performance with the help of AOG

Screenshot of a live-performance.

Bild 0-1: Screenshot of a live-performance. -- Vibraphone and AOG-Piano #09

The idea behind this presentation is to show the user not only a system that reacts in real time but also the symbolic representation of the sound generating system. This can even be designed by the user: Users can design the formula structure and listen in real time to what it will produce in terms of sound. Afterwards, they can define places that may be varied by the optimizer. Only then does the performance take place (see example below).

function perform(t,P)
   var u = #%7+1;
   var B = 2520*u;
   var x = t+#*#%#:#*#%#:#*#;
   var x2 = t+#*#%#*#:#;
   var x3 = t+#*#%#:#*#%#:#*#;
   var x4 = t+#*#%#*#;
   var x5 = t+#*#%#:#*#%#:#*#;
   var x6 = t+#*#%#*#:#;
   var x7 = t+#*#%#:#*#%#:#*#;
   var x8 = t+#*#%#*#;
   var m = B|x;
   var m2 = B!x2;
   var m3 = B|x3;
   var m4 = B!x4;
   var m5 = B|x5;
   var m6 = B!x6;
   var m7 = B|x7;
   var m8 = B!x8;
   if(m<30) {m = m3;}
   if(m2<30) {m2 = m4;}
   if(m5<30) {m5 = m7;}
   if(m6<30) {m6 = m8;}
   return new Array(m,m2,m3,m4,m5,m6,m7,m8);

Code 0-3: Configuring the AOG formulas for a live performance and defining the parameters which may be changed within the formula structure by the optimizer by inserting the placeholder #. The | symbol here stands for the selective division. The symbol ! stands here for the alternative possibility to select without dividing.

Thus, a musician can determine the character of the resulting accompaniment and to what extent it is automatically adapted to the current music-making. The basic problem with "Arithmetic Operation Grammar" is that the formula writing is very powerful and it is very easy to create convincing compositions, but the connection between the resulting composition and the formulas is not so easy to understand or learn. (However, it is, after all, much easier to learn than the contents of a music course that leads one to become a composer, because typically the users are already familiar with the laws of arithmetic from school.) But probably the most intuitive user interface one can think of to tackle this problem is one in which the user himself makes music and the system adapts to the music-making. Here this is done without losing direct access to the formula structure.

In other words: ... First I roughly define a formula structure and listen to what "Chick" (the piano sound which is controlled by the algorithm) then plays. Then, next, I define which parameters in the formulas may be changed by an optimizer. Then the live performance starts, where every sound of the musician is timestamped. The optimizer then tries to adjust the formulas so that "Chick" the same HAD played in the past on the stored timestamps. Through this artifice emerges a permanent temporary coherence between the real and the virtual player. This means that the formulas deliver something suitable for the musician's playing at the current time.

The stage of development presented here still lacks a concept for the design of the piano's playing technique, but initially concentrates only on the musical structure. And those who become too exhausted by it over time can still switch over to the wonderful original duo for relaxation: -- Chick Corea & Gary Burton: No Mystery (Munich, 1997)