C++ library and Python bindings for the Music Encoding Initiative format

Related tags



Build Status

LibMEI is a C++ library for reading and writing MEI files

It is developed by the Distributed Digital Music Archives and Libraries Lab at the Schulich School of Music at McGill University, Montréal, Canada


LibMEI is released under the MIT license.

Compilation & Usage

We provide an XCode project for OSX and a cmake script for Linux.

To build on Linux, simply

mkdir build; cd build
cmake ..
sudo make install

To use libmei, include

#include <mei/mei.h>

We provide two sample applications to demonstrate use. util/readmei.cpp is a trivial example of reading and writing MEI, and making a change to the document structure. util/mxmltomei contains a tool to convert between MusicXML and MEI. This tool is still in active development.

More detailed information about compilation and use is available at the libmei wiki: https://github.com/DDMAL/libmei/wiki


LibMEI ships with Python bindings using the Boost-Python framework. More information about installing and using these bindings can be found in Installing the Python bindings


One of the most useful features of the MEI specification is the ability to generate custom schemas (in RelaxNG, DTD or W3C Schema) containing only the music notation features that you require. For example, there is no need to validate documents written in mensural notation against the Common Music Notation features of MEI. Also, MEI allows you to define new customizations for musical features that may not be covered under the core specification. These are features inherited from the TEI project, and you can read more about them on the ODD Overview Page or in our paper about MEI and LibMEI.

LibMEI ships with tools that allow you to easily work with these customizations to limit or expand the functionality. In the tools directory we include a Python script, parseschema2.py that will generate custom code for you in either C++ or Python. (Other languages may be added as well, if requested).

You can read more about customization and custom compiliation on our wiki pages.


