MusicTheory Docs API Toolbox GitHub NuGet
Contents

API / MusicTheory

RhythmEvent record

A chord, a single note or a rest with a duration. An empty RhythmEvent.Pitches list is a rest.

Constructors

RhythmEvent(IReadOnlyList<Note> Pitches, Duration Duration, bool TiedToNext = false)
A chord, a single note or a rest with a duration. An empty RhythmEvent.Pitches list is a rest.
Pitches
The sounding notes; empty for a rest.
Duration
How long the event lasts.
TiedToNext
Whether the event is tied into the next one. Not allowed on a rest.

Properties

IReadOnlyList<Note> Pitches { get; init; }
The sounding notes; empty for a rest.
Duration Duration { get; init; }
How long the event lasts.
bool TiedToNext { get; init; }
Whether the event is tied into the next one.

Throws ArgumentException Set on a rest.

bool IsRest { get; }
True when the event has no pitches.

Methods

bool Equals(RhythmEvent? other)
Two events are equal when they have the same pitches in order, duration and tie.
int GetHashCode()
static RhythmEvent Rest(Duration duration)
Creates a rest.
duration
The rest's duration.

Returns A rest event.