kramann.info

kramann.info

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

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 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:

http://www.kramann.info/kaleidophone

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:

http://ubimus.inf.poa.ifrs.edu.br/ -- 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

https://youtu.be/oTsUU14wlug (S E S S I O N 3 -- video)
http://www.kramann.info/99_Musik/alg_session3_vl_gl_vb_mr_kramann.pdf (S E S S I O N 3 -- score)
http://www.kramann.info/99_Musik/alg_session3_vl_gl_vb_mr_kramann.mp3 (S E S S I O N 3 -- audio file)

elegie

https://youtu.be/kEhaXBM1lEE (elegie -- video)
http://www.kramann.info/cmmr2019c/elegie.mp3 (elegie -- audio)
http://www.kramann.info/cmmr2019c/elegie__score_and_individual_parts.zip (elegie -- score)

Sonification of a drone flight IV

https://youtu.be/MIIXewon7NQ (Sonification of a drone flight IV -- video)

# #2 Use of a formula editor as user interface

https://www.youtube.com/watch?v=Wv1_O-D4l9g (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))

https://youtu.be/MPjBExFyDHM (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

https://play.google.com/store/apps/details?id=kramann.info.MODULO (M O D U L O -- android app)

https://youtu.be/JNeoLJVPKqA (M O D U L O -- video)

http://www.kramann.info/cmmr2019b/modulo_seed0.pdf (M O D U L O -- score)

http://www.kramann.info/cmmr2019b/modulo_seed0.mp3 (M O D U L O -- audio)

http://www.kramann.info/cmmr2019b/MODULO.zip (M O D U L O -- processing sketch for android devices)

http://www.kramann.info/cmmr2019b (M O D U L O -- developer and info link)

http://www.kramann.info/cmmr2019b/modulo2_045_JAM3_VL1_perc_VERSION2_HALL.mp3 (M O D U L O v2 -- audio example)

# #4 Automatic generation of music from pictures and videos

MY WAY TO WORK

https://youtu.be/Sxwa1uj5HMU (MY WAY TO WORK -- video)

ComposingWithImages

https://youtu.be/KPj6dfAA7Bw (ComposingWithImages -- video)

Sonification of a drone flight (3rd version)

https://youtu.be/IHNl1q76b8Y ( Sonification of a drone flight (3rd version) -- video )

Sonification of a drone flight

https://youtu.be/nbw-LRxXVCY (Sonification of a drone flight -- video)

# #5 User interfaces suitable for primary school children

THE FLIPPIN' POMPOMs

https://youtu.be/vWGJ1nESBv4 (THE FLIPPIN' POMPOMs -- video)

ComposingWithSpheres

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

kaleidophone for vibraphone

https://youtu.be/-y92ojnVbAY (kaleidophone for vibraphone -- video)
http://www.kramann.info/kaleidophone_for_vibraphone_g_kramann.zip (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

https://youtu.be/YP46MrcaW90 (S E S S I O N 1 -- video)

http://www.kramann.info/99_Musik/alg_session1_vl_gl_vb_mr_kramann.pdf (S E S S I O N 1 -- score)

http://www.kramann.info/99_Musik/alg_session1_vl_gl_vb_mr_kramann.mp3 (S E S S I O N 1 -- audio)

S E S S I O N 2

https://youtu.be/Zi1li5dKqM8 (S E S S I O N 2 -- video)

http://www.kramann.info/99_Musik/alg_session2_vl_gl_vb_mr_kramann.pdf (S E S S I O N 2 -- score)

http://www.kramann.info/99_Musik/alg_session2_vl_gl_vb_mr_kramann.mp3 (S E S S I O N 2 -- audio)

S E S S I O N 3

https://youtu.be/oTsUU14wlug (S E S S I O N 3 -- video)

http://www.kramann.info/99_Musik/alg_session3_vl_gl_vb_mr_kramann.pdf (S E S S I O N 3 -- score)

http://www.kramann.info/99_Musik/alg_session3_vl_gl_vb_mr_kramann.mp3 (S E S S I O N 3 -- audio)

S E S S I O N 4

https://youtu.be/RBZTZCtKSZs (S E S S I O N 4 -- video)

http://www.kramann.info/99_Musik/alg_session4_vl_gl_vb_mr_kramann.pdf (S E S S I O N 4 -- score)

http://www.kramann.info/99_Musik/alg_session4_vl_gl_vb_mr_kramann.mp3 (S E S S I O N 4 -- audio)

S E S S I O N 5

https://youtu.be/qHDAWSRpAko (S E S S I O N 5 -- video)

http://www.kramann.info/99_Musik/alg_session5_vl_gl_vb_mr_kramann.pdf (S E S S I O N 5 -- score)

http://www.kramann.info/99_Musik/alg_session5_vl_gl_vb_mr_kramann.mp3 (S E S S I O N 5 -- audio)

S E S S I O N 6

https://youtu.be/6Res2V3uoTs (S E S S I O N 6 -- video)

http://www.kramann.info/99_Musik/alg_session6_vl_gl_vb_mr_kramann.pdf (S E S S I O N 6 -- score)

http://www.kramann.info/99_Musik/alg_session6_vl_gl_vb_mr_kramann.mp3 (S E S S I O N 6 -- audio)

S E S S I O N 7

https://youtu.be/2vUTjsotgrk (S E S S I O N 7 -- video)

http://www.kramann.info/99_Musik/alg_session7_vl_gl_vb_mr_kramann.pdf (S E S S I O N 7 -- score)

http://www.kramann.info/99_Musik/alg_session7_vl_gl_vb_mr_kramann.mp3 (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.

http://www.kramann.info/98_AOG/jakob.mp3 (Searching suitable AOG-formulas for reproducing a given phrase -- audio)

http://www.kramann.info/98_AOG/BruderJakob009_alternativ.zip (Processing sketch to find the AOG formulas)

http://www.kramann.info/98_AOG/BruderJakob009c_play.zip (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 processing.org

http://www.kramann.info/cfe/ (ComposingForEveryone -- library / project link)

M O D U L O

http://www.kramann.info/cmmr2019b (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

http://www.kramann.info/cmmr2019c/groove.mp3 (groove -- audio)
Algorithmic compositions album at Snogg.me
http://www.kramann.info/groove.pdf (groove -- description in german)

taichi

https://youtu.be/KKEXACpvIZA (taichi -- video)

SHIMMER

https://youtu.be/OjBnvF0tlcQ (SHIMMER -- video)

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

see http://www.kramann.info/90_AOGdogma

 AOGdogma#2 by G.Kramann 09/2020

alg_AOGdogma2_xyl_vib_mar_092020_kramann.mp3 -- AOGdogma#2 mp3-audio-file

alg_AOGdogma2_xyl_vib_mar_092020_kramann.zip -- AOGdogma#2 score and parts

```
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

alg_AOGdogma3_violin_vib_092020_kramann.zip -- 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

Bild 0-1: Screenshot of a live-performance.

https://youtu.be/UXDkvnBvpYc -- 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:

https://www.youtube.com/watch?v=eYEO0UQ8HcA -- Chick Corea & Gary Burton: No Mystery (Munich, 1997)