<staffDef>

Module
Attributes
@clef.dis, @clef.dis.place, @clef.line, @clef.shape, @instr, @keysig, @label, @lines, @lines.color, @lines.visible, @meter.count, @meter.sym, @meter.unit, @n, @ppq, @scale, @tab.courses, @tab.strings, @trans.diat, @trans.semi, @tune.Hz, @tune.pname, @tune.temper, @type, @xml:id
@clef.dis(optional)Records the amount of octave displacement to be applied to the clef. Value conforms to data.OCTAVE.DIS.
@clef.dis.place(optional)Records the direction of octave displacement to be applied to the clef. Value conforms to data.STAFFREL.basic.
@clef.line(optional)Contains a default value for the position of the clef. The value must be in the range between 1 and the number of lines on the staff. The numbering of lines starts with the lowest line of the staff. Value conforms to data.CLEFLINE.
@clef.shape(optional)Encodes a value for the clef symbol. Value conforms to data.CLEFSHAPE.
@instr(optional)Provides a way of pointing to a MIDI instrument definition. It must contain the ID of an <instrDef> element elsewhere in the document. Value conforms to data.URI.
@keysig(optional)Written key signature. One or more values from data.KEYFIFTHS, separated by spaces.
@label(optional)Captures text to be used to generate a label for the element to which it’s attached, a "tool tip" or prefatory text, for example. Should not be used to record document content. Value is plain text.
@lines(optional)Indicates the number of staff lines. Value is a positive integer.
@lines.color(optional)Captures the colors of the staff lines. One or more values from data.COLOR, separated by spaces.
@lines.visible(optional)Records whether all staff lines are visible. Value conforms to data.BOOLEAN.
@meter.count(optional)Captures the number of beats in a measure, that is, the top number of the meter signature. It must contain a decimal number or an expression that evaluates to a decimal number, such as 2+3 or 3*2. Value is plain text.
@meter.sym(optional)Indicates the use of a meter symbol instead of a numeric meter signature, that is, 'C' for common time or 'C' with a slash for cut time. Value conforms to data.METERSIGN.
@meter.unit(optional)Contains the number indicating the beat unit, that is, the bottom number of the meter signature. Value is a decimal number.
@n(optional)Provides a numeric designation that indicates an element’s position in a sequence of similar elements. Its value must be a non-negative integer. Value is a positive integer, including 0.
@ppq(optional)Indicates the number of pulses (sometimes referred to as ticks or divisions) per quarter note. Unlike MIDI, MEI permits different values for a score and individual staves. Value is a positive integer.
@scale(optional)Scale factor to be applied to the feature to make it the desired display size. Value conforms to data.PERCENT.
@tab.courses(optional)This attribute is deprecated in favor of the new tuning [not available in this MEI customization] element and will be removed in a future version. Provides a *written* pitch and octave for each open string or course of strings. One or more values conforming to the pattern " [a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?([a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?)*".
@tab.strings(optional)This attribute is deprecated in favor of the new tuning [not available in this MEI customization] element and will be removed in a future version. Provides a *written* pitch and octave for each open string or course of strings. One or more values conforming to the pattern " [a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?([a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?)*".
@trans.diat(optional)Records the amount of diatonic pitch shift, e.g., C to C♯ = 0, C to D♭ = 1, necessary to calculate the sounded pitch from the written one. Value is an integer.
@trans.semi(optional)Records the amount of pitch shift in semitones, e.g., C to C♯ = 1, C to D♭ = 1, necessary to calculate the sounded pitch from the written one. Value is an integer.
@tune.Hz(optional)Holds a value for cycles per second, i.e., Hertz, for a tuning reference pitch. Value is a decimal number.
@tune.pname(optional)Holds the pitch name of a tuning reference pitch, i.e., the central tone of a tuning system. Value conforms to data.PITCHNAME.
@tune.temper(optional)Provides an indication of the tuning system, just, for example. Value conforms to data.TEMPERAMENT.
@type(optional)Designation which characterizes the element in some sense, using any convenient classification scheme or typology that employs single-token labels. One or more values of datatype NMTOKEN, separated by spaces.
@xml:id(optional)Regularizes the naming of an element and thus facilitates building links between it and other resources. Each id attribute within a document must have a unique value. Value is a valid xml:id.
(MEI.shared) Attributes that form the basis of the att.common class.
(MEI.shared) Attributes that uniquely identify an element.
@xml:id(optional)Regularizes the naming of an element and thus facilitates building links between it and other resources. Each id attribute within a document must have a unique value. Value is a valid xml:id.
(MEI.shared)
@label(optional)Captures text to be used to generate a label for the element to which it’s attached, a "tool tip" or prefatory text, for example. Should not be used to record document content. Value is plain text.
(MEI.shared) Attributes used to supply an integer number designation for an element.
@n(optional)Provides a numeric designation that indicates an element’s position in a sequence of similar elements. Its value must be a non-negative integer. Value is a positive integer, including 0.
(MEI.shared) Attributes which can be used to classify features.
@type(optional)Designation which characterizes the element in some sense, using any convenient classification scheme or typology that employs single-token labels. One or more values of datatype NMTOKEN, separated by spaces.
(MEI.gestural) Gestural domain attributes for staffDef in the CMN repertoire.
(MEI.midi) Attributes which identify a MIDI instrument.
@instr(optional)Provides a way of pointing to a MIDI instrument definition. It must contain the ID of an <instrDef> element elsewhere in the document. Value conforms to data.URI.
(MEI.stringtab) This collection of attributes is deprecated in favor of the new element and will be removed in a future version. String tablature tuning information.
@tab.strings(optional)This attribute is deprecated in favor of the new tuning [not available in this MEI customization] element and will be removed in a future version. Provides a *written* pitch and octave for each open string or course of strings. One or more values conforming to the pattern " [a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?([a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?)*".
@tab.courses(optional)This attribute is deprecated in favor of the new tuning [not available in this MEI customization] element and will be removed in a future version. Provides a *written* pitch and octave for each open string or course of strings. One or more values conforming to the pattern " [a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?([a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?)*".
(MEI.midi) Attributes that record time-base information.
@ppq(optional)Indicates the number of pulses (sometimes referred to as ticks or divisions) per quarter note. Unlike MIDI, MEI permits different values for a score and individual staves. Value is a positive integer.
(MEI.shared) Attributes that describe tuning.
@tune.Hz(optional)Holds a value for cycles per second, i.e., Hertz, for a tuning reference pitch. Value is a decimal number.
@tune.pname(optional)Holds the pitch name of a tuning reference pitch, i.e., the central tone of a tuning system. Value conforms to data.PITCHNAME.
@tune.temper(optional)Provides an indication of the tuning system, just, for example. Value conforms to data.TEMPERAMENT.
(MEI.shared) Logical domain attributes for staffDef.
@lines(optional)Indicates the number of staff lines. Value is a positive integer.
(MEI.shared) Used by staffDef and scoreDef to provide default values for attributes in the logical domain related to clefs.
@clef.shape(optional)Encodes a value for the clef symbol. Value conforms to data.CLEFSHAPE.
@clef.line(optional)Contains a default value for the position of the clef. The value must be in the range between 1 and the number of lines on the staff. The numbering of lines starts with the lowest line of the staff. Value conforms to data.CLEFLINE.
@clef.dis(optional)Records the amount of octave displacement to be applied to the clef. Value conforms to data.OCTAVE.DIS.
@clef.dis.place(optional)Records the direction of octave displacement to be applied to the clef. Value conforms to data.STAFFREL.basic.
(MEI.shared) Used by staffDef and scoreDef to provide default values for attributes in the logical domain that are related to key signatures.
@keysig(optional)Written key signature. One or more values from data.KEYFIFTHS, separated by spaces.
(MEI.shared) Used by staffDef and scoreDef to provide default values for attributes in the logical domain related to meter signature.
@meter.count(optional)Captures the number of beats in a measure, that is, the top number of the meter signature. It must contain a decimal number or an expression that evaluates to a decimal number, such as 2+3 or 3*2. Value is plain text.
@meter.unit(optional)Contains the number indicating the beat unit, that is, the bottom number of the meter signature. Value is a decimal number.
@meter.sym(optional)Indicates the use of a meter symbol instead of a numeric meter signature, that is, 'C' for common time or 'C' with a slash for cut time. Value conforms to data.METERSIGN.
(MEI.shared) Attributes that describe transposition.
@trans.diat(optional)Records the amount of diatonic pitch shift, e.g., C to C♯ = 0, C to D♭ = 1, necessary to calculate the sounded pitch from the written one. Value is an integer.
@trans.semi(optional)Records the amount of pitch shift in semitones, e.g., C to C♯ = 1, C to D♭ = 1, necessary to calculate the sounded pitch from the written one. Value is an integer.
(MEI.cmn) Logical domain attributes for staffDef in the CMN repertoire.
(MEI.visual) Visual domain attributes for staffDef.
@lines.color(optional)Captures the colors of the staff lines. One or more values from data.COLOR, separated by spaces.
@lines.visible(optional)Records whether all staff lines are visible. Value conforms to data.BOOLEAN.
(MEI.shared) Attributes that describe relative size.
@scale(optional)Scale factor to be applied to the feature to make it the desired display size. Value conforms to data.PERCENT.
@instr(optional)Provides a way of pointing to a MIDI instrument definition. It must contain the ID of an <instrDef> element elsewhere in the document. Value conforms to data.URI.
@ppq(optional)Indicates the number of pulses (sometimes referred to as ticks or divisions) per quarter note. Unlike MIDI, MEI permits different values for a score and individual staves. Value is a positive integer.
@clef.dis(optional)Records the amount of octave displacement to be applied to the clef. Value conforms to data.OCTAVE.DIS.
@clef.dis.place(optional)Records the direction of octave displacement to be applied to the clef. Value conforms to data.STAFFREL.basic.
@clef.line(optional)Contains a default value for the position of the clef. The value must be in the range between 1 and the number of lines on the staff. The numbering of lines starts with the lowest line of the staff. Value conforms to data.CLEFLINE.
@clef.shape(optional)Encodes a value for the clef symbol. Value conforms to data.CLEFSHAPE.
@keysig(optional)Written key signature. One or more values from data.KEYFIFTHS, separated by spaces.
@label(optional)Captures text to be used to generate a label for the element to which it’s attached, a "tool tip" or prefatory text, for example. Should not be used to record document content. Value is plain text.
@lines(optional)Indicates the number of staff lines. Value is a positive integer.
@meter.count(optional)Captures the number of beats in a measure, that is, the top number of the meter signature. It must contain a decimal number or an expression that evaluates to a decimal number, such as 2+3 or 3*2. Value is plain text.
@meter.sym(optional)Indicates the use of a meter symbol instead of a numeric meter signature, that is, 'C' for common time or 'C' with a slash for cut time. Value conforms to data.METERSIGN.
@meter.unit(optional)Contains the number indicating the beat unit, that is, the bottom number of the meter signature. Value is a decimal number.
@n(optional)Provides a numeric designation that indicates an element’s position in a sequence of similar elements. Its value must be a non-negative integer. Value is a positive integer, including 0.
@scale(optional)Scale factor to be applied to the feature to make it the desired display size. Value conforms to data.PERCENT.
@trans.diat(optional)Records the amount of diatonic pitch shift, e.g., C to C♯ = 0, C to D♭ = 1, necessary to calculate the sounded pitch from the written one. Value is an integer.
@trans.semi(optional)Records the amount of pitch shift in semitones, e.g., C to C♯ = 1, C to D♭ = 1, necessary to calculate the sounded pitch from the written one. Value is an integer.
@tune.Hz(optional)Holds a value for cycles per second, i.e., Hertz, for a tuning reference pitch. Value is a decimal number.
@tune.pname(optional)Holds the pitch name of a tuning reference pitch, i.e., the central tone of a tuning system. Value conforms to data.PITCHNAME.
@tune.temper(optional)Provides an indication of the tuning system, just, for example. Value conforms to data.TEMPERAMENT.
@type(optional)Designation which characterizes the element in some sense, using any convenient classification scheme or typology that employs single-token labels. One or more values of datatype NMTOKEN, separated by spaces.
@xml:id(optional)Regularizes the naming of an element and thus facilitates building links between it and other resources. Each id attribute within a document must have a unique value. Value is a valid xml:id.
@tab.courses(optional)This attribute is deprecated in favor of the new tuning [not available in this MEI customization] element and will be removed in a future version. Provides a *written* pitch and octave for each open string or course of strings. One or more values conforming to the pattern " [a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?([a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?)*".
@tab.strings(optional)This attribute is deprecated in favor of the new tuning [not available in this MEI customization] element and will be removed in a future version. Provides a *written* pitch and octave for each open string or course of strings. One or more values conforming to the pattern " [a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?([a-g][0-9](s|f|ss|x|ff|xs|sx|ts|tf|n|nf|ns|su|sd|fu|fd|nu|nd|1qf|3qf|1qs|3qs)?)*".
@lines.color(optional)Captures the colors of the staff lines. One or more values from data.COLOR, separated by spaces.
@lines.visible(optional)Records whether all staff lines are visible. Value conforms to data.BOOLEAN.
Member of
model.staffDefLikeGroups elements that permit declaration of staff properties.
Contained By
(MEI.shared) Groups elements that permit declaration of staff properties.
<ending>Alternative ending for a repeated passage of music; i.e., prima volta, seconda volta, etc.
<score>Full score view of the musical content.
<staff>A group of equidistant horizontal lines on which notes are placed in order to represent pitch or a grouping element for individual 'strands' of notes, rests, etc. that may or may not actually be rendered on staff lines; that is, both diastematic and non-diastematic signs.
<staffGrp>(staff group) – A group of bracketed or braced staves.
(MEI.shared) Groups elements that may appear as part of a section.
<section>Segment of music data.
<ending>Alternative ending for a repeated passage of music; i.e., prima volta, seconda volta, etc.
<score>Full score view of the musical content.
<section>Segment of music data.
<staff>A group of equidistant horizontal lines on which notes are placed in order to represent pitch or a grouping element for individual 'strands' of notes, rests, etc. that may or may not actually be rendered on staff lines; that is, both diastematic and non-diastematic signs.
<staffGrp>(staff group) – A group of bracketed or braced staves.
May Contain
(MEI.shared) Groups elements used to declare a MIDI instrument.
<instrDef>MIDI instrument declaration.
(MEI.shared) Groups elements used to assign a label to other parts of a document.
<label>A container for document text that identifies the feature to which it is attached. For a "tool tip" or other generated label, use the @label attribute.
<labelAbbr>A label on the pages following the first.
(MEI.shared) Groups elements that permit declaration of layer properties.
(MEI.shared) Groups elements that may appear in the declaration of staff features.
<clef>Indication of the exact location of a particular note on the staff and, therefore, the other notes as well.
<clefGrp>A set of simultaneously-occurring clefs.
(MEI.shared) Groups elements that have the same function as a key signature.
(MEI.shared) Groups elements that represent a meter signature.
<instrDef>MIDI instrument declaration.
<clef>Indication of the exact location of a particular note on the staff and, therefore, the other notes as well.
<clefGrp>A set of simultaneously-occurring clefs.
<label>A container for document text that identifies the feature to which it is attached. For a "tool tip" or other generated label, use the @label attribute.
<labelAbbr>A label on the pages following the first.
Constraints

