Struct Phrase
A run of notes delimited by rests, with its span and ending cadence.
public readonly record struct Phrase : IEquatable<Phrase>
- Implements
- Inherited Members
Remarks
Both indices address the caller's buffer as it was passed, whether or not it held rests or was
offset-sorted. They used to be positions in the analyzer's private copy — rests dropped, then
sorted — so with a rest between two phrases buffer.Get(StartIndex) of the second phrase
returned the rest, and in an unsorted buffer it returned whatever note happened to sit at that
slot. First and last are by time: in a buffer that was not offset-sorted StartIndex
may exceed EndIndex, and the positions between them need not be the phrase's notes.
Nor is the span a note count even in a sorted buffer: a rest too short to end the phrase still
occupies a position between them, so NoteCount counts the notes, not
EndIndex - StartIndex + 1.
Constructors
Phrase(int, int, Rational, Rational, int, CadenceType)
A run of notes delimited by rests, with its span and ending cadence.
public Phrase(int StartIndex, int EndIndex, Rational Start, Rational End, int NoteCount, CadenceType EndingCadence = CadenceType.None)
Parameters
StartIndexintPosition of the phrase's first note in the buffer given to Analyze(NoteBuffer, FormAnalysisOptions?), so that
buffer.Get(StartIndex)is that note.EndIndexintPosition of the phrase's last note in the same buffer.
StartRationalOnset of the phrase (whole-note units).
EndRationalEnd time of the phrase (whole-note units).
NoteCountintNumber of notes in the phrase.
EndingCadenceCadenceTypeCadence classified at the phrase end, or
None.
Remarks
Both indices address the caller's buffer as it was passed, whether or not it held rests or was
offset-sorted. They used to be positions in the analyzer's private copy — rests dropped, then
sorted — so with a rest between two phrases buffer.Get(StartIndex) of the second phrase
returned the rest, and in an unsorted buffer it returned whatever note happened to sit at that
slot. First and last are by time: in a buffer that was not offset-sorted StartIndex
may exceed EndIndex, and the positions between them need not be the phrase's notes.
Nor is the span a note count even in a sorted buffer: a rest too short to end the phrase still
occupies a position between them, so NoteCount counts the notes, not
EndIndex - StartIndex + 1.
Properties
End
End time of the phrase (whole-note units).
public Rational End { get; init; }
Property Value
EndIndex
Position of the phrase's last note in the same buffer.
public int EndIndex { get; init; }
Property Value
EndingCadence
Cadence classified at the phrase end, or None.
public CadenceType EndingCadence { get; init; }
Property Value
Length
Duration of the phrase (End - Start, whole-note units).
public Rational Length { get; }
Property Value
NoteCount
Number of notes in the phrase.
public int NoteCount { get; init; }
Property Value
Start
Onset of the phrase (whole-note units).
public Rational Start { get; init; }
Property Value
StartIndex
Position of the phrase's first note in the buffer given to Analyze(NoteBuffer, FormAnalysisOptions?), so that buffer.Get(StartIndex) is that note.
public int StartIndex { get; init; }