HelloAOG -- Workshop for Arithmetic Operation Grammar
(EN google-translate)
(PL google-translate)
Deutsche (German) Version, siehe:

Please take this Sketch for the workshop on June 3rd 2024:

Arithmetic Operation Grammar (AOG) was conceived as a composition method beyond the beaten track of classical theory, but also beyond established new trends [1],[2].
This method can therefore give amateurs an alternative approach to composing. Ensuring easy access to composing for non-professionals is also one of the aims of the Ubiquitous Music movement, which is why there have already been several contributions with AOG at the annual symposium on Ubiquitous Music [3],[4],[5].
The question now arises as to how such an unconventional technique, which does not follow any of the established structures, can be taught in a didactically meaningful way. This workshop takes programming in Java/Processing as its starting point. AOG structures are first presented as Java code and then replaced in a more compact way by the language tools of AOG. The familiar, from which the new is developed, is therefore not a musical theory, but a programming language. This is feasible due to the special characteristics of AOG, which are briefly presented below:
|
References





Why the sequence of natural numbers can be said to have a musical structure?

Bild 0-1: Inner prime-factor-structure of natural numbers.

Bild 0-2: Inner prime-factor-structure of natural numbers2.
Getting Started

|
Once you have successfully started the sketch, you will see and hear the following:

Bild 0-3: Screenshot of the running HelloAOG program.


The entire workshop is structured in such a way that it is usually sufficient to work in the main tab of the sketch. You do not need to pay attention to the other tabs and they will not be discussed here. In the main tab you will find predefined variables and the setup() and draw() methods. In this specific case, these are the lines of code shown below:
//version: HelloAOGdev020_workshop_BASIS 27.05.2024 int NUMBER_OF_VOICES=1;//4; //Try to vary if stuttering in sound appears: int SAMPLE_RATE=11025; //8000 11025 22050 44100 48000 int BUFFER_SIZE=16; //16 32 64 128 256 512 public void setup() { size(640,480); frameRate(2); configure(); } public void draw() { vis.draw(); vis.step(); A=2520/(T%7+2); tone1.play(A,100); T++; }
Code 0-1: HelloAOG
Explanations:
|
A=2520/(T%7+2); tone1.play(A,100); T++;
Code 0-2: Last three lines of the draw() method.
|
More Explanations:
|
If your computer does not display the sound correctly, you could try to solve the problem by changing the sample rate and the buffer size, see Sketch. Another possibility would be to try to give the Java process a higher priority. Finally, it would also be possible to control an external midi device instead of generating the sound directly with Java means. This would require the following (only then):
|

