Previous | Up | Home | Next


MIDI Integration

This section describes how a complete MIDI file can be integrated into a NIFF file.

In the Setup Section, each part can globally be assigned a MIDI channel number and cable number in the Part Description chunk. The part can be given a new set of channel and cable numbers at any point during the score by applying the Part Description Override tag. This might be used to switch to a new instrument sound, such as in a part for oboe and English horn.

In the Data Section, the MIDI Data Stream chunk and MIDI Performance tag are used. There are four possible relationships between the notation symbols and MIDI data:

  1. One to one correlation - notes. In the case of the pairing of a Notehead chunk and a Note On message, the MIDI Performance tag is appended to the Notehead chunk. The MIDI Performance tag includes the pitch and velocity of a MIDI Note On message, plus the performance start time and duration in MIDI ticks. The start time is given as an offset from the current time-slice.
  2. One symbol, one or more MIDI messages. For example, a dynamic associated with a control change message, a hairpin associated with a controller 7 sweep or a turn or a trill symbol associated with a series of Note On and Note Off messages. This is represented by a MIDI Data Stream chunk anchored to a music symbol chunk. The MIDI Data Stream chunk indicates the start time of the beginning of the stream, in MIDI ticks, as an offset from the current time-slice. It includes any number of MIDI events, stored as in a MIDI file, starting at time zero.
  3. Many to many correlation, where the number of symbol chunks is different from the number of MIDI messages. For example, a pitch bend might be associated with portamento notation composed of two Notehead chunks and the diagonal line Portamento chunk between them. In this case, the MIDI Data Stream is made into a multi-node symbol, with each node corresponding to one of the notation symbols. Only the first node contains the actual series of MIDI Pitch Bend Change messages.
  4. No correlation. Either the notation has no clear MIDI meaning (for example a text string like "espressivo"), or the MIDI data has no standard notational equivalent (like panning information). The latter case is represented by a MIDI Data Stream chunk anchored to a Time-Slice. It may or may not be associated with a particular part.

Guitar Tablature.

Guitar Tablature is encoded as a separate Staff list within a System list in the Data Section. It is normally the second staff of a part with two staves, and should be counted in the maximum number of staves in the Setup Section Part Description chunk. The Guitar Tablature tag, the Number of Staff Lines tag (with a value of 6), and the Part ID tag are added to the Staff Header chunk.

The standard Clef chunk is used, with its value indicating TAB. Guitar TAB Number chunks are used to place the numbers on the string lines, and standard Barline chunks are used for barlines.The tablature symbols are stored with time-slice chunks that correspond to those of the music symbols displayed on the standard notated staff above.

Guitar slashes.

There are two types of guitar slashes. Those with rhythm indicators such as stems, flags and beams are encoded using standard Stem and Notehead chunks, with a special slash notehead shape. For a guitar slash indicating a simple repetition of a chord symbol, the Repeat Sign chunk should be used, most likely with a Chord Symbol chunk.

Part and Staff Names.

The Part Description chunk has fields for part name and part abbreviation. These can be used by the reading program as the names to be placed to the left of the system identifying the parts. This would be easiest in simple scores, where there is a clear correspondence between parts and staves and each Staff Header chunk has a Part ID tag to identify it. The part name font in the Default Values chunk can be used by the reading program for these simple part names and abbreviations.

In more complex cases, the writing program can use more precision in describing the function and placement of text to appear to the left of the system. An individual label can be specified for either a staff or a staff grouping. For instance, it is possible to give the label "Horns" to a brace connecting a pair of horn staves, one labeled "1-3" and the other "4-6." To create a label for a staff or staff grouping, the writing program should use the Staff Name tag on Text chunks stored in the appropriate context. The placement tag and Font ID tag may also be used.

For a staff name, a Text chunk with the Staff Name tag should be stored following a Staff Header chunk. Its placement, if specified, would be given relative to the staff's origin. For a grouping name, a Text chunk with the Staff Name tag should be stored following a Staff Grouping chunk in a Staff Groupings list (in either the Setup Section or the Data Section). Its placement, if specified, would then be given relative to the staff origin of the top staff of the grouping.


An ossia is to be stored as one or more additional Staff chunks within a System list, each labelled with an Ossia tag applied to the Staff Header chunk. The presence of the Ossia tag indicates that this is an alternate performance of the symbols in one or more other staves. The part and voice of the ossia staves' symbols must be marked (individually, or by a shorthand method), to indicate which parts and voices it represents an alternative to.

