Algorithmic Music Composition
and Computational Musicology in
Python
Halley Young
New York University
9/13/15
Goals of Computational
Musicology
 Use algorithms to analyze the form,
harmonies, rhythms, melodies, and
arrangement of musical data
 Use a variety of strategies (both data-driven
and non-data-driven) to try to produce music in
a given style
Music21 – a toolkit for computational
musicology in Python
 Score model
 Insert Note/Chord/Rest object into a Part
object, insert Part object into Score object
 Can write to MIDI, MusicXML, or PDF
 Includes corpus of musical data (Bach,
Monteverdi, Handel) to be read into memory
and analyzed
Strategies for Algorithmic
Composition
 Data-driven:
 Markov Models
 Neural networks
 Genetic Algorithms with fitness determined by
similarity to pre-specified pieces
 Expert systems:
 Genetic algorithms with fitness determined by
adherence to musical rules
 Formal grammars
 Stochastic processes guided by musical rules
Markov Models
 Probabilistic model based on prior data:
Generate a table of how often previous
transitions between two states happened, and
then randomly choose transitions based on the
table
 Can use probabilities of notes following notes,
rhythms following rhythms, chords following
chords, or sections following sections
Expert Systems
Musical Forms - setting up the structure of the piece
Musical Transformations - creating new material out
of pre-existing material
Musical Preferences - determining whether what
was created sounds good
Machine Learning and
Computational Musicology
 Automatic Key Detection
 Automatic Harmony Detection
 Automatic Music Classification
Questions?
 Visit mit.edu/music21 for details and
installation info

Computational Musicology in Python

  • 1.
    Algorithmic Music Composition andComputational Musicology in Python Halley Young New York University 9/13/15
  • 2.
    Goals of Computational Musicology Use algorithms to analyze the form, harmonies, rhythms, melodies, and arrangement of musical data  Use a variety of strategies (both data-driven and non-data-driven) to try to produce music in a given style
  • 3.
    Music21 – atoolkit for computational musicology in Python  Score model  Insert Note/Chord/Rest object into a Part object, insert Part object into Score object  Can write to MIDI, MusicXML, or PDF  Includes corpus of musical data (Bach, Monteverdi, Handel) to be read into memory and analyzed
  • 4.
    Strategies for Algorithmic Composition Data-driven:  Markov Models  Neural networks  Genetic Algorithms with fitness determined by similarity to pre-specified pieces  Expert systems:  Genetic algorithms with fitness determined by adherence to musical rules  Formal grammars  Stochastic processes guided by musical rules
  • 5.
    Markov Models  Probabilisticmodel based on prior data: Generate a table of how often previous transitions between two states happened, and then randomly choose transitions based on the table  Can use probabilities of notes following notes, rhythms following rhythms, chords following chords, or sections following sections
  • 6.
    Expert Systems Musical Forms- setting up the structure of the piece Musical Transformations - creating new material out of pre-existing material Musical Preferences - determining whether what was created sounds good
  • 7.
    Machine Learning and ComputationalMusicology  Automatic Key Detection  Automatic Harmony Detection  Automatic Music Classification
  • 8.
    Questions?  Visit mit.edu/music21for details and installation info