Table of Contents

Struct Phrase

Namespace
Celeritas.Core.Analysis
Assembly
Celeritas.dll

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

StartIndex int

Position of the phrase's first note in the buffer given to Analyze(NoteBuffer, FormAnalysisOptions?), so that buffer.Get(StartIndex) is that note.

EndIndex int

Position of the phrase's last note in the same buffer.

Start Rational

Onset of the phrase (whole-note units).

End Rational

End time of the phrase (whole-note units).

NoteCount int

Number of notes in the phrase.

EndingCadence CadenceType

Cadence 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

Rational

EndIndex

Position of the phrase's last note in the same buffer.

public int EndIndex { get; init; }

Property Value

int

EndingCadence

Cadence classified at the phrase end, or None.

public CadenceType EndingCadence { get; init; }

Property Value

CadenceType

Length

Duration of the phrase (End - Start, whole-note units).

public Rational Length { get; }

Property Value

Rational

NoteCount

Number of notes in the phrase.

public int NoteCount { get; init; }

Property Value

int

Start

Onset of the phrase (whole-note units).

public Rational Start { get; init; }

Property Value

Rational

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; }

Property Value

int