Table of Contents

Class OrnamentApplier

Namespace
Celeritas.Core.Ornamentation
Assembly
Celeritas.dll

Utility class for applying ornaments to note sequences

public static class OrnamentApplier
Inheritance
OrnamentApplier
Inherited Members

Methods

Apply(NoteEvent[], IReadOnlyDictionary<int, Ornament>)

Apply ornaments to a melody by note index (as used in examples).

public static NoteEvent[] Apply(NoteEvent[] melody, IReadOnlyDictionary<int, Ornament> ornamentMap)

Parameters

melody NoteEvent[]
ornamentMap IReadOnlyDictionary<int, Ornament>

Returns

NoteEvent[]

Remarks

Every note not being ornamented keeps its written offset, so a lengthening articulation (the fermata preset) overlaps the note after it in a single line; see the span overload.

Exceptions

ArgumentNullException

melody or ornamentMap is null.

Apply(ReadOnlySpan<NoteEvent>, IReadOnlyDictionary<int, Ornament>)

Apply ornaments to a melody by note index (as used in examples).

public static NoteEvent[] Apply(ReadOnlySpan<NoteEvent> melody, IReadOnlyDictionary<int, Ornament> ornamentMap)

Parameters

melody ReadOnlySpan<NoteEvent>
ornamentMap IReadOnlyDictionary<int, Ornament>

Returns

NoteEvent[]

Remarks

Each ornament is expanded in place of its note and every other note keeps its written offset. An ornament that subdivides its note fits inside it; an articulation that lengthens it — the fermata preset, or any DurationMultiplier above 1 — is given no room, so in a single line the lengthened note is still sounding at the next onset and overlaps it. Delaying the rest of the line is the caller's to do.

Exceptions

ArgumentNullException

ornamentMap is null.

ApplyOrnaments(NoteEvent[], Ornament[])

Apply ornaments to a sequence of notes. An ornament is matched to a note by (Offset, Pitch) of its BaseNote, so multiple ornaments may share an offset (e.g. on different notes of a chord). Ornaments that match no note are ignored.

public static NoteEvent[] ApplyOrnaments(NoteEvent[] notes, Ornament[] ornaments)

Parameters

notes NoteEvent[]
ornaments Ornament[]

Returns

NoteEvent[]

Remarks

As with Apply(ReadOnlySpan<NoteEvent>, IReadOnlyDictionary<int, Ornament>), the notes around an ornament keep their written offsets: a lengthening articulation (the fermata preset) is given no room and overlaps the note after it in a single line.

Exceptions

ArgumentNullException

notes or ornaments is null.

CreateAppoggiatura(NoteEvent, AppogiaturaType, int)

Create an appoggiatura ornament

public static Appoggiatura CreateAppoggiatura(NoteEvent baseNote, AppogiaturaType type = AppogiaturaType.Long, int interval = 2)

Parameters

baseNote NoteEvent
type AppogiaturaType
interval int

Returns

Appoggiatura

Exceptions

ArgumentOutOfRangeException

type is not a defined AppogiaturaType value.

CreateMordent(NoteEvent, MordentType, int, int)

Create a mordent ornament

public static Mordent CreateMordent(NoteEvent baseNote, MordentType type = MordentType.Upper, int interval = 2, int alternations = 1)

Parameters

baseNote NoteEvent
type MordentType
interval int
alternations int

Returns

Mordent

Exceptions

ArgumentOutOfRangeException

type is not a defined MordentType value.

CreateTrill(NoteEvent, int, int, bool, bool)

Create a trill ornament

public static Trill CreateTrill(NoteEvent baseNote, int interval = 2, int speed = 8, bool startWithUpper = false, bool endWithTurn = false)

Parameters

baseNote NoteEvent
interval int
speed int
startWithUpper bool
endWithTurn bool

Returns

Trill

CreateTurn(NoteEvent, TurnType, int, int)

Create a turn ornament

public static Turn CreateTurn(NoteEvent baseNote, TurnType type = TurnType.Normal, int upperInterval = 2, int lowerInterval = 2)

Parameters

baseNote NoteEvent
type TurnType
upperInterval int
lowerInterval int

Returns

Turn

Exceptions

ArgumentOutOfRangeException

type is not a defined TurnType value.