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
This modified version provides a C# library to use with the .NET framework (at least 4.5.2). It puts the LibMEI functionality on top of the Linq to Xml interface.
LibMEI is released under the MIT license.
A Visual Studio project is provided for compilation in the c-sharp
directory.
The dll could be included by adding the Reference and:
using mei;
Basic usage of libMEI.NET is possible without including Linq to Xml, but for advanced usage it could be necessary, e.g. functional construction of attributes. To include Linq to Xml add:
using System.Xml.Linq;
Elements could be created like:
Note note1 = new Note();
PersName name2 = new PersName("name");
Attributes could be used by methods, e.g.:
note1.SetLabel("example");
note1.HasLabel();
note1.GetLabelAttribute();
note1.GetLabelValue();
note1.RemoveLabel();
The code for mei-all 3.0.0 is included in the project.
To customize libMEI.NET use the Python script parseschema2.py
in the tools
directory with csharp
as language option on a compiled ODD file, e.g.:
python tools/parseschema2.py mei-all.xml -l csharp
I've tested the script with Python 3.7.
Also, within the c-sharp
directory a tools.sln
is provided to use the Python script with Visual Studio.
After running the script, replace the atts
and elements
folders in c-sharp\libmei\libmei
with the folders in the output. It will be necessary to remove the content of the folders within the project and add them again.