TimeUnit

TimeUnit()

Units of measurement for coordinates.

Organized by domain. Each unit belongs to a specific domain. Aliases are provided for common abbreviations.

Attributes

Name Description
allowed_number_types The numeric representations this unit accepts.
b beats
beats beats
centimeters centimeters
cm centimeters
default_number_type The numeric representation this unit uses unless told otherwise.
divs ticks (MIDI’s time unit)
domain Return the domain this unit belongs to.
floating_measures measures
fm measures
frames frames
inches inches
is_discrete Whether this unit is inherently discrete (integer-valued).
meters meters
millimeters millimeters
milliseconds milliseconds
minutes minutes
mm millimeters
ms milliseconds
pixels pixels
points points
pt points
pulses ticks (MIDI’s time unit)
px pixels
q quarter notes
quarters quarter notes
s seconds
samples samples
seconds seconds
ticks ticks (MIDI’s time unit)

Methods

Name Description
resolve_number_type Return the numeric representation to use for this unit.

resolve_number_type

TimeUnit.resolve_number_type(requested=None)

Return the numeric representation to use for this unit.

Parameters

Name Type Description Default
requested NumberType | str | None An explicit choice, or None to take :attr:default_number_type. None

Returns

Name Type Description
NumberType The resolved :class:NumberType.

Raises

Name Type Description
ValueError If requested is not among :attr:allowed_number_types.