MIDI2vec: Learning Embeddings for MIDI Vector Space Representations
Compute graph embeddings from MIDI.
This library is described in detail in the following paper
Pasquale Lisena, Albert Meroño-Peñuela, Raphaël Troncy. MIDI2vec: Learning MIDI Embeddings for Reliable Prediction of Symbolic Music Metadata, to appear in Semantic Web Journal, Special Issue on Deep Learning for Knowledge Graphs, 2021. http://www.semantic-web-journal.net/content/midi2vec-learning-midi-embeddings-reliable-prediction-symbolic-music-metadata-0
The experiments described in the paper are available here.
Pre-computed MIDI embeddings used in the paper are available in Zenodo.
The library is composed by 2 parts.
Convert a MIDI file into a graph, in edgelist format.
cd midi2edgelist npm install node index.js -i <midi_folder>
--input. Input directory containing MIDI files.
--outputOutput directory for the edgelists. Default:
--note-groupsNumber of groups of simultaneous notes to be taken in account for each MIDI. For example,
-n 300uses the first 300 groups. Default: all.
The output is formed by 4 edgelist (notes, program, tempo and time signature) and a csv containing the mapping between the file names and the given identifiers.
It uses node2vec for computing the embeddings from the egelists.
pip install -r edgelist2vec/requirements.txt python edgelist2vec/embed.py
--inputInput graph (edgelists) path. Default:
--outputOutput file name. Default:
--walk_lengthLength of walk per source. Default: 10;
--num_walksNumber of walks per source. Default: 40;
-pReturn hyper-parameter (as in node2vec). Default: 1;
-qInout hyper-parameter (as in node2vec). Default: 1;
--dimensionsNumber of dimensions. Default: 100;
--window-sizeContext size for optimization. Default: 5;
--iterNumber of epochs in word2vec. Default: 5;
--workersNumber of parallel workers. Default: 0 (full use);
--excludeEdgelists to be excluded from the computation.