Table of Contents

Class DefaultHarmonicRhythmStrategy

Namespace
Celeritas.Core.Harmonization
Assembly
Celeritas.dll

Default strategy: one chord per beat (or per note if longer than a beat).

public sealed class DefaultHarmonicRhythmStrategy : IHarmonicRhythmStrategy
Inheritance
DefaultHarmonicRhythmStrategy
Implements
Inherited Members

Constructors

DefaultHarmonicRhythmStrategy(Rational?)

Default strategy: one chord per beat (or per note if longer than a beat).

public DefaultHarmonicRhythmStrategy(Rational? beatDuration = null)

Parameters

beatDuration Rational?

Beat length in whole-note units; defaults to a quarter note when null.

Methods

Segment(ReadOnlySpan<NoteEvent>)

Segments the melody into beat-aligned slices, skipping beats with no sounding notes. A beat in which nothing new begins — only notes held over from the beat before, and the same ones — joins the slice before it, so a note longer than a beat gets one chord.

public IReadOnlyList<MelodySlice> Segment(ReadOnlySpan<NoteEvent> melody)

Parameters

melody ReadOnlySpan<NoteEvent>

Returns

IReadOnlyList<MelodySlice>

Remarks

The class has always been documented as one chord per beat "or per note if longer than a beat", and the second half of that was never true: a held whole note came back as four quarter-beat slices, and the harmonizer put four chords under it — C, F, C, C under a single sustained C. Beats without a fresh onset are folded into the slice that started the note now, and the strong-beat flag stays with that slice's own beat.