Class Timer

Description

Class for calculating human-usable musical time divisions from the internal MIDI clock ticks

  • since: 1.0

Located in /Util/Timer.php (line 22)


	
			
Variable Summary
Method Summary
Timer __construct (int $timeDivision)
int dot (int $ticks)
int eighthNote ()
int getTicksForNoteDivision (int $division)
int halfNote ()
int quarterNote ()
int resolveTriplet (int $ticks)
int sixteenthNote ()
int stoccato (int $ticks)
int triplet (int $ticks)
int unstoccato (int $ticks)
int wholeNote ()
Variables
int $timeDivision (line 29)

The number of ticks per quarter note

  • access: protected
array $triplets (line 36)

Storage for triplet division calculations

  • access: protected
Methods
Constructor __construct (line 47)

Constructor

  • throws: InvalidArgumentException
  • throws: DomainException
  • since: 1.0
  • access: public
Timer __construct (int $timeDivision)
  • int $timeDivision: The number of ticks per quarter note
dot (line 175)

Dot-izes the number of ticks

  • since: 1.0
  • access: public
int dot (int $ticks)
  • int $ticks
eighthNote (line 127)

Gets the number of ticks needed for an eighth note

int eighthNote ()
getTicksForNoteDivision (line 79)

Gets the number of ticks needed for the specified note division

int getTicksForNoteDivision (int $division)
  • int $division: The note division
getTimeDivision (line 66)

Gets the time division

  • since: 1.0
  • access: public
int getTimeDivision ()
halfNote (line 151)

Gets the number of ticks needed for a half note

int halfNote ()
quarterNote (line 139)

Gets the number of ticks needed for a quarter note

int quarterNote ()
resolveTriplet (line 226)

Resolves rounding errors when calculating triplets

For example, when calculating the number of ticks for a triplet that should be 100 ticks long, the default division will be 33, 33 and 33 for each note of the triplet. That can mess up your calculations later on since the division is one tick short of what it should be. This method will solve those rounding errors by returning the remainder for the third note of the triplet, e.g. 33, 33 and 34 for a total tick count of 100.

This function should not be used directly unless you're trying to calculate a triplet rest. Use triplet() for actual triplets of notes.

int resolveTriplet (int $ticks)
  • int $ticks
sixteenthNote (line 115)

Gets the number of ticks needed for a sixteenth note

int sixteenthNote ()
sixtyFourthNote (line 91)

Gets the number of ticks needed for a 64th note

int sixtyFourthNote ()
stoccato (line 244)

Stoccato-izes the number of ticks

  • since: 1.0
  • access: public
int stoccato (int $ticks)
  • int $ticks
thirtySecondNote (line 103)

Gets the number of ticks needed for a 32nd note

int thirtySecondNote ()
triplet (line 188)

Triplet-izes the number of ticks

int triplet (int $ticks)
  • int $ticks
unstoccato (line 256)

un-Stoccato-izes the number of ticks

  • since: 1.0
  • access: public
int unstoccato (int $ticks)
  • int $ticks
wholeNote (line 163)

Gets the number of ticks needed for a whole note

int wholeNote ()

Documentation generated on Sun, 25 Oct 2009 22:38:21 -0700 by phpDocumentor 1.4.3