StaffDef must have an n attribute.
Either @lines must be present or a preceding staffDef with the same value for @n and @lines must exist.
Only one clef or clefGrp is permitted.
@n must have the same value as the current staff.
Either @lines must be present or a preceding staffDef with matching @n value and @lines must exist.
The clef position must be less than or equal to the number of lines on the staff.
The clef position must be less than or equal to the number of lines on the staff.
The tab.strings attribute must have the same number of values as there are staff lines.
The tab.strings attribute must have the same number of values as there are staff lines.
The lines.color attribute must have either 1) a single value or 2) the same number of values as there are staff lines.
The lines.color attribute must have either 1) a single value or 2) the same number of values as there are staff lines.
The value of ppq must be a factor of the value of ppq on an ancestor scoreDef.
The value of ppq must be a factor of the value of ppq on a preceding scoreDef.

Declaration
<elementSpec rend="add" ident="staffDef" module="MEI.shared">
<gloss xml:lang="en">staff definition</gloss>
<desc xml:lang="en">Container for staff meta-information.</desc>
<classes>
<memberOf key="att.basic"/>
<memberOf key="att.labelled"/>
<memberOf key="att.nInteger"/>
<memberOf key="att.typed"/>
<memberOf key="att.staffDef.ges"/>
<memberOf key="att.staffDef.log"/>
<memberOf key="att.staffDef.vis"/>
<memberOf key="model.staffDefLike"/>
</classes>
<content>
<zeroOrMore>
<ref name="model.labelLike"/>
</zeroOrMore>
<zeroOrMore>
<choice>
<ref name="model.instrDefLike"/>
<ref name="model.layerDefLike"/>
<ref name="model.staffDefPart"/>
</choice>
</zeroOrMore>
<optional>
<ref name="ambitus"/>
</optional>
</content>
<constraintSpec ident="Check_staffDefn" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[not(ancestor::mei:staff)]">
<sch:let name="thisstaff" value="@n"/>
<sch:assert test="@n">StaffDef must have an n attribute.</sch:assert>
<sch:assert test="@lines or preceding::mei:staffDef[@n=$thisstaff and @lines]"> Either @lines must be present or a preceding staffDef with the same value for @n and @lines must exist.</sch:assert>
<sch:assert test="count(mei:clef) + count(mei:clefGrp) < 2">Only one clef or clefGrp is permitted.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_ancestor_staff" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[ancestor::mei:staff and @n]">
<sch:let name="thisstaff" value="@n"/>
<sch:assert test="ancestor::mei:staff/@n eq $thisstaff">@n must have the same value as the current staff.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_ancestor_staff_lines" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[ancestor::mei:staff and not(@n)]">
<sch:let name="thisstaff" value="ancestor::mei:staff/@n"/>
<sch:assert test="@lines or preceding::mei:staffDef[@n=$thisstaff and @lines]"> Either @lines must be present or a preceding staffDef with matching @n value and @lines must exist.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_clef_position_staffDef" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[@clef.line and @lines]">
<sch:assert test="number(@clef.line) <= number(@lines)">The clef position must be less than or equal to the number of lines on the staff.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_clef_position_staffDef_nolines" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[@clef.line and not(@lines)]">
<sch:let name="thisstaff" value="@n"/>
<sch:let name="stafflines" value="preceding::mei:staffDef[@n=$thisstaff and @lines][1]/@lines"/>
<sch:assert test="number(@clef.line) <= number($stafflines)">The clef position must be less than or equal to the number of lines on the staff.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_tab_strings_lines" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[@tab.strings and @lines]">
<sch:let name="countTokens" value="count(tokenize(normalize-space(@tab.strings), '\s'))"/>
<sch:assert test="$countTokens = @lines">The tab.strings attribute must have the same number of values as there are staff lines.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_tab_strings_nolines" scheme="schematron">
<constraint>
<sch:rule context="mei:staffDef[@tab.strings and not(@lines)]">
<sch:let name="countTokens" value="count(tokenize(normalize-space(@tab.strings), '\s'))"/>
<sch:let name="thisstaff" value="@n"/>
<sch:assert test="$countTokens = preceding::mei:staffDef[@n=$thisstaff and @lines][1]/@lines">The tab.strings attribute must have the same number of values as there are staff lines.</sch:assert>
</sch:rule>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_lines_color" scheme="schematron">
<constraint>
<sch:pattern>
<sch:rule context="mei:staffDef[@lines.color and @lines]">
<sch:let name="countTokens" value="count(tokenize(normalize-space(@lines.color), '\s'))"/>
<sch:assert test="$countTokens = 1 or $countTokens = @lines">The lines.color attribute must have either 1) a single value or 2) the same number of values as there are staff lines.</sch:assert>
</sch:rule>
<sch:rule context="mei:staffDef[@lines.color and not(@lines)]">
<sch:let name="countTokens" value="count(tokenize(normalize-space(@lines.color), '\s'))"/>
<sch:let name="thisstaff" value="@n"/>
<sch:assert test="$countTokens = 1 or $countTokens = preceding::mei:staffDef[@n=$thisstaff and @lines][1]/@lines">The lines.color attribute must have either 1) a single value or 2) the same number of values as there are staff lines.</sch:assert>
</sch:rule>
</sch:pattern>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_staff_ppq_ancestor" scheme="schematron">
<constraint>
<sch:pattern>
<sch:rule context="mei:staffDef[@ppq][ancestor::mei:scoreDef[@ppq]]">
<sch:let name="staffPPQ" value="@ppq"/>
<sch:let name="scorePPQ" value="ancestor::mei:scoreDef[@ppq][1]/@ppq"/>
<sch:assert test="($scorePPQ mod $staffPPQ) = 0">The value of ppq must be a factor of the value of ppq on an ancestor scoreDef.</sch:assert>
</sch:rule>
</sch:pattern>
</constraint>
</constraintSpec>
<constraintSpec ident="Check_staff_ppq_preceding" scheme="schematron">
<constraint>
<sch:pattern>
<sch:rule context="mei:staffDef[@ppq][preceding::mei:scoreDef[@ppq]]">
<sch:let name="staffPPQ" value="@ppq"/>
<sch:let name="scorePPQ" value="preceding::mei:scoreDef[@ppq][1]/@ppq"/>
<sch:assert test="($scorePPQ mod $staffPPQ) = 0">The value of ppq must be a factor of the value of ppq on a preceding scoreDef.</sch:assert>
</sch:rule>
</sch:pattern>
</constraint>
</constraintSpec>
</elementSpec>