PTimePoints:
Filter:
ddwPatterns/Classes (extension) | Streams-Patterns-Events > Patterns > Time

PTimePoints
ExtensionExtension

Converts an event pattern based on time points into one based on deltas

Description

Most event patterns specify rhythm in terms of time deltas between events. (The formal term is "inter-onset interval" or IOI.) Some rhythms may be more convenient to express in terms of time points within a measure:

Time pointMeaning
0barline
1beat 2
2.52nd eighth-note of beat 3

PTimePoints supports this by converting successive time points into deltas. Write the time point sequence into the \timept event key.

NOTE: The delta is the time until the next event. To fill in the delta for the event that should play now, PTimePoints must get the subsequent event now. Calculations within that event that depend on the clock's current time will be incorrect, including Env as streams, Pseg and Ptime.
NOTE: If two successive time points are the same, the second will occur one bar later.

Reference point: Barline

Time points make sense only in reference to a barline. TempoClock defines barlines according to its variables TempoClock: -beatsPerBar and TempoClock: -baseBarBeat. Barlines occur at integer multiples of beatsPerBar after baseBarBeat: if n is an integer, barline = baseBarBeat + (beatsPerBar * n).

These two variables are set whenever you change the meter using beatsPerBar's setter method:

NOTE: Because of this, you must play a PTimePoints on a TempoClock. SystemClock and AppClock will not work because they have no concept of meter.

PTimePoints will begin with a rest event if needed, to synchronize to the first sounding event's time point.

When the child pattern ends, the final event's delta will bring the pattern player back to the next barline.

Class Methods

.new

Create a PTimePoints.

Arguments:

pattern

An event pattern, where the result events contain values for \timept.

tolerance

Avoids certain problems with floating-point rounding. Time points whose difference is below tolerance are treated as the same time point.

Returns:

An instance of PTimePoints.

Instance Methods

.tolerance

Gets or sets the tolerance value.

Returns:

A SimpleNumber reflecting a number of beats.

Examples