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.
pkg> add https://github.com/spiralizing/MusicSpiralRepresentation.jl
For a bit of explanation of what this package is about and how to use some of its functions please see THIS EXAMPLE
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")
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",',')
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)