<staffDef>

<staffDef> (staff definition) – Container for staff meta-information.
Module MEI.shared
Attributes
@beam.color (optional) Color of beams, including those associated with tuplets. Value conforms to data.COLOR . att.beaming.vis
@beam.group (optional) Provides an example of how automated beaming (including secondary beams) is to be performed. Value of datatype string. att.beaming.log
@beam.rend (optional) Encodes whether a beam is "feathered" and in which direction. Allowed values are: " acc" (Beam lines grow farther apart from left to right.), " rit" (Beam lines grow closer together from left to right.), " norm" (Beam lines are equally-spaced over the entire length of the beam.) att.beaming.vis
@beam.rests (optional) Indicates whether automatically-drawn beams should include rests shorter than a quarter note duration. Value conforms to data.BOOLEAN . att.beaming.log
@beam.slope (optional) Captures beam slope. Value of datatype decimal. att.beaming.vis
@clef.color (optional) Describes the color of the clef. Value conforms to data.COLOR . att.cleffing.vis
@clef.dis (optional) Records the amount of octave displacement to be applied to the clef. Value conforms to data.OCTAVE.DIS . att.cleffing.log
@clef.dis.place (optional) Records the direction of octave displacement to be applied to the clef. Value conforms to data.PLACE . att.cleffing.log
@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 . att.cleffing.log
@clef.shape (optional) Encodes a value for the clef symbol. Value conforms to data.CLEFSHAPE . att.cleffing.log
@clef.visible (optional) Determines whether the clef is to be displayed. Value conforms to data.BOOLEAN . att.cleffing.vis
@decls (optional) Identifies one or more metadata elements within the header, which are understood to apply to the element bearing this attribute and its content. One or more values from data.URI , separated by spaces. att.declaring
@dur.default (optional) Contains a default duration in those situations when the first note, rest, chord, etc. in a measure does not have a duration specified. Value conforms to data.DURATION . att.duration.default
@dynam.dist (optional) Records the default distance from the staff for dynamic marks. Value conforms to data.MEASUREMENTREL . att.distances
@grid.show (optional) Determines whether to display guitar chord grids. Value conforms to data.BOOLEAN . att.staffDef.vis
@harm.dist (optional) Records the default distance from the staff of harmonic indications, such as guitar chord grids or functional labels. Value conforms to data.MEASUREMENTREL . att.distances
@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 . att.instrumentident
@key.accid (optional) Contains an accidental for the tonic key, if one is required, e.g., if key.pname equals 'c' and key.accid equals 's', then a tonic of C# is indicated. Value conforms to data.ACCIDENTAL.IMPLICIT . att.keySigDefault.log
@key.mode (optional) Indicates major, minor, or other tonality. Value conforms to data.MODE . att.keySigDefault.log
@key.pname (optional) Holds the pitch name of the tonic key, e.g. 'c' for the key of C. Value conforms to data.PITCHNAME . att.keySigDefault.log
@key.sig (optional) Indicates where the key lies in the circle of fifths. Value conforms to data.KEYSIGNATURE . att.keySigDefault.log
@key.sig.mixed (optional) Mixed key signatures, e.g. those consisting of a mixture of flats and sharps (Read, p. 143, ex. 9-39), and key signatures with unorthodox placement of the accidentals (Read, p. 141) must be indicated by setting the key.sig attribute to 'mixed' and providing explicit key signature information in the key.sig.mixed attribute or in the <keySig> element. It is intended that key.sig.mixed contain a series of tokens with each token containing pitch name, accidental, and octave, such as 'a4 c5s e5f' that indicate what key accidentals should be rendered and where they should be placed. One or more values from data.KEYSIGTOKEN , separated by spaces. att.keySigDefault.log
@key.sig.show (optional) Indicates whether the key signature should be displayed. Value conforms to data.BOOLEAN . att.keySigDefault.vis
@key.sig.showchange (optional) Determines whether cautionary accidentals should be displayed at a key change. Value conforms to data.BOOLEAN . att.keySigDefault.vis
@label (optional) Provides a name or label for an element. The value may be any string. Value of datatype string. att.commonPart
@label.abbr (optional) Provides a label for a group of staves on pages after the first page. Usually, this label takes an abbreviated form. Value of datatype string. att.labels.addl
@layerscheme (optional) Indicates the number of layers and their stem directions. Value conforms to data.LAYERSCHEME . att.staffDef.vis
@lines (optional) Indicates the number of staff lines. Value of datatype positiveInteger. att.staffDef.vis
@lines.color (optional) Captures the colors of the staff lines. The value is structured; that is, it should have the same number of space-separated RGB values as the number of lines indicated by the lines attribute. A line can be made invisible by assigning it the same RGB value as the background, usually white. One or more values from data.COLOR , separated by spaces. att.staffDef.vis
@lines.visible (optional) Records whether all staff lines are visible. Value conforms to data.BOOLEAN . att.staffDef.vis
@lyric.align (optional) Describes the alignment of lyric syllables associated with a note or chord. Value conforms to data.MEASUREMENTREL . att.lyricstyle
@lyric.fam (optional) Sets the font family default value for lyrics. Value conforms to data.FONTFAMILY . att.lyricstyle
@lyric.name (optional) Sets the font name default value for lyrics. Value conforms to data.FONTNAME . att.lyricstyle
@lyric.size (optional) Sets the default font size value for lyrics. Value conforms to data.FONTSIZE . att.lyricstyle
@lyric.style (optional) Sets the default font style value for lyrics. Value conforms to data.FONTSTYLE . att.lyricstyle
@lyric.weight (optional) Sets the default font weight value for lyrics. Value conforms to data.FONTWEIGHT . att.lyricstyle
@mensur.color (optional) Records the color of the mensuration sign. Do not confuse this with the musical term 'color' as used in pre-CMN notation. Value conforms to data.COLOR . att.mensural.vis
@mensur.dot (optional) Determines if a dot is to be added to the base symbol. Value conforms to data.BOOLEAN . att.mensural.log
@mensur.form (optional) Indicates whether the base symbol is written vertically or horizontally. Allowed values are: " horizontal" , " vertical" att.mensural.vis
@mensur.loc (optional) Holds the staff location of the mensuration sign. Value conforms to data.STAFFLOC . att.mensural.vis
@mensur.orient (optional) Describes the rotation or reflection of the base symbol. Value conforms to data.ORIENTATION . att.mensural.vis
@mensur.sign (optional) The base symbol in the mensuration sign/time signature of mensural notation. Value conforms to data.MENSURATIONSIGN . att.mensural.log
@mensur.size (optional) Describes the relative size of the mensuration sign. Value conforms to data.SIZE . att.mensural.vis
@mensur.slash (optional) Indicates the number lines added to the mensuration sign. For example, one slash is added for what we now call 'alla breve'. Value of datatype positiveInteger. att.mensural.log
@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 additive expression that evaluates to a decimal number, such as 2+3. Value of datatype a string matching the following regular expression: "\d+(\.\d+)?(\s*\+\s*\d+(\.\d+)?)*" . att.meterSigDefault.log
@meter.rend (optional) Contains an indication of how the meter signature should be rendered. Allowed values are: " num" (Show only the number of beats.), " denomsym" (The lower number in the meter signature is replaced by a note symbol.), " norm" (Meter signature rendered using traditional numeric values.), " invis" (Meter signature not rendered.) att.meterSigDefault.vis
@meter.showchange (optional) Determines whether a new meter signature should be displayed when the meter signature changes. Value conforms to data.BOOLEAN . att.meterSigDefault.vis
@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 . att.meterSigDefault.vis
@meter.unit (optional) Contains the number indicating the beat unit, that is, the bottom number of the meter signature. Value of datatype decimal. att.meterSigDefault.log
@modusmaior (optional) Describes the maxima-long relationship. Value conforms to data.MODUSMAIOR . att.mensural.shared
@modusminor (optional) Describes the long-breve relationship. Value conforms to data.MODUSMINOR . att.mensural.shared
@multi.number (optional) Indicates whether programmatically calculated counts of multiple measures of rest (mRest) and whole measure repeats (mRpt) in parts should be rendered. Value conforms to data.BOOLEAN . att.multinummeasures
@n (optional) A non-negative integer value functioning as a "name". Value of datatype nonNegativeInteger. staffDef
@notationsubtype (optional) Provides any sub-classification of the notation contained or described by the element, additional to that given by its notationtype attribute. Value of datatype NMTOKEN. att.notationtype
@notationtype (optional) Contains classification of the notation contained or described by the element bearing this attribute. Value conforms to data.NOTATIONTYPE . att.notationtype
@num.default (optional) Along with numbase.default, describes the default duration as a ratio. num.default is the first value in the ratio. Value of datatype positiveInteger. att.duration.default
@numbase.default (optional) Along with num.default, describes the default duration as a ratio. numbase.default is the second value in the ratio. Value of datatype positiveInteger. att.duration.default
@octave.default (optional) Contains a default octave specification for use when the first note, rest, chord, etc. in a measure does not have an octave value specified. Value conforms to data.OCTAVE . att.octavedefault
@ontheline (optional) Determines the placement of notes on a 1-line staff. A value of 'true' places all notes on the line, while a value of 'false' places stems-up notes above the line and stems-down notes below the line. Value conforms to data.BOOLEAN . att.onelinestaff
@pedal.style (optional) Determines whether piano pedal marks should be rendered as lines or as terms. Allowed values are: " line" (Continuous line with start and end positions rendered by vertical bars and bounces shown by upward-pointing "blips".) , " pedstar" (Pedal down and half pedal rendered with "Ped.", pedal up rendered by "*", pedal "bounce" rendered with "* Ped.".) , " altpedstar" (Pedal up and down indications same as with "pedstar", but bounce is rendered with "Ped." only.) att.pianopedals
@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 of datatype positiveInteger. att.timebase
@prolatio (optional) Describes the semibreve-minim relationship. Value conforms to data.PROLATIO . att.mensural.shared
@proport.num (optional) Together, proport.num and proport.numbase specify a proportional change as a ratio, e.g., 1:3. Proport.num is for the first value in the ratio. Value of datatype positiveInteger. att.mensural.log
@proport.numbase (optional) Together, proport.num and proport.numbase specify a proportional change as a ratio, e.g., 1:3. Proport.numbase is for the second value in the ratio. Value of datatype positiveInteger. att.mensural.log
@reh.enclose (optional) Describes the enclosing shape for rehearsal marks. Allowed values are: " box" (Enclosed by box.), " circle" (Enclosed by circle.), " none" (No enclosing shape.) att.rehearsal
@scale (optional) Scale factor to be applied to the feature to make it the desired display size. Value conforms to data.PERCENT . att.scalable
@slur.lform (optional) Value conforms to data.LINEFORM . att.slurrend
@slur.lwidth (optional) Value conforms to data.LINEWIDTH . att.slurrend
@spacing (optional) Records the absolute distance (as opposed to the relative distances recorded in <scoreDef> elements) between this staff and the preceding one in the same system. This value is meaningless for the first staff in a system since the spacing.system attribute indicates the spacing between systems. Value conforms to data.MEASUREMENTREL . att.staffDef.vis
@tab.strings (optional) 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)?)*". att.staffDef.ges.tablature
@tempus (optional) Describes the breve-semibreve relationship. Value conforms to data.TEMPUS . att.mensural.shared
@text.dist (optional) Determines how far from the staff to render text elements. Value conforms to data.MEASUREMENTREL . att.distances
@text.fam (optional) Provides a default value for the font family name of text (other than lyrics) when this information is not provided on the individual elements. Value conforms to data.FONTFAMILY . att.textstyle
@text.name (optional) Provides a default value for the font name of text (other than lyrics) when this information is not provided on the individual elements. Value conforms to data.FONTNAME . att.textstyle
@text.size (optional) Provides a default value for the font size of text (other than lyrics) when this information is not provided on the individual elements. Value conforms to data.FONTSIZE . att.textstyle
@text.style (optional) Provides a default value for the font style of text (other than lyrics) when this information is not provided on the individual elements. Value conforms to data.FONTSTYLE . att.textstyle
@text.weight (optional) Provides a default value for the font weight for text (other than lyrics) when this information is not provided on the individual elements. Value conforms to data.FONTWEIGHT . att.textstyle
@tie.lform (optional) Value conforms to data.LINEFORM . att.tierend
@tie.lwidth (optional) Value conforms to data.LINEWIDTH . att.tierend
@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 of datatype decimal. att.transposition
@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 of datatype decimal. att.transposition
@visible (optional) Indicates if a feature should be rendered when the notation is presented graphically or sounded when it is presented in an aural form. Value conforms to data.BOOLEAN . att.visibility
@xml:base (optional) Provides a base URI reference with which applications can resolve relative URI references into absolute URI references. Value conforms to data.URI . att.commonPart
@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 of datatype ID. att.id
Member of
Contained by
MEI.cmn measure
MEI.critapp lem rdg
MEI.mensural ligature
MEI.neumes syllable
May contain
MEI.mensural mensur proport
MEI.midi instrDef
Declaration
<classes>
<memberOf key= " att.commonPart" />
<memberOf key= " att.declaring" />
<memberOf key= " att.staffDef.log" />
<memberOf key= " att.staffDef.vis" />
<memberOf key= " att.staffDef.ges" />
<memberOf key= " att.staffDef.anl" />
<memberOf key= " model.staffDefLike" />
</classes>
<content>
<rng:zeroOrMore>
<rng:ref name= " model.labelLike" />
</rng:zeroOrMore>
<rng:zeroOrMore>
<rng:choice>
<rng:ref name= " model.instrDefLike" />
<rng:ref name= " model.layerDefLike" />
<rng:ref name= " model.staffDefPart" />
</rng:choice>
</rng:zeroOrMore>
</content>
Constraints
A staffDef must have an n attribute.
The first occurrence of a staff must declare the number of staff lines.
Only one clef or clefGrp is permitted.
<sch:rule context= "mei:staffDef">
<sch:let name= "thisstaff" value= "@n"/>
<sch:assert test= "@n"> A staffDef must have an n attribute. </sch:assert>
<sch:assert test= "@lines or preceding::mei:staffDef[@n=$thisstaff and @lines]"> The first occurrence of a staff must declare the number of staff lines. </sch:assert>
<sch:assert test= "count(mei:clef) + count(mei:clefGrp) < 2"> Only one clef or clefGrp is permitted. </sch:assert>
</sch:rule>
Constraints
If a staffDef appears in a staff, it must bear the same @n as this staff.
<sch:rule context= "mei:staffDef[ancestor::mei:staff]">
<sch:let name= "thisstaff" value= "@n"/>
<sch:assert test= "ancestor::mei:staff/@n eq $thisstaff"> If a staffDef appears in a staff, it must bear the same @n as this staff. </sch:assert>
</sch:rule>
Constraints
The clef position must be less than or equal to the number of lines on the staff.
<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>
Constraints
The clef position must be less than or equal to the number of lines on the staff.
<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>
Constraints
The tab.strings attribute must have the same number of values as there are staff lines.
<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 = 1 or $countTokens = @lines"> The tab.strings attribute must have the same number of values as there are staff lines. </sch:assert>
</sch:rule>
Constraints
The tab.strings attribute must have the same number of values as there are staff lines.
<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 = 1 or $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>
Constraints
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.
<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>
Constraints
The value of ppq must be a factor of the value of ppq on an ancestor scoreDef.
<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>
Constraints
The value of ppq must be a factor of the value of ppq on a preceding scoreDef.
<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>

MEI Guidelines Version 3.0.0

MEI Elements