We welcome bug reports, feature requests, and patches to the libmei project page: https://github.com/DDMAL/libmei

  • Update Manuscript generation to work with sibmei

    Update Manuscript generation to work with sibmei

    To avoid the need of conflict resolution with merging commits one by one, this pull request supersedes #111, #112, #116 and #117.

    This includes changes that were made to the libmei shipping with sibmei. For example, the RemoveChild() method was added with 24f5b43 in 2015, but was never added to the libmei generator.

    Goal is that we can generate libmei for sibmei without having to manually merge changes every time.

    opened by th-we 10
  • Building Python Bindings: Python.h not found in src/_libmei.cpp

    Building Python Bindings: Python.h not found in src/_libmei.cpp


    I have just tried to build the Python bindings after succesfully having compiled and installed libmei.

    I followed the instructions on https://github.com/DDMAL/libmei/wiki/Installing-the-Python-bindings

    :~/gitreps/libmei/python$ python setup.py build
    running build
    running build_py
    running egg_info
    writing pymei.egg-info/PKG-INFO
    writing top-level names to pymei.egg-info/top_level.txt
    writing dependency_links to pymei.egg-info/dependency_links.txt
    reading manifest file 'pymei.egg-info/SOURCES.txt'
    writing manifest file 'pymei.egg-info/SOURCES.txt'
    running build_ext
    building 'pymei/_libmei' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/_libmei.cpp -o build/temp.linux-x86_64-2.7/src/_libmei.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
    src/_libmei.cpp:24:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    It doesn't find Python.h. Where would that file be located?

    I use Python 2.7.


    Cross-platform Documentation 
    opened by tobiasschweizer 10
  • Matching against a list of names when searching by tag name, manicure removeChild

    Matching against a list of names when searching by tag name, manicure removeChild

    1. I didn't have time to install the gtest framework, that's why I didn't include .cpp tests. I added python tests though.
    opened by zolaemil 9
  • the xml: prefix of an attribute gets lost when exporting an element which was copied by a copy constructor.

    the xml: prefix of an attribute gets lost when exporting an element which was copied by a copy constructor.

    see failing test in dcd07ac7ef3b4947757ec2446b9eb7c06a36b6d1

    Core MEI Functionality 
    opened by zolaemil 7
  • Some mixins not created correctly

    Some mixins not created correctly

    For example, a Tie should have a startID and an endID. There is a StartidMixIn but the end one has been named StartendidMixIn

    opened by alastair 6
  • Make GoogleTest optional on Linux

    Make GoogleTest optional on Linux

    Currently the CMake script assumes that the GoogleTest framework is installed, and will fail if not. We should remove this as a dependency and make it optional to run the tests.

    opened by ahankinson 5
  • Python object lists

    Python object lists

    Python lists of MeiElement/MeiAttribute objects do not play well with the python bindings of the C++ functions.

    for example:

    attrs = nc.getAttributes()
    # manipulate the array somehow

    Results in:

    MeiElement.setAttributes(MeiElement, list)
    did not match C++ signature:
        setAttributes(mei::MeiElement {lvalue}, std::vector<mei::MeiAttribute*, std::allocator<mei::MeiAttribute*> >)
    Python Bindings 
    opened by gburlet 5
  • itemList not registered

    itemList not registered

    I get the following runtime error while importing an MEI that has an itemList element: That element name itemList was not registered with the factory and could not be created.

    opened by zolaemil 5
  • Changes to parseschema2.py

    Changes to parseschema2.py

    refs #88

    A few small changes should be made to parseschema2:

    1. Print out diagnostic information if any of the languages put in using the -l flag are not supported.

    1.1) @AFFogarty also wants the -l flag to no longer be case sensitive so -l Python and -l python and -l PyThOn would work identically.

    1.2) Change the --help flag to show that you can do multiple languages at the same time.

    1. In the case where neither -sl OR [compiled] are present in the invocation (such as python parseschema2.py -l cpp), the warning message defaults to a message about -sl if the user has input other parameters. This is an edge case for misuse, but I think the default should be a message about the [compiled] parameter if it's missing. @ahankinson can correct me if he thinks otherwise.
    Feature Requests Working with XML 
    opened by ahwitz 4
  • Remove redundant 'libmei.' prefixes for ManuScript

    Remove redundant 'libmei.' prefixes for ManuScript

    Facilitates renaming libmei.plg (e.g. for different MEI versions).

    This is a split-off pull request from the earlier pull request #119.

    opened by th-we 0
  • Manuscript fixes

    Manuscript fixes

    A replacement for #119 with better organized commits.

    opened by th-we 1
  • Remove unused ManuScript code that does not work any more

    Remove unused ManuScript code that does not work any more

    This unused code won't work any more because the surrounding code has evolved away from it. Specifically, MEIFlattened is no longer a SparseArray and can not be used in the way these function use it.

    opened by th-we 1
  • No errors on deprecated warnings

    No errors on deprecated warnings

    Since some features are deprecated (and more possibly will be eventually), keep errors on warnings (-Werror) but also add an exception to just warn on deprecation (-Wno-error=deprecated) rather than fail.

    This keeps deprecation warnings visible and also causes more serious warnings (like uninitialized variables/pointers) to error.

    This addresses issue #110.

    opened by JRegimbal 0
  • Windows compilation

    Windows compilation

    I has tried to use libmei (in Windwos 10) following the instructions in "Installing the Python bindings" but did not work. Is it necesary to compilate or somethng different? Thanks a lot for for your help.

    opened by fernandomoraangel 0
  • MEI 4.0.1 DTD

    MEI 4.0.1 DTD


    Where can this DTD be found?



    opened by jacques-menu 0
  • C++11 warnings result in build failure.

    C++11 warnings result in build failure.

    When building on Ubuntu I'm seeing warnings like this that ultimately result in a build failure:

    In file included from /code/libmei-3.1.0/src/meiattribute.cpp:2:0:
    /code/libmei-3.1.0/src/meielement.h:181:44: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
             void setDocument(MeiDocument *doc) throw (DocumentRootNotSetException);

    Normally warnings are not considered errors, but the compiler is being asked to make them errorrs. When I remove those lines the build succeeds.

    opened by edsu 1
  • util/mxmltomei ?

    util/mxmltomei ?

    The documentation mentions an example program called mxmltomei. Checking the current commit and the history of the project, it seems that this example never really existed. Am I correct?

    opened by napulen 0
  • libmei is not compatible with MEI 4.0

    libmei is not compatible with MEI 4.0


    MEI has updated and changed many of its tags. Because none of these new tags are registered with the factory (i.e. <neume>, <nc>), mei 4 files cannot be loaded with the functions DocumentFromText or DocumentFromFile.

    opened by noahbaxter 0
  • 3.1.0(Jun 15, 2018)

    This is mainly to get the master branch in sync with thedevelop branch. develop has been ahead for a while and the last commit on master was not stable.

    We decided that since develop is working and passing all the tests, it is a good time for sync'ing and creating a new release.

    @deepio integrated travis-ci so unit tests are running automatically now.

    The master branch is blocked, so any progress in develop can be tested automatically and merged to master through pull requests.

    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Jan 11, 2017)

  • v2.0.0(May 13, 2015)

    This release features a new XML parser, PugiXML, which deprecates the old dependency on libxml2. PugiXML is distributed with libmei now, so no further dependencies are needed (except on Linux, where libuuid is still required).

    As well, several notable feature additions and bug fixes are included:

    • strict and lax importer modes are supported. Importing a MEI file in lax mode that features elements that were not included in a schema will no longer raise an exception. Rather, it will log a warning and import the element as a raw MeiElement object
    • Python bindings are compatible with Python 3.

    Thanks to @lpugin and @ifkarp for helping to prepare this release.

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Dec 18, 2014)