2. Exploiting the Infinite Expanse of Natural Numbers
|
public void draw() { vis.draw(); vis.step(); A=2520; X=T; B=1; while(A>=2 && A%2==0 && X>=2 && X%2==0) {A/=2;X/=2;B*=2;} while(A>=3 && A%3==0 && X>=3 && X%3==0) {A/=3;X/=3;B*=3;} while(A>=5 && A%5==0 && X>=5 && X%5==0) {A/=5;X/=5;B*=5;} while(A>=7 && A%7==0 && X>=7 && X%7==0) {A/=7;X/=7;B*=7;} tone1.play(A,100); //AOG-Syntax: T,2520 //tone1.play(B,100); //AOG-Syntax: T.2520 T++; }
Code 0-3: Modified draw() method: Extraction of the prime factors 2,3,5,7 from T and A, as far as possible for both.

3. Use Of the Generative Symbolic Scripting Language Arithmetic Operation Grammar (AOG) Within Java/Processing
|
|
public void draw() { vis.draw(); vis.step(); eval("2520/(T%7+2)a"); tone1.play(A,100); T++; }
Code 0-4: Example of 1. but implemented using the AOG interpreter.

|
public void draw() { vis.draw(); vis.step(); eval("T,2520a"); tone1.play(A,100); T++; }
Code 0-5: Example in 2. implemented with AOG.
4. A More Complex Example with Four Voices Cyclically Read From File
|
123*(10-(T/48%10))p T/2*P%5+1*96+(3*96)a T/3*P%7+1*48+(3*48)*(T%2=0)*(T/2%6>0)b T/4*P%5+1*12+(3*12)*(T%4=0)*(T/3%4>0)c T/3*P%7+1*24+(3*24)*(T%3=0)*(T/4%3>0)d
Code 0-6: Contents of the aogscript.txt file
So that this file is interpreted cyclically by AOG, the main program can be changed in the following way:
Note: NUMBER_OF_VOICES=4; and frameRate(8);
//version: HelloAOGdev021 27.05.2024 int NUMBER_OF_VOICES=4;//4; //Try to vary if stuttering in sound appears: int SAMPLE_RATE=11025; //8000 11025 22050 44100 48000 int BUFFER_SIZE=16; //16 32 64 128 256 512 public void setup() { size(640,480); frameRate(8); configure(); } public void draw() { vis.draw(); vis.step(); evalFile("aogscript.txt"); tone1.play(A,100); tone2.play(B,150); tone3.play(C,200); tone4.play(D,250); T++; }
Code 0-7: Modified main tab for interpreting a file.


Bild 0-4: Screenshot of HelloAOG_4
Explanations
|

|
5. Exercise
From a nucleus, a composition is gradually developed in several steps by implementing structural ideas as changes in the code and repeatedly checking and correcting them based on the sound feedback.
Some intermediate stages are shown below.
As an exercise, you can try to use these intermediate stages as a starting point for your own new developments.
In order to make the sound feedback as appealing as possible, a slightly extended version of the software was used, which controls a Disklavier and also offers the possibility of controlling the sustain pedal, changing the tempo and multiplying the frequencies by a percentage factor before converting them into midi tones. However, the code can also be transferred from these special features to the stand-alone software version given above. The software extension used can be found below:

COMPROVIZATION#1
100p #P==Percent frequency = 0.01*PERCENT*A..H 127s #S==Sustain 0..127 60q #Q==Frame Rate FPS, BPM = FPS*20 T,2520a #Extract 2,3,5,7 in 2520 which are also in T and send to A
Code 0-8: COMPROVIZATION#1

COMPROVIZATION#2
100p #P==Percent frequency = 0.01*PERCENT*A..H 127s #S==Sustain 0..127 60q #Q==Frame Rate FPS, BPM = FPS*20 7*5*9*8*(T/6%6+1)i #I==changing base number T,Ik # K*(K>109)*(K<1639)*(T/12%3>0)a #set range, add breaks
Code 0-9: COMPROVIZATION#2

COMPROVIZATION#3
100p #P==Percent frequency = 0.01*PERCENT*A..H 127s #S==Sustain 0..127 60q #Q==Frame Rate FPS, BPM = FPS*20 7*5*9*8*(T/6%6+1)i #I==changing base number T%6+9000+(T/96*96)u #Repetitions by controling time U,Ik # K*(K>109)*(K<1639)*(T/12%3>0)a #set range, add breaks
Code 0-10: COMPROVIZATION#3

COMPROVIZATION#4
T/36%10+1*60p #changing percentage T/48%2*127s #alternating sustain 60q #Q==Frame Rate FPS, BPM = FPS*20 7*5*9*8*(T/6%6+1)i #I==changing base number T%6+9000+(T/96*96)u #Repetitions by controling time U,Ik # K*(K>109)*(K<1639)*(T/12%3>0)a #set range, add breaks
Code 0-11: COMPROVIZATION#4

...und viele viele Iterationsschritte später:
COMPROVIZATION#5
T/24%10+1*(30+(T/48%5*5))p #smaller percentage T/48%2*60+60s #alternating sustain 15q #slower 7*5*9*8*(T/96%6+1)i T%(3+(T/3%3))+9000+(T/12*6)u #Repetitions by controling time T%6+9000+(T/24*12)v #varying time structure T%12+9000+(T/48*24)y #varying time structure T%24+9000+(T/96*48)z #varying time structure U+12w V+24x U/1*(U%1=0),(I*1)k #systematically introduce variations in other voices W/1*(W%1=0),(I*1)l V/2*(V%2=0),(I*2)m X/3*(X%3=0),(I*3)n K*(K>109)*(K<1639)*(U/12%3>0)a #set range, add breaks L*(L>109)*(L<1639)*(V/18%4>0)b M*(M>109)*(M<1639)*(Y/24%6>0)c N*(N>109)*(N<1639)*(Z/36%8>0)d
Code 0-12: COMPROVIZATION#5

LICENSE

Copyright 2024 Guido Kramann (website: http://www.kramann.info e-mail: kramann@th-brandenburg.de)
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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.