Uploaded November 2023 | Updated September 2026, 2 weeks ago
We implement an L-System that generates chord progressions in Python.
Get the code:
github.com/musikalkemist/generativemusicaicourse/blob/main/10.%20Chord%20generation%20with%20generative%20grammars/Code/lsystem.py
Get the lecture slides:
github.com/musikalkemist/generativemusicaicourse/blob/main/10.%20Chord%20generation%20with%20generative%20grammars/Slides/10.%20Chord%20generation%20with%20generative%20grammars.pdf
Website of the Generative Music AI Workshop in Barcelona:
https://www.upf.edu/web/mtg/generative-music-ai-workshop
Sign up to The Sound of AI Slack Community to join the discussion:
valeriovelardo.com/the-sound-of-ai-community
======================================
Interested in music AI consulting?
thesoundofai.com/consulting.html
Interested in music AI recruitment?
thesoundofai.com/recruitment.html
Become a Python ninja with my Advanced Python Programming course:
the-sound-of-ai-academy.teachable.com/p/advanced-python-programming
Connect with Valerio on LinkedIn:
linkedin.com/in/valeriovelardo
Follow Valerio on Twitter:
twitter.com/musikalkemist
======================================
Content
0:00 Intro
0:32 L-System design
2:13 Music21
2:54 Code repository
3:28 Main function
5:32 Running the script
7:01 LSystem class
8:26 Alphabet property
8:50 Iterate method
10:49 Private methods
14:34 Converting output to music21 chords
16:41 Create and show music21 score
18:40 What next?
We implement an L-System that generates chord progressions in Python.
Get the code:
github.com/musikalkemist/generativemusicaicourse/blob/main/10.%20Chord%20generation%20with%20generative%20grammars/Code/lsystem.py
Get the lecture slides:
github.com/musikalkemist/generativemusicaicourse/blob/main/10.%20Chord%20generation%20with%20generative%20grammars/Slides/10.%20Chord%20generation%20with%20generative%20grammars.pdf
Website of the Generative Music AI Workshop in Barcelona:
https://www.upf.edu/web/mtg/generative-music-ai-workshop
Sign up to The Sound of AI Slack Community to join the discussion:
valeriovelardo.com/the-sound-of-ai-community
======================================
Interested in music AI consulting?
thesoundofai.com/consulting.html
Interested in music AI recruitment?
thesoundofai.com/recruitment.html
Become a Python ninja with my Advanced Python Programming course:
the-sound-of-ai-academy.teachable.com/p/advanced-python-programming
Connect with Valerio on LinkedIn:
linkedin.com/in/valeriovelardo
Follow Valerio on Twitter:
twitter.com/musikalkemist
======================================
Content
0:00 Intro
0:32 L-System design
2:13 Music21
2:54 Code repository
3:28 Main function
5:32 Running the script
7:01 LSystem class
8:26 Alphabet property
8:50 Iterate method
10:49 Private methods
14:34 Converting output to music21 chords
16:41 Create and show music21 score
18:40 What next?










