Class MusicalTime
- Namespace
- NAudio.Sequencing
- Assembly
- NAudio.Core.dll
Constants and helpers for the canonical tick resolution used by the sequencing primitives. All ticks in ITempoMap, EventTimeline<T>, TimeSignatureMap, and Transport are at CanonicalPpq, regardless of the PPQ in any source file (e.g. a MIDI file). External PPQs must be rescaled at the ingestion boundary.
public static class MusicalTime
- Inheritance
-
MusicalTime
- Inherited Members
Fields
CanonicalPpq
The canonical pulses-per-quarter-note used by the sequencing layer. 960 divides cleanly into common subdivisions (8ths, 16ths, 32nds, triplets) and matches the default of most DAWs.
public const int CanonicalPpq = 960
Field Value
Properties
QuarterTripletTicks
Ticks per quarter-note triplet at the canonical PPQ.
public static long QuarterTripletTicks { get; }
Property Value
Methods
RescaleFromPpq(long, int)
Converts a tick value from an external PPQ (e.g. a MIDI file's DeltaTicksPerQuarterNote)
to the canonical PPQ used by the sequencing layer. Apply at the ingestion boundary to event
absolute times, tempo events, and time-signature events alike.
public static long RescaleFromPpq(long fileTick, int fileDeltaTicksPerQuarterNote)
Parameters
Returns
TicksPerDivision(int)
Returns the number of canonical ticks per note of the given musical division (4 = quarter, 8 = eighth, 16 = sixteenth, etc).
public static long TicksPerDivision(int division)
Parameters
divisionintA power-of-two note division (1 = whole, 4 = quarter, 16 = sixteenth).