Skip to content

Latest commit

 

History

History
77 lines (51 loc) · 2.46 KB

README.md

File metadata and controls

77 lines (51 loc) · 2.46 KB

MusicSpiralRepresentation

Stable Dev Build Status Coverage

Julia Package with functions to compute the Center of Effect with the Spiral Representation as model for tonality developed by Elaine Chew in her book Mathematical and Computational Modeling of Tonality.

Install

pkg> add https://github.com/spiralizing/MusicSpiralRepresentation.jl

Usage

For a bit of explanation of what this package is about and how to use some of its functions please see THIS EXAMPLE

To load MusicXML files

You need to have PyCall installed in your Julia environment

import MusicSpiralRepresentation
const msr = MusicSpiralRepresentation

using PyCall
m21 = pyimport("music21")

mxl_piece = m21.converter.parse("name_of_file.mxl")

To load MIDI (CSV) files

You can also load MIDI files indirectly by converting them to CSV files first with midicsv in a terminal:

$ midicsv name_of_file.mid > name_of_file.csv 

and to load it in Julia

using DelimitedFiles

csv_piece = readdlm("name_of_file.csv",',')

Creating a DataFrame from MusicXML and CSV files

You can create a DataFrame containing the information of the music score/piece with get_xml_df or get_csv_df, where the resulting data frame returns the format:

| measure| Time signature|start | end | duration | pitch|

for xml files:

import MusicSpiralRepresentation
const msr = MusicSpiralRepresentation
using PyCall
m21 = pyimport("music21")

mxl_piece = m21.converter.parse("name_of_file.mxl")
piece_df = msr.get_xml_df(mxl_piece)

for csv files:

import MusicSpiralRepresentation
const msr = MusicSpiralRepresentation
using DelimitedFiles

csv_piece = readdlm("name_of_file.csv",',')
piece_df = msr.get_csv_df(csv_piece)