Giter Club home page Giter Club logo

fugue-bugler's Introduction

Fugue-Bugler

Musical counterpoint belief propagation - Final project for G22-2565 Machine Learning, Fall 2011

Does one hand ever know what the other is doing? In musical theory, it must! This is an implementation of Generalized Belief Propagation for musical counterpoint notes. Given a training set of musical data in a particular style (i.e. a nursery rhyme or Bach), can we predict a single note's counterpoint? How about generate a completely new sequence, based on a each note's likelyhood?

Let's take the sequence C-5, B-4, A-4, B-4, C-5, D-5. Can we accurately predict, given enough training information, the Alto counterpoint to these Soprano notes? If we're given five of the counterpoints as E-4, G-4, F-4, ?, E-4, B-4, we should be able to determine that the missing note is G-4 using the shape of the preceding and following notes, coupled the rules we know about counterpoint species.

We implemented belief propagation on the first species only. Its rules are:

    1. Begin and end on either the unison, octave, or fifth, unless the added part is underneath, in which case begin and end only on unison or octave.
    1. Use no unisons except at the beginning or end.
    1. Avoid parallel fifths or octaves between any two parts; and avoid "hidden" parallel fifths or octaves: that is, movement by similar motion to a perfect fifth or octave, unless one part (sometimes restricted to the higher of the parts) moves by step.
    1. Avoid moving in parallel fourths. (In practice Palestrina and others frequently allowed themselves such progressions, especially if they do not involve the lowest of the parts.)
    1. Avoid moving in parallel thirds or sixths for very long.
    1. Attempt to keep any two adjacent parts within a tenth of each other, unless an exceptionally pleasing line can be written by moving outside of that range.
    1. Avoid having any two parts move in the same direction by skip.
    1. Attempt to have as much contrary motion as possible.
    1. Avoid dissonant intervals between any two parts: major or minor 2nd, major or minor 7th, any augmented or diminished interval, and perfect fourth (in many contexts).

The belief propagation algorithm is based on http://ssg.mit.edu/nbp

Our project forks Anthony Theocharis' excellent Counterpoint.py library as a basis for reading in midi notes. Improvements suggested upstream.

To run:

Usage: counterpoint.py [options]

Options:
   -h, --help           Show this help message and exit
 
   -t                   Read tracks from tracks.py and perform sparse-
 						sample belief prop on missing notes. If encountered,
 						will ignore instructions to read from MIDI file.
 
   -f, --fill-in		Given a full length, single-voice piece generate an
 						original counterpoint
 
   -g, --guess			Fill in missing notes from the MIDI file. Used in
 						combination with like options

fugue-bugler's People

Contributors

twobob avatar akre54 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.