Giter Site home page Giter Site logo

yellowcucumber23 / markhov-music Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 39.26 MB

Used Markhov Chains and bit manipulation to parse an inputted midi file and generate similar music

Shell 0.04% Python 59.96% Batchfile 0.01% CSS 0.01% PowerShell 0.05% Emacs Lisp 0.77% Scheme 36.04% LilyPond 2.46% PostScript 0.40% Vim Script 0.15% C++ 0.13%

markhov-music's Introduction

Markhov-Music

This application takes in a midi file and parses it to create sheet music with the a similar note distribution

Code in ./src was written by me and everything else is the LilyPond Module used to compile the music into a readable pdf file

The program takes a midi file as an input and outputs the notes of that midi file. The following midi file has the corresponding output: test

{'C', 'G', 'D', 'A', 'D', 'E', 'E', 'B'}

It then takes the input and transforms the note distribution into a transition matrix to be used in a Markhov Chain

{{0.31, 0.01, 0.08, 0.01, 0.10, 0.02, 0.11, 0.04, 0.02, 0.10, 0.06, 0.12},
 {0.02, 0.34, 0.08, 0.03, 0.07, 0.03, 0.12, 0.03, 0.06, 0.05, 0.02, 0.14},
 {0.08, 0.07, 0.35, 0.00, 0.08, 0.02, 0.11, 0.08, 0.02, 0.05, 0.05, 0.09},
 {0.04, 0.07, 0.01, 0.28, 0.14, 0.04, 0.13, 0.04, 0.06, 0.08, 0.03, 0.09},
 {0.05, 0.04, 0.10, 0.03, 0.35, 0.01, 0.11, 0.08, 0.04, 0.06, 0.03, 0.09},
 {0.06, 0.07, 0.07, 0.03, 0.10, 0.26, 0.12, 0.05, 0.05, 0.09, 0.04, 0.07},
 {0.04, 0.03, 0.06, 0.03, 0.10, 0.02, 0.34, 0.07, 0.03, 0.08, 0.07, 0.12},
 {0.04, 0.02, 0.05, 0.01, 0.09, 0.01, 0.16, 0.36, 0.02, 0.08, 0.05, 0.11},
 {0.04, 0.12, 0.04, 0.03, 0.10, 0.04, 0.10, 0.04, 0.25, 0.34, 0.04, 0.12},
 {0.07, 0.03, 0.06, 0.01, 0.05, 0.02, 0.11, 0.10, 0.04, 0.34, 0.04, 0.12},
 {0.06, 0.02, 0.10, 0.01, 0.07, 0.02, 0.18, 0.09, 0.03, 0.09, 0.22, 0.12},
 {0.04, 0.06, 0.07, 0.01, 0.09, 0.01, 0.11, 0.06, 0.03, 0.11, 0.05, 0.35}};

 Where each column is represented by the following notes
 {"C" , "Db",  "D", "Eb",  "E",  "F", "Gb",  "G", "Ab",  "A", "Bb",  "B"}

We can use another Markhov Chain to determine the rhythms, below is a following matrix:

{{0.0, 0.0, 0.75, 0.25}
 {0.0, 0.333, 0.0, 0.666}
 {0.0, 0.5, 0.0, 0.5}
 {0.0, 0.1666, 0.0, 0.8333}};

Where each column is corresponds with the following rhythms
{"sixteenth", "eighth", "quarter", "half"}

Here is an example output or open music.pdf in ./src for the full sheet music: test

You can run test.cpp to see how the MidiFile is being parsed in MidiFile.cpp

markhov-music's People

Contributors

yellowcucumber23 avatar

Watchers

 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.