[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FW: [L Peter Deutsch] Exporting Sibelius data
FW: [L Peter Deutsch] Exporting Sibelius data
23 May 2010 21:28:42 +0200
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
Subject: Exporting Sibelius data
Date: Sat, 22 May 2010 21:58:02 -0700 (PDT)
Dear fellow music hackers,
It seems that many of us independently came up with the idea of a Sibelius
plug-in that can write out the score data in a form suitable for further
processing. After reading various postings on the lilypond users list, I
believe that my plug-in is the most advanced and complete, and I would like
to find out how we can collaborate best.
I've attached a draft of the README for my package, which is very close to
The plug-in is generated automatically from something that is semantically
halfway between a DTD and a W3C Schema, but is actually Python code that
declares a Python class for each element. I have an XML reader that knows
about this format and makes it very easy to write apps that process the XML.
At last weekend's Music Hack Day in San Francisco, in less than 24 hours I
wrote a reasonably complete converter from sibxml to mup
(http://www.arkkra.com), which is my favorite notation program. The
converter is about 1100 lines of Python and handles a lot of things beyond
the obvious, including tablature notation (added later) and mid-measure clef
I'm not sure how much further I'm going to push this code. I have a short
list of specific things I intend to do before releasing it. The current
code is not Open Source; I'm currently leaning towards a Creative Commons
style license for the release, which is unrestricted (but requires
acknowledgement) for non-commercial distribution and prohibits commercial
In addition to the README, I've attached a sample class and a snippet of
code from the mup converter to make things more concrete.
I'm not on the lilypond-users list, so I'd be grateful if someone could post
this message for me (perhaps without the attachments). I'm very interested
in hearing from any of you.
L Peter Deutsch
---------------- sample class/element declaration ----------------
_contents_ = [('brackets', repeated(child('Bracket')))]
class BracketsAndBraces(_versions(BracketsAndBraces_6_1)): pass
_attributes_ = dict(\
#BottomStave = child('Stave') -- not exported
BottomStaveNum = REQUIRED(positiveInteger),
BracketType = DEFAULT(nonNegativeInteger.with_(maxInclusive = 2), 0),
#TopStave = child('Stave') -- not exported
TopStaveNum = REQUIRED(positiveInteger)
class Bracket(_versions(Bracket_6_1)): pass
---------------- sample client app code ----------------
import SibeliusElements as SE
return (int(self.TopStaveNum), int(self.BottomStaveNum))
def ranges(self, btype):
return [bracket.range() for bracket in self.brackets \
if int(bracket.BracketType) == btype]
class Bracket(SE.Bracket, _staffrange): pass
This is the README file for the sibxml package, which provides software
support for working with Sibelius score files with the least possible use of
This file, and all files in this package, are Copyright (c) 2010 Aladdin
Enterprises, Menlo Park, California. All rights reserved. See the LICENSE
section of this file (below) for the full license statement.
This package is intended to make it much easier for third parties to create
software for working with score files produced by the commercial Sibelius
score editors. Unfortunately, the native .sib format is not documented, the
Sibelius EULA forbids anyone with a licensed copy of the software to reverse
engineer the format, and .sib files are apparently encrypted using a
partially random key specifically to prevent third parties from analyzing
them, so this package cannot provide software for working with .sib files
directly. Instead, it provides the following:
* A plug-in for Sibelius versions 4 through 6.1 that writes out the entire
contents of a score in an XML form called sibxml. This is the only part
of the package that requires running Sibelius.
* A partial plug-in for Sibelius versions 4 through 6.1 that reads in a
score in sibxml format. DON'T TRY TO USE THIS.
* The DTD for sibxml.
* Python classes that directly represent sibxml elements.
* A simple Python framework that makes it easy to read in sibxml files,
using one's own subclasses of the element classes if desired.
Unless otherwise noted, "Python" below means Python 2.5 or later (2.x, not
3.x -- I consider Python 3 a tragic mistake). The package was developed
with Python 2.5.1 and 2.5.2.
For converting Sibelius score files to sibxml files: Sibelius version 4 or
later. Python (2.3.5 or later) is required for installing the plug-in.
****** FIX THIS IF POSSIBLE *****
For creating the Sibelius plug-in and the sibxml DTD: Python.
For reading sibxml files using the Python base classes provided in this
README - this file.
DOCUMENTATION - the module documentation for all directly invokable Python
modules (marked with "*" below)
SibeliusElements.py - the data description (Python classes = XML elements)
for Sibelius score data.
makefile - a makefile for the mechanically-created files.
* demo.py - a tiny demo to print some information about a score.
* el2x.py - the main Python module that generates the Sibelius plug-ins and
elemental.py - base classes for XML elements (not only for sibxml).
ereader.py - base classes for reading sibxml files.
eversions.py - base classes for versioned XML elements, an extension of
* makeinstall.py - script to create the plug-in installer.
ms_templates.py - ManuScript code templates for the plug-ins.
The following files are included in the package, but are removed by 'make
clean' since they are generated by 'make':
sibxml.dtd - the DTD for sibxml.
ConvertFolderToSibxml.plg - the Sibelius plug-in for converting an entire
folder of Sibelius scores to sibxml.
ConvertSibxmls.plg - the NOT YET WORKING Sibelius plug-in for converting an
entire folder of sibxml files to Sibelius scores.
ImportSibxml.plg - the NOT YET WORKING Sibelius plug-in for importing sibxml
ExportAsSibxml.plg - the Sibelius plug-in for exporting sibxml files.
ExportFullAsSibxml.plg - a Sibelius plug-in for exporting sibxml files with
no default values (useful only for debugging).
* install-sibxml-plugins - the installer for the plug-ins.
This package comes with no support. However, if you find a bug, or if you
want to help improve it, you may e-mail the author at address@hidden
The author would also appreciate any leads on information about the .sib
format that has been obtained without violating the EULA.
Q1. Why did you create this package? Doesn't MusicXML fulfill this purpose?
A1. First, the only existing MusicXML exporter for Sibelius is expensive:
Recordare currently (May 2010) charges $199.95 per copy, and there is no
"try before you buy" or return option. The sibxml package is free.
Second, MusicXML deliberately does not attempt to represent all the
information that Sibelius manages. For example, Sibelius has the
concept of annotations (e.g. dynamics or tempo) that are associated with
the score as a whole and that will appear on individually extracted
parts. MusicXML simply does not have this concept -- annotations are
associated with specific parts -- so exporting a Sibelius file to
MusicXML loses this information. sibxml loses no information.
Third, the Recordare MusicXML exporter is written in ManuScript,
Sibelius's plug-in language. The ManuScript interpreter is very slow --
roughly 15 times slower than Python for simple computations (see
speedtest.py) -- so there is a difficult tradeoff between the quality of
the exported file and the time spent creating it. The sibxml exporter
is a factor of xxx ****** DETERMINE THIS ****** faster than the MusicXML
exporter on some sample files.
Fourth, Sibelius's MusicXML *importer* has substantial problems. It is
not clear whether these are simply bugs, or caused by missing or
ambiguous information in the design of MusicXML itself, or caused by
missing or ambiguous information in MusicXML files produced by other
programs, or inherent in the semantic mismatch between Sibelius and
MusicXML; whatever the cause, they are a significant issue for using
MusicXML as the vehicle for moving score data into Sibelius. The sibxml
approach potentially allows creating lossless importers as well as
exporters, although the current package does not include one.
Finally, even though the Recordare MusicXML exporter comes with full
source code and users can modify it ****** CHECK THIS ******, ManuScript
is a very limited language, with quirks that can easily trip up
programmers. (For example, 0, false, the empty string, and the null
object are all generally equal to each other, except that 0='' is true,
while ''=0 is false. If x is an array, then after the sequence x=1,
v=x, x=2, the value of v is 2, not 1.) It also has very limited
development tools. The sibxml approach supports further processing
(such as converting sibxml to other formats such as MusicXML) in any
language: Python is especially convenient, but the use of the
well-documented XML and DTD standards makes sibxml language-,
environment-, and vendor-neutral.
Q2. Why did you create your own base classes for representing XML data?
Doesn't ElementTree, which is included in the Python distribution,
already do this?
A2. ElementTree is oriented towards a "dumb data" representation -- treating
elements as a combination of dictionaries and lists rather than using a
class for each element type. The ElementTree package may support
per-element-type classes by using a custom TreeBuilder, but the protocol
responsibilities of such classes appear to be totally undocumented. In
contrast, the sibxml framework treats XML as a representation of
structured, typed data.
ElementTree also provides no framework for documenting or checking the
set of attributes allowed for each element type, or the types of the
values of those attributes. I.e., its data model is essentially XML
with no DTD or schema. The sibxml framework supports a subset of the
DTD content language, and most of the W3C Schema attribute type
ElementTree does not deal with versioned schemas; sibxml does, which is
essential for a validating parser for sibxml data.
Copyright (c) 2010 Aladdin Enterprises, Menlo Park, California.
All rights reserved.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
[... rest of license will go here ...]
- FW: [L Peter Deutsch] Exporting Sibelius data,
Johan Vromans <=