Chapter 6: Exploring Chance and Randomness
Free Preview
6.1 Embracing Randomness
Chance opens new musical paths. Iannis Xenakis, John Cage, and free-jazz players all used randomness, though in different ways. Free jazz leans on instinct; Cage and Xenakis built formal systems.
import random
notes = ['C', 'D', 'E', 'F', 'G', 'A', 'B']
random_sequence = [random.choice(notes) for _ in range(10)]
random_sequence6.2 Probability in Improvisation
Musicians can bias randomness with weights, nudging phrases toward certain notes or rhythms.
notes = ['C', 'D', 'E', 'F', 'G', 'A', 'B']
weights = [0.1, 0.15, 0.2, 0.15, 0.2, 0.1, 0.1]
random_sequence = random.choices(notes, weights, k=10)
random_sequenceMusic can welcome chance.
This chapter shows how Xenakis, Cage, and free-jazz players used randomness, then lets you code aleatoric, stochastic, and algorithmic pieces in Python.
Continue reading this chapter
You're reading a free preview. Purchase the book to unlock every chapter in Artificial Intelligence for Musicians.
✓ Full book unlocked✓ Every chapter✓ Runnable code✓ Lifetime access
