Algorithmic Composition With Python
What is Neue Musik
Contemporary composers
History of Algorithmic composition
History of algorithmic composition
Lets Play a Musical Dice Game
History Of Algorithmic Composition
What can we Produce?
What is Midi?
Scientific Pitch Notation
Intervals
Intervals
Open Music Theory
Note Values
Triads
Scales
Diatonic Chords in Major
Chord Progressions
Links To Music21
Music21
Note Object
Scales
Stream Object
Score And Part
Score and Part
Score and Part
Chords
Chords
Chords from Text
Chords from Text
Composition: Random Walk
Composition: Random Walk
Composition: Random Walk
Composition: Random Walk
Composition: Random Walk
Composition: Random Walk
Composition: Random Walk
Composition: Random Walk
Composition: Random Walk
Further Ideas
OEIS
Composition: Listen To OEIS
Composition: Listen To OEIS
Composition: Listen To OEIS A000010

Algorithmic Composition With Python

1. Algorithmic Composition With Python

Dr. Hendrik Niemeyer

2. What is Neue Musik

• Moving away from traditional harmony and form and exploring
dissonant sounds, experimental techniques and unexpected
structures
• Experience music as art
• Challenging traditional listening habits
• Emancipation of dissonance
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
2

3. Contemporary composers

• John Cage: Known for his experimental approaches
• Philip Glass: A key figure in minimalism
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
3

4. History of Algorithmic composition

• First composition recipes based on throwing dice in the 18th century
• Results of throwing multiple dice are used to look up a bar of music
in a table
• Usually used for periodic forms of music like waltzes, polonaises, or
minuets with a highly schematic harmonic structure
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
4

5. History of algorithmic composition

Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
5

6. Lets Play a Musical Dice Game

• https://dice.humdrum.org/
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
6

7. History Of Algorithmic Composition

• Lejaran Hiller (1956): “The Illiac Suite for String Quartet” uses Markov
chains and random walks
• Iannis Xenakis (1964): „Eonta“ uses Brownian Motion
• Gerhard E. Winkler (1996): „Hybrid II Networks“ uses neural networks
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
7

8. What can we Produce?

Score
MIDI
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
Sound
8

9. What is Midi?

• Technical standard for storing and communicating musical events
• E.g. pitch, timing and velocity of a note
• A MIDI file contains no sound (you need virtual instruments like a
synthesizer to create sound)
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
9

10.

Music Theory
10

11. Scientific Pitch Notation

Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
11

12. Intervals

Open Music Theory
• https://viva.pressbooks.pub/openm
usictheory/
• Authors: Mark Gotham; Kyle
Gullings; Chelsey Hamm; Bryn
Hughes; Brian Jarvis; Megan
Lavengood; and John Peterson
• License:
https://creativecommons.org/licens
es/by-sa/4.0/
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
14

13. Intervals

Note Values
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
15

14. Open Music Theory

Diatonic Chords in Major
ii-V-I
I-V-vi-IV
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
18

15. Note Values

Links To Music21
• https://music21-mit.blogspot.com/
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
20

16. Triads

Music21
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
21

17. Scales

Note Object
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
22

18. Diatonic Chords in Major

Scales
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
23

19. Chord Progressions

Stream Object
• Stream object is a container for generic musical objects
• Basic building block of music21 package
• Unlike a list more than one object can be placed at the same position
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
24

20. Links To Music21

Score And Part
stream.Score
Whole piece of
music
stream.Part
A single
instrument
stream.Voice
A melodic line
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
25

21. Music21

Score and Part
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
26

22. Note Object

Score and Part
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
27

23. Scales

Chords
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
28

24. Stream Object

Chords
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
29

25. Score And Part

Chords from Text
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
30

26. Score and Part

Chords from Text
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
31

27. Score and Part

Our
Compositons
32

28. Chords

Composition: Random Walk
• Stochastic process
• describes a path that consists of a
succession of random steps
• E.g. in 1D position + 1 with p=0.5
and position -1 with p=0.5
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
33

29. Chords

Composition: Random Walk
• Melody is generated by mapping a random walk onto a C Major
scale
• Note length is drawn at random as well
• Simple harmonic structure from I-V-vi-IV chord progression
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
34

30. Chords from Text

Composition: Random Walk
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
35

31. Chords from Text

Composition: Random Walk
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
36

32.

Composition: Random Walk
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
37

33. Composition: Random Walk

Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
38

34. Composition: Random Walk

Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
39

35. Composition: Random Walk

Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
40

36. Composition: Random Walk

Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
41

37. Composition: Random Walk

Further Ideas
• Accompaniment could be made random as well
• Combine multiple random walks for a polyphonic texture instead of
melody + accompaniment
• Creativity is limitless
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
42

38. Composition: Random Walk

OEIS
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
43

39. Composition: Random Walk

Composition: Listen To OEIS
• Online Encyclopedia of Integer Sequences
• Choose an arbitrary sequence and turn it into music deterministically
• Chordal texture
• Use number to choose pitch, chord type and duration
• „atonal“ music
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
44

40. Composition: Random Walk

Composition: Listen To OEIS
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
45

41. Composition: Random Walk

Composition: Listen To OEIS A000010
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
46

42. Further Ideas

Composition: Listen To OEIS Primes
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
47

43. OEIS

Other OEIS music
• https://oeis.org/play.html
• https://github.com/tom111/oeistools
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
48

44. Composition: Listen To OEIS

Alternative Packages
• https://abjad.github.io/
• https://mido.readthedocs.io/en/stable/
• https://github.com/georgesdimitrov/arvo
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
49

45. Composition: Listen To OEIS

Literature
• Book: Music Theory for the 21st-Century Classroom
• Music21 Docs
• Procedural music composition with Python
Dr. Hendrik Niemeyer - ROSEN Technology and Research Center GmbH
50

46. Composition: Listen To OEIS A000010

Questions?
Dr. Hendrik Niemeyer
ROSEN Technology and Research Center GmbH
E-Mail: hniemeyer@rosen-group.com
Mastodon: @hniemeyer@mastodon.social
Bluesky: @hniemeyer.bsky.social
LinkedIn: https://www.linkedin.com/in/hniemeyer87/
English     Русский Правила