You can represent music as graphs and do computation on it. Probably the coolest consequence of that is you can teach music theory and theory of computation at the same time using the same structures.
Sonata form: Start with an exposition section. It's composed of two sections. Section A in the main key, and Section B in the dominant key. After exposition is a development section. This section uses Section A and/or Section B from the exposition section, using a dominant, subdominant, or relative minor, combining and expanding on those. After development is recapitulation, where you have Section A then Section B in the main key.
(Sorry, musicians, if this is a bit off. It's good enough (tm) for this.)
Here's the same thing as a "regex":
Code:
A - Main key A section
B - Main key B section
a - Minor key A section
b - Minor key B section
X - Dominant key A section
Y - Dominant key B section
x - Subdominant key A section
y - Subdominant key B section
Want more of the optional features? Bigger regex:
Code:
A - Main key A section
B - Main key B section
a - Minor key A section
b - Minor key B section
X - Dominant key A section
Y - Dominant key B section
x - Subdominant key A section
y - Subdominant key B section
i - Intro
t - Transition
c - Closing theme
o - Codetta
r - Retransition
d - Coda
The circle of fifths is a graph and chord progressions are finite state machines.
Sonata form: Start with an exposition section. It's composed of two sections. Section A in the main key, and Section B in the dominant key. After exposition is a development section. This section uses Section A and/or Section B from the exposition section, using a dominant, subdominant, or relative minor, combining and expanding on those. After development is recapitulation, where you have Section A then Section B in the main key.
(Sorry, musicians, if this is a bit off. It's good enough (tm) for this.)
Here's the same thing as a "regex":
Code:
(AY)+(A*|B*|X*|Y*|a*|b*|x*|y*)+(AB)+
A - Main key A section
B - Main key B section
a - Minor key A section
b - Minor key B section
X - Dominant key A section
Y - Dominant key B section
x - Subdominant key A section
y - Subdominant key B section
Want more of the optional features? Bigger regex:
Code:
(?<Intro>i)?(?<Exposition>At?Yc?o?)+(?<Development>A*|B*|X*|Y*|a*|b*|x*|y*)+(?<Retransition>r)?(?<Recapitulation>At?Bc?o?)+(?<Coda>d)?

A - Main key A section
B - Main key B section
a - Minor key A section
b - Minor key B section
X - Dominant key A section
Y - Dominant key B section
x - Subdominant key A section
y - Subdominant key B section
i - Intro
t - Transition
c - Closing theme
o - Codetta
r - Retransition
d - Coda
The circle of fifths is a graph and chord progressions are finite state machines.