The value of the ossia tag indicates whether the ossia or the non-ossia alternative is to sound during playback. (The choice may be given to the user, or may depend on the capabilities of the notation software.)

Additional tags which might be added to the Staff Header for an ossia are the placement tags and the Width tag, indicating a shorted staff that starts partway into the measure..

Measure Numbering and Rehearsal Marks.

The Measure Numbering chunk is used to assign a measure numbering scheme. It allows for choice of the numbering frequency, starting number, and logical placement of the measure numbers. The measure numbering scheme can be changed at the start of any measure in the score, by storing this chunk after the appropriate measure-start Time-Slice chunk in the first Staff list of a System list.

For precise placement of individual numbers, or to use letters instead of numbers, use the Rehearsal Mark chunk instead.

Repeats and Alternate Endings.

A repeated section of a score appears in the NIFF file only once. A Repeat Sign symbol contains information about both the graphical repeat sign and its function. It follows a Time-slice chunk (either measure-start or event type) at either the beginning or the end of the section to be repeated. The Repeat Sign chunk can be used for many kinds of repetition. It can indicate the appearance of symbols, printed words, or abbreviations, and the repetition of a beat, measure or whole section.

Alternate endings introduce an apparent timing inconsistency: the start times in the measures of later endings duplicate the start times of measures in the first ending. To allow the reading program to make sense of this inconsistency, each measure-start Time-slice chunk of each ending is to have an Alternate Ending tag attached. When calculating the start time of the time-slice following a series of alternate endings, only the longest of the alternate endings should be considered.

There would normally also be an Alternate Ending Graphic chunk which indicates the appearance of the alternate ending, at least on the topmost staff. But it is the Alternate Ending tag which definitively resolves the timing conflict.

Tag Activate/Tag Inactivate

When one or more tags is to be applied to a sequence of symbols in a Staff list, the Tag Activate chunk can be used to identify the start of the sequence, and the Tag Inactivate chunk to identify the end of the sequence. Each tag is activated independently of the others, but they can be grouped together on the Tag Activate/Inactivate chunks. For example, the Tag Activate may include the Font ID, Small Size and Grace Note tags, while one Tag Inactivate chunk ends the Grace Note tag long before the other two tags are ended with another Tag Inactivate chunk.

A tag on a Tag Activate chunk remains in effect until a Tag Inactivate chunk appears with the same tag, or the end of the current Staff list is found, whichever occurs first. Tag Activate chunks can also be nested.

The Tag Activate chunk is useful for saving space, but another purpose is to allow for additive applications of a particular tag - such as when a very small grace note is present within a cadenza-like passage of small notes. This example is shown below:

	Time-Slice, type=event
a)	Notehead

	Tag Activate, Small Size

	Time-Slice, type=event
	Time-Slice, type=event
	Stem, Grace Note, Small Size
b)	Notehead
c)	Notehead

	Time-Slice, type=event
	Tag Inactivate, Small Size

	Time-Slice, type=event
d)	Notehead

Notehead (a) before the Tag Activate chunk and Notehead (d) after the Tag Inactivate chunk are normal sized. Notehead (c) is a small note, affected by the Small Size tag on the Tag Activate chunk. Notehead (b) is a very small note, affected cumulatively by the Small Size tag on its Stem and by the Small Size tag on the Tag Activate chunk. Tag Activate restricted by Part ID, Voice ID

Part ID and Voice ID have a special meaning on the Tag Activate chunk. When Part ID and/or Voice ID appear on the Tag Activate chunk, their purpose is to restrict the action of the Tag Activate to the subset of the intervening chunks which have matching Part ID and/or Voice ID's. If any intervening chunks have a different Part ID or Voice ID from that specified on the Tag Activate chunk, those chunks are not affected by the Tag Activate.

The following example shows use of the Voice ID to restrict the mode to one voice only:

	Tag Activate, Voice ID=2, Small Size

	Stem, Voice ID = 1
a)	Notehead

	Stem, Voice ID = 2
b)	Notehead

	Tag Inactivate, Voice ID=2, Small Size

Only Notehead (b) is affected by the Small Size tag on the Tag Activate chunk.

N.B. For some chunks within the Tag Activate scope, the tags would be meaningless and should be ignored by the reading program. An example is the Small Size tag as applied to a Time-Slice chunk.

Previous | Up | Home | Next