Second voice per staff¶
This document defines the syntax and semantics of the second musical voice on the same staff in neumaRk: marker, structural position, context rules, graphic rendering, and diagnostics.
The second voice is an independent musical stream that shares the same staff as the principal voice but evolves with its own rhythm and its own persistent musical context.
1. Definition¶
In neumaRk a staff can contain up to two independent voices:
- voice 1 (or principal voice), introduced by the
N)line (orN+, seeneumaRk_datapack.md§4.5); - voice 2 (or secondary voice), introduced by the
N2line, optional.
The two voices:
- share the staff, the clef, the key, the time signature, the measure barlines,
and the chord line
C); - maintain independent rhythmic and melodic streams;
- have separate persistent musical contexts (
last_pitch,durCtx).
A staff can have at most one voice 2. Voice 2 exists only if explicitly declared: in its absence the staff is monodic.
Staff ≠ voice. The concept of staff (
N)/N+) describes the stave; the concept of voice (1st or 2nd) describes the musical stream within that stave. A piece with 4 staves may have up to 8 total voices (4 staves × 2 voices), with no further aggregate limits.
2. Marker syntax¶
2.1 Form¶
The voice 2 marker is the sequence of two characters:
N2
followed by a space, analogously to N) and N+. The digit 2 replaces the ), preserving the 2-character width invariant required for the vertical alignment of the barlines across the datapack lines.
2.2 Relation to the general marking rules¶
The general rule (neumaRk_datapack.md §2.1) provides for markers formed by one, two, or three uppercase letters followed by ). The markers N+ and N2 are morphological variants of N) explicitly provided for by the specification and do not represent an arbitrary exception: the identifying letter N remains unchanged, and the second character distinguishes the role () continuation, + new staff, 2 second voice).
3. Structural position and binding¶
3.1 Voice group¶
Each voice is described by a voice group of the form:
[A)] N) [D)] [L)] ← voice 1 group
[A)] N2 [D)] [L)] ← voice 2 group (optional)
The A), D), L) lines bind by position:
A)(articulations) precedes itsN)/N2;D)(dynamics) andL)(lyrics) follow theirN)/N2, in that order.
Both voices can declare their own articulations, dynamics, and lyrics independently.
3.2 Binding to the parent staff¶
An N2 line binds to the immediately preceding staff in the same datapack, identified by the most recent N) or N+ line. Between the parent N) / N+ and the N2, only the following are allowed:
- the eventual
D)/L)of the voice 1 group; - the eventual
A)of the voice 2 group.
Any other interposed line interrupts the binding and makes the N2 not recognized as voice 2 of the preceding staff (error E123).
3.3 Uniqueness per staff¶
Within the same datapack, each staff can have at most one N2 line. The presence of multiple consecutive N2 lines binding to the same staff produces error E124.
3.4 N2 as the first note line¶
An N2 not preceded by an N) or N+ in the same datapack has no valid parent and is invalid (E123).
4. Musical context of voice 2¶
4.1 Independent stream¶
The persistent musical context defined in neumaRk_specification.md §2.1 is per-stream: each (staff, voice) pair maintains its own last_pitch, its own durCtx, and the propagation state of the measure accidentals.
Context updates made by the events of voice 1 do not modify the context of voice 2, and vice versa.
4.2 Initialization at first appearance¶
When voice 2 of a staff appears for the first time in a datapack — that is, when in the preceding datapack the same staff did not contain a voice 2 — its initial reference (last_pitch and durCtx) is inherited from voice 1 of the same staff, in its state at the beginning of the current datapack.
Equivalently: voice 2 enters as if it were, at that precise musical instant, a continuation of voice 1 — and from that instant onward it maintains its own separate stream.
DP1:
N) a4
DP2:
N) c ← inherits a4 → c5 (minimum interval)
N2 a ← first appearance: inherits a4 (voice 1 at the start of DP2)
→ a4. From here voice 2 continues with its own stream.
4.3 Subsequent appearances¶
When voice 2 was already present in the preceding datapack, it inherits normally from its own stream:
DP3:
N) c ← inherits from voice 1 of DP2
N2 a ← inherits from voice 2 of DP2
4.4 Suspended voices¶
If voice 2 of a staff is present in one datapack, absent in the next, and reappears in a still later datapack, upon reappearance rule §4.2 applies again: the context of voice 2 is reinitialized from voice 1 of the same staff at the beginning of the datapack of reappearance.
The historical context of voice 2 prior to the suspension is not recovered.
4.5 Voices in a staff introduced with N+¶
If voice 2 appears in a staff introduced in that datapack via N+, voice 1 of the staff is itself "fresh" (orientation reference based on the clef, see neumaRk_notes_and_durations.md §2.2). Voice 2 consequently inherits the same clef-dependent reference at the beginning of its own stream.
5. Graphic rendering¶
5.1 Stem direction¶
The simultaneous presence of voice 1 and voice 2 on the same staff fixes the stem direction in a normative way:
- voice 1 → stems always up;
- voice 2 → stems always down.
This rule applies independently of the pitch of the notes and overrides any automatic rendering heuristic in effect when the staff is monodic.
5.2 Rests¶
The rests of the two voices are independent. When the natural vertical position of a rest collides with that of the other voice, the renderer applies a clarity offset according to the standard conventions of musical notation; this does not alter the semantics.
6. Alignment and validity¶
6.1 Number of measures¶
Voice 2 must contain the same number of measures as the parent staff. It is the same rule that applies between staves of a multi-stave system (neumaRk_datapack.md §4.3).
6.2 Chord line¶
The C) line is system-wide and is shared by all the voices of all the staves of the datapack. There is no per-voice C).
6.3 Clef¶
The clef is a property of the staff, not of the voice. An inline clef directive as the first token of an N2 line (e.g. N2 (@F) …) is not allowed and produces error E125.
6.4 Anacrusis¶
The anacrusis sign > is per-line and may appear independently in N) and in N2.
6.5 Measure repeat¶
The % token (and the variants %!, %2, %!2, %4, %!4, see neumaRk_flow_and_repeats.md §7) applies per-line: its presence in N2 repeats voice 2 of the source measure, without involving voice 1. The eventual copies of A), D), L) follow the same layer rules already defined for single lines.
6.6 Grace notes¶
Grace notes ([ … ], see neumaRk_grace_notes.md) are allowed within N2 with the same rules as voice 1. Their local context of pitch and accidentals lives in the stream of voice 2.
7. Diagnostics¶
7.1 Error codes¶
| Code | Description |
|---|---|
| E123 | N2 without a valid parent staff (N) or N+) in the datapack |
| E124 | More than one N2 bound to the same staff in the same datapack |
| E125 | Inline clef directive on an N2 line |
7.2 Misaligned measures¶
A misalignment of the number of measures between N2 and the parent staff falls under the same validity rules as multi-stave (neumaRk_datapack.md §4.3).
8. Examples¶
8.1 Minimal voice 2¶
C) A7
N) a1
N2 e4 d e2
Single staff in treble clef. Voice 1: one whole note a for the measure. Voice 2: two quarter notes and one half note.
8.2 Both voices with independent A/D/L¶
C) A7
A) .
N) a1
D) f
L) ah
A) ! !
N2 e4 d e2
D) p
L) la la la
The A) . line binds to N) a1; the A) ! ! line binds to N2. The dynamics and lyrics of each voice are independent.
8.3 Multi-stave with voice 2 on the upper staff¶
C) G7
N) | <d b>2 <e c>4 |
N2 | g8 a b a g a b a |
N) (@F) | g,4. d'8 e d |
Two-staff system. The upper staff (treble) contains two voices; the lower staff (bass) is monodic.
8.4 Multi-stave with voice 2 on the lower staff¶
C) G7
N) | <d b>2 <e c>4 |
N+ (@F) | g,4. d'8 e d |
N2 | r4 c8 d e d c b, |
Two-staff system introduced in this datapack. The N2 binds to the staff introduced by N+ (bass), which therefore remains two-voiced, while the upper staff (treble) is monodic.
8.5 Voice 2 at first appearance¶
N) a4
N) c
N2 a
N) c
N2 a
- DP1: voice 1 ends with
a4. - DP2: voice 1
cinheritsa4→c5; voice 2ais at its first appearance, inheritsa4from voice 1 at the start of the datapack →a4. - DP3: voice 1
cinherits from voice 1 of DP2 →c5; voice 2ainherits from its own stream (voice 2 of DP2) →a4.
8.6 Suspended and reappearing voice¶
N) c4
N2 a
N) e
N) c
N2 a
- DP1: voice 1
c4, voice 2a4(first appearance, inherits from voice 1 →a4, minimum interval). - DP2: only voice 1 → voice 2 is suspended.
- DP3: voice 2 reappears → rule §4.2 applies again; voice 2 inherits from voice 1 of DP3 at the start of the datapack, not from its own historical stream.