C# to MusicXML? [closed]
Asked Answered
D

3

6

Anyone know of any libraries that can be used to write MusicXML data from C#? Similar to this: http://proxymusic.kenai.com/ (although this one is for java).

I would try to not write it manually, but if worse comes to worst, I will have no choice but to output and write MusicXML manually from my results.

Dodie answered 4/7, 2011 at 4:52 Comment(0)
G
7

Since MusicXML has a XML schema available, you can use xsd.exe to create the classes that represent the XML structure:

xsd /c xlink.xsd musicxml.xsd container.xsd opus.xsd

Then you can use XmlSerializer to load and save the generated classes from/to files.

(For some reason, one of the schema files, osfpvg.xsd, wasn't able to compile correctly. Here's hoping you won't need it.)

Garceau answered 4/7, 2011 at 12:26 Comment(3)
as far as I know osfpvg.xsd is not one of the schema files.Hustle
from a visual studio command prompt i ran the following and it worked: xsd /c musicxml.xsd xlink.xsd xml.xsdHustle
I had to reverse the order here and do: xsd musicxml/schema/*.xsd /c FYIThoughtout
T
1

To use xsd.exe, you can use this command:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\xsd.exe" "c:\dev\musicxml30\musicxml.xsd" "c:\dev\musicxml30\xlink.xsd" "c:\dev\musicxml30\xml.xsd" /c /o:"c:\dev"

Which will create a file called musicxml_xlink_xml.cs in the c:\dev folder.

Compiled Class

Tripura answered 16/4, 2012 at 0:8 Comment(0)
L
1

For me when i tried to convert the MusicXml3.0.xsd, xsd.exe failed everytime. So, what i did was

xsd.exe musicFile.xml 

which generated a schema file, and

xsd.exe musicFile.xsd /classes

which produced the required c# classes. The only thing i had to add in order for the generated xml to be read by programs like Sibelius 7 was to add

<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 2.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">

And presto!

Lassitude answered 14/6, 2014 at 8:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.