Coder Social home page Coder Social logo

marqrdt / music-set-theory Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nuttysalmon/music-set-theory

0.0 0.0 0.0 43 KB

Script for post-tonal musical analysis set theory calculations.

License: GNU General Public License v3.0

Python 100.00%

music-set-theory's Introduction

Music set theory calculations (post-tonal analysis)

Calculation tool to assist music theory analysis that uses musical set theory, especially for post-tonal music. Able to calculate:

with steps output for better understanding the calculation processes and for debugging.

This script is by no means the most effecient way of calculation. Feel free to collaborate and give suggestions for more features.

Dependency

  • Python version >= 3.6
  • mingus

Usage

Setup

  1. Before running any scripts, make sure correct Python 3 and Pip are installed on computer

  2. clone repo and install dependencies:

     git clone https://github.com/NuttySalmon/music-set-theory.git
     cd music-set-theory
     pip3 install -r requirements.txt
    

Calculating for single set:

  1. In the project directory, run script:

     python3 ./set_theory.py 
    
  2. Following on screen prompt, input notes seprated by space. E.g. B Eb C# D G.

  3. Once result is displayed, users can enter new set of notes for another calculation.

Calculating all prime form values for subsets of given size:

  1. In project directory, run script:

     python3 ./subsets_prime.py 
    
  2. Following on screen prompt, input notes and the number of notes to pick from set for combinations.

  3. Once result is displayed, users can enter new set of parameters for calculation.

Ctrl + C to quit Python.

Sample outputs

For single set calculation:

> python3 set_theory.py
*****Set Theory Calculator*****
Type in notes in set (seprated by space Eg: C Eb G F#), then press enter. Type "exit" to quit.

Note set: B Eb C# D G
Parsing input...

----- Calculate normal -----
Pitch class interval (PCI) list: [1, 1, 4, 4, 2]
Max PCI: 4
candidates: [[7, 11, 13, 14, 15], [11, 13, 14, 15, 19]]
Comparing PCI for 4-th note and 1st...
Min PCI: 4
Most compact found.
Selected normal: [11, 13, 14, 15, 19]

----- Calculate inversion -----
PCI of normal: [2, 1, 1, 4, 4]
Inverted PCI: [4, 1, 1, 2]
[11, 15, 16, 17, 19]

----- Calculate inversion normal -----
Pitch class interval (PCI) list: [4, 1, 1, 2, 4]
Max PCI: 4
candidates: [[15, 16, 17, 19, 23], [11, 15, 16, 17, 19]]
Comparing PCI for 4-th note and 1st...
Min PCI: 4
Most compact found.
Selected normal: [15, 16, 17, 19, 23]

----- Find best normal order -----
Comparing PCI for 4-th note and 1st...
Min PCI: 4
tie exists, elimination result: [[11, 13, 14, 15, 19], [15, 16, 17, 19, 23]]
Comparing PCI for 3-th note and 1st...
Min PCI: 2
Most compact found.
[15, 16, 17, 19, 23]

Calculate prime form...

----- Calculate ICV -----
Interval classes: [1, 2, 4, 4, 1, 3, 5, 2, 6, 4]
[2, 2, 1, 3, 1, 1]

========= RESULTS =========
Original input: B Eb C# D G
Pitch class (PC) list: [1, 2, 3, 7, 11]
Normal: B, C#, D, D#, G ([11, 13, 14, 15, 19])
Inversion: B, D#, E, F, G ([11, 15, 16, 17, 19])
Inversion normal: D#, E, F, G, B ([15, 16, 17, 19, 23])
Best normal order: D#, E, F, G, B ([15, 16, 17, 19, 23])
Prime: [01248]
Interval class vector: <221311>

Note set: 

Calculating for subsets:

> python3 subsets_prime.py
Notes (leave empty to use previous): C E G F#
Pick: 3
[(0, 4, 6), (0, 4, 7), (0, 6, 7), (4, 6, 7)]

...

and finally:

======================
RESULTS
======================
Pick 3 from C E G F#:
C, E, F#: [026]
C, E, G: [037]
C, F#, G: [016]
E, F#, G: [013]

music-set-theory's People

Contributors

nuttysalmon 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.