Distributed Digital Music Archives and Libraries Lab
Distributed Digital Music Archives and Libraries Lab
Typographic Beat-Oriented Notation for music

tbon Typographic Beat-Oriented Notation for music Tbon aims to be the fastest way to enter pitches, rhythms, meter and dynamic levels from a computer

null 11 Jan 23, 2020
Music typeset with the Lilypond system

Intro (from long ago) This repo contains sheet music typeset with the Lilypond typesetter. The music chosen is in favour of cello music (mostly chambe

Enthusiastic about  the Cello 95 Sep 24, 2021
C++ library and Python bindings for the Music Encoding Initiative format

LibMEI LibMEI is a C++ library for reading and writing MEI files It is developed by the Distributed Digital Music Archives and Libraries Lab at the Sc

Distributed Digital Music Archives and Libraries Lab 49 Aug 30, 2021

ieaseMusic Elegant NeteaseMusic desktop app, Rock with NeteaseMusic ?? Built by Electron, React, MobX, JSS API 由 Binaryify/NeteaseCloudMusicApi 提供。 Pr

null 8.6k Sep 22, 2021
OpenSheetMusicDisplay renders sheet music in MusicXML format in your web browser based on VexFlow. OSMD is brought to you by PhonicScore.com.

OpenSheetMusicDisplay (OSMD) A MusicXML renderer for the Browser opensheetmusicdisplay.org About OSMD • Demo • Key Features • Limitations • How to Use

Open Sheet Music Display 806 Sep 24, 2021
A language for music notation

Lydown is a language and compiler for creating music scores, parts and snippets. The lydown code is compiled to lilypond code and then compiled to PDF

Sharon Rosner 21 Apr 8, 2021
music library manager and MusicBrainz tagger

beets Beets is the media library management system for obsessive music geeks. The purpose of beets is to get your music collection right once and for

beetbox 10.4k Sep 15, 2021
🎚️ Open Source Audio Matching and Mastering

Matching + Mastering = ❤️ Matchering 2.0 is a novel Containerized Web Application and Python Library for audio matching and mastering. It follows a si

Sergey Grishakov 490 Sep 24, 2021
Music player for deepin desktop environment.

deepin-music Deepin music is a local music player with beautiful design and simple functions developed by Deepin Technology. Dependencies Build depend

Wuhan Deepin Technology Co.,Ltd. 155 Sep 16, 2021
Mopidy is an extensible music server written in Python

Mopidy Mopidy is an extensible music server written in Python. Mopidy plays music from local disk, Spotify, SoundCloud, Google Play Music, and more. Y

Mopidy 7.2k Sep 17, 2021
A Music programming language. Translates source code into MIDI. Includes a player. Supports MIDI-Karaoke. Includes a MIDI analyzer.

Get Started | Features | Screenshots | Programming | CLI | Contribute | License Midica is an interpreter for a Music Programming Language. It translat

Jan Trukenmüller 47 Sep 17, 2021
A music programming language for musicians. :notes:

Installation | Docs | Changelog | Contributing composers chatting Alda is a text-based programming language for music composition. It allows you to co

Alda 4.7k Sep 25, 2021
Frescobaldi LilyPond Editor

README for Frescobaldi Homepage: http://www.frescobaldi.org/ Main author: Wilbert Berendsen Frescobaldi is a LilyPond sheet music text editor. It aims

Frescobaldi 501 Sep 21, 2021
web based music sheet viewer (go, pdfjs) as a single binary

Digital Music Stand A simple cross-platform browser-based pdfjs-based viewer to display and search music sheets. A single binary including all assets.

Patrick Wieschollek 21 Aug 27, 2021
The gPodder podcast client.

___ _ _ ____ __ _| _ \___ __| |__| |___ _ _ |__ / / _` | _/ _ \/ _` / _` / -_) '_| |_ \ \__, |_| \___/\__,_\__,_\___|_| |_

gPodder and related projects 892 Sep 14, 2021
Streaming music player that finds free music for you

Desktop music player focused on streaming from free sources Links Official website Mastodon Twitter Support channel (Matrix): #nuclear:matrix.org Disc

null 6.8k Sep 17, 2021
The git repository of the advanced drum machine

Hydrogen drum machine Hydrogen is an advanced drum machine for GNU/Linux, Mac and Windows. It's main goal is to bring professional yet simple and intu

Hydrogen 702 Sep 15, 2021
Python CD-DA ripper preferring accuracy over speed

Whipper Whipper is a Python 3 (3.6+) CD-DA ripper based on the morituri project (CDDA ripper for *nix systems aiming for accuracy over speed). It star

null 554 Sep 19, 2021
Python library for audio and music analysis

librosa A python package for music and audio analysis. Documentation See https://librosa.org/doc/ for a complete reference manual and introductory tut

librosa 4.8k Sep 25, 2021