sounds.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:annotation>
        <xs:documentation>MusicXML Sounds W3C XML schema (XSD)

Version 4.0

Copyright © 2004-2021 the Contributors to the MusicXML Specification, published by the W3C Music Notation Community Group under the W3C Community Final Specification Agreement (FSA):

    https://www.w3.org/community/about/agreements/final/

A human-readable summary is available:

    https://www.w3.org/community/about/agreements/fsa-deed/

This is the W3C XML Schema (XSD) version of the MusicXML 4.0 format. Validation is tightened by moving MusicXML definitions from comments into schema data types and definitions. Character entities and other entity usages that are not supported in W3C XML Schema have also been removed. However, the features of W3C XML Schema make it easier to define variations of the MusicXML format, either via extension or restriction.

Starting with Version 3.0, the MusicXML format includes a standard set of instrument sounds to identify musical timbres. These values are used in the instrument-sound element.

The standard sounds are listed in the sounds.xml file included with MusicXML 4.0. This is the W3C XML Schema for that file.

The XML catalog at catalog.xml supports validating against a local copy of this XSD rather than the networked version. Software often has trouble using system IDs due to factors such as restrictions on network access, or resources having moved from the original specified location. To validate with the MusicXML XSD, use a schema URI of "http://www.musicxml.org/xsd/sounds.xsd".</xs:documentation>
    </xs:annotation>
    
    <!-- Simple types -->
    
    <xs:simpleType name="yes-no">
        <xs:annotation>
            <xs:documentation>The yes-no type is used for boolean-like attributes. We cannot use W3C XML Schema booleans due to their restrictions on expression of boolean values.</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:token">
            <xs:enumeration value="yes"/>
            <xs:enumeration value="no"/>
        </xs:restriction>
    </xs:simpleType>
    
    <!-- Complex types -->
    
    <xs:complexType name="sounds">
        <xs:annotation>
            <xs:documentation>The sounds type is used for the root element of a MusicXML sounds file. It contains one or more sound elements.</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="sound" type="sound" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    
    <xs:complexType name="sound">
        <xs:annotation>
            <xs:documentation>The sound type lists one of the standard sounds available in MusicXML 4.0. The required id attribute lists the MusicXML sound identifier string used by the instrument-sound element.

The optional any, solo, and ensemble elements can be used for mapping MusicXML sound IDs to an application's or virtual instrument library's method of identifying sounds. These methods could include Sibelius SoundWorld IDs, capella genericsound IDs, and General MIDI patch numbers.

The primary attribute is used when multiple sound elements map to the same application or library ID. In this case, the primary attribute indicates which of the MusicXML IDs is primary when mapping to a MusicXML sound id.</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element name="any" type="any" minOccurs="0" maxOccurs="unbounded"/>
            <xs:sequence>
                <xs:element name="solo" type="solo" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element name="ensemble" type="ensemble" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:choice>
        <xs:attribute name="id" type="xs:ID" use="required"/>
        <xs:attribute name="primary" type="yes-no"/>
    </xs:complexType>
    
    <xs:complexType name="any">
        <xs:annotation>
            <xs:documentation>The any type is used when a MusicXML ID refers to a single application or library sound ID, regardless of whether a solo or ensemble sound is used. The element content is the application or library sound ID.

Multiple any elements can be used when multiple application sounds map to the same MusicXML sound id. The primary attribute indicates which of the any elements is primary when mapping from a MusicXML sound id.</xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="primary" type="yes-no"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    
    <xs:complexType name="ensemble">
        <xs:annotation>
            <xs:documentation>The solo and ensemble elements are used when an application has different IDs for solo and ensemble sounds, as represented by the solo and ensemble elements in a MusicXML score file. The ensemble type corresponds to the ensemble element in the MusicXML score file. The element content is the application or library sound ID.

The number attribute for the ensemble element represents the size of the ensemble, corresponding to the content of the ensemble element in a MusicXML score file.

Multiple solo and ensemble elements can be used when multiple application sounds map to the same MusicXML sound id. The primary attribute indicates which ensemble element is primary when mapping from a MusicXML sound id.</xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="number" type="xs:NMTOKEN"/>
                <xs:attribute name="primary" type="yes-no"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    
    <xs:complexType name="solo">
        <xs:annotation>
            <xs:documentation>The solo and ensemble elements are used when an application has different IDs for solo and ensemble sounds, as represented by the solo and ensemble elements in a MusicXML score file. The solo type corresponds to the solo element in the MusicXML score file. The element content is the application or library sound ID.

Multiple solo and ensemble elements can be used when multiple application sounds map to the same MusicXML sound id. The primary attribute indicates which solo element is primary when mapping from a MusicXML sound id.</xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="primary" type="yes-no"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    
    <!-- Global element that is the root for MusicXML opus files -->
    
    <xs:element name="sounds" type="sounds" block="extension substitution" final="#all">
        <xs:annotation>
            <xs:documentation>The sounds element with a sounds type is the root element for a MusicXML sounds document.</xs:documentation>
        </xs:annotation>
    </xs:element>
</xs:schema>