There are (many) music operations that can be expressed directly in
Math and code. Just to give you a taste, tranposing a set of notes to
i is as simple as
[(n + i) % 12 for n in notes].
In this tutorial we'll explore the primitives of Music (notes, intervals, dynamics, articulations, and duration), take a look inside them, the means of combining those primitives (motives, chords, operations such as transposition, retrograde, inversion), and the means of abstraction (phrases, harmonic functions and progressions, and form) using Python and some basic Math. At the end of this tutorial you should have a demysthified understanding of many elements of Music and be able to use Python to create short compositions.
Primitives of Music [15']
A general view of notes, intervals, dynamics, articulations, and duration and how to represent them in Python.
Means of combination [35']
A look inside the Primitives [25']
Play with frequencies and interval relations
Means of abstraction (How to think like a composer) [15']
This tutorial is aimed at intermediate Python programmers but no music knowledge is necessary. You don't need to know how to read music, but we'll use music notation as a graphical debugger. On the Python side, you should know how to use list comprehensions, lambda, high-order functions, and object-oriented.
You can find a list of required libraries and programs, with installation instructions at https://github.com/kroger/learning-music-with-python.