# meter¶

Tools for modeling musical meter.

Classes

 `Meter` Meter. `MeterList` Meter list. `MetricAccentKernel` Metric accent kernel. `OffsetCounter` Offset counter.
class `abjad.meter.``Meter`(argument=None, decrease_monotonic=True, preferred_boundary_depth=None)

Meter.

Meter models a common practice understanding of beats and other levels of rhythmic organization structured as a tree. Meter structure corresponds to the monotonically increasing sequence of factors in the numerator of a given time signature. Successively deeper levels of the tree divide time by successive factors.

Duple meter:

```>>> meter = abjad.Meter((2, 4))
>>> meter
Meter('(2/4 (1/4 1/4))')
```
```>>> print(meter.pretty_rtm_format)
(2/4 (
1/4
1/4))
```
```>>> graph(meter)
```

2/4 comprises two beats.

Triple meter:

```>>> meter = abjad.Meter((3, 4))
>>> print(meter.pretty_rtm_format)
(3/4 (
1/4
1/4
1/4))
```
```>>> graph(meter)
```

3/4 comprises three beats.

```>>> meter = abjad.Meter((4, 4))
>>> meter
Meter('(4/4 (1/4 1/4 1/4 1/4))')
```
```>>> print(meter.pretty_rtm_format)
(4/4 (
1/4
1/4
1/4
1/4))
```
```>>> graph(meter)
```

4/4 comprises four beats.

Compound triple meter:

```>>> meter = abjad.Meter((6, 8))
>>> print(meter.pretty_rtm_format)
(6/8 (
(3/8 (
1/8
1/8
1/8))
(3/8 (
1/8
1/8
1/8))))
```
```>>> graph(meter)
```

6/8 comprises two beats of three parts each.

Another compound triple meter:

```>>> meter = abjad.Meter((12, 8))
>>> print(meter.pretty_rtm_format)
(12/8 (
(3/8 (
1/8
1/8
1/8))
(3/8 (
1/8
1/8
1/8))
(3/8 (
1/8
1/8
1/8))
(3/8 (
1/8
1/8
1/8))))
```
```>>> graph(meter)
```

12/8 comprises four beats of three parts each.

An asymmetric meter:

```>>> meter = abjad.Meter((5, 4))
>>> print(meter.pretty_rtm_format)
(5/4 (
(3/4 (
1/4
1/4
1/4))
(2/4 (
1/4
1/4))))
```
```>>> graph(meter)
```

5/4 comprises two unequal beats. By default unequal beats are arranged from greatest to least.

Another asymmetric meter:

```>>> meter = abjad.Meter((7, 4))
>>> print(meter.pretty_rtm_format)
(7/4 (
(3/4 (
1/4
1/4
1/4))
(2/4 (
1/4
1/4))
(2/4 (
1/4
1/4))))
```
```>>> graph(meter)
```

7/4 comprises three unequal beats. Beats are arranged from greatest to least by default.

The same asymmetric meter structured differently:

```>>> meter = abjad.Meter(
...     (7, 4),
...     decrease_monotonic=False,
...     )
>>> print(meter.pretty_rtm_format)
(7/4 (
(2/4 (
1/4
1/4))
(2/4 (
1/4
1/4))
(3/4 (
1/4
1/4
1/4))))
```
```>>> graph(meter)
```

7/4 with beats arragned from least to greatest.

Meter interpreted by default as containing two compound beats:

```>>> meter = abjad.Meter((6, 4))
>>> meter
Meter('(6/4 ((3/4 (1/4 1/4 1/4)) (3/4 (1/4 1/4 1/4))))')
```
```>>> print(meter.pretty_rtm_format)
(6/4 (
(3/4 (
1/4
1/4
1/4))
(3/4 (
1/4
1/4
1/4))))
```
```>>> graph(meter)
```

Same meter customized to contain four compound beats:

```>>> parser = abjad.rhythmtrees.RhythmTreeParser()
>>> meter = abjad.Meter('(6/4 ((3/8 (1/8 1/8 1/8)) (3/8 (1/8 1/8 1/8)) (3/8 (1/8 1/8 1/8)) (3/8 (1/8 1/8 1/8))))')
>>> meter
Meter('(6/4 ((3/8 (1/8 1/8 1/8)) (3/8 (1/8 1/8 1/8)) (3/8 (1/8 1/8 1/8)) (3/8 (1/8 1/8 1/8))))')
```
```>>> print(meter.pretty_rtm_format)
(6/4 (
(3/8 (
1/8
1/8
1/8))
(3/8 (
1/8
1/8
1/8))
(3/8 (
1/8
1/8
1/8))
(3/8 (
1/8
1/8
1/8))))
```
```>>> graph(meter)
```

Prime divisions greater than `3` are converted to sequences of `2` and `3` summing to that prime. Summands are arranged from greatest to least by default. This means that `5` becomes `3+2` and `7` becomes `3+2+2` in the examples above.

Attributes Summary

 `__eq__` Is true when `argument` is a meter with an rtm format equal to that of this meter. `__format__` Formats meter. `__graph__` Gets Graphviz format of meter. `__hash__` Hashes meter. `__iter__` Iterates meter. `__str__` Gets string representation of meter. `decrease_monotonic` Is true when meter divides large primes into collections of `2` and `3` that decrease monotonically. `denominator` Gets denominator of meter. `depthwise_offset_inventory` Gets depthwise offset inventory of meter. `duration` Gets duration of meter. `fit_meters` Finds the best-matching sequence of meters for the offsets contained in `argument`. `generate_offset_kernel_to_denominator` Generates a dictionary of all offsets in a meter up to `denominator`. `implied_time_signature` Gets implied time signature of meter. `is_compound` Is true when meter is compound. `is_simple` Is true when meter is simple. `numerator` Gets numerator of meter. `pair` Gets pair of numerator and denominator of meter. `preferred_boundary_depth` Gets preferred boundary depth of meter. `pretty_rtm_format` Gets pretty RTM format of meter. `root_node` Gets root node of meter. `rtm_format` Gets RTM format of meter.

Special methods

`(AbjadValueObject).``__copy__`(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

`__eq__`(argument)

Is true when `argument` is a meter with an rtm format equal to that of this meter.

Returns true or false.

`__format__`(format_specification='')

Formats meter.

Gets storage format of `7/4`:

```>>> meter = abjad.Meter((7, 4))
>>> print(format(meter))
'(7/4 ((3/4 (1/4 1/4 1/4)) (2/4 (1/4 1/4)) (2/4 (1/4 1/4))))'
)
```

Returns string.

`__graph__`(**keywords)

Gets Graphviz format of meter.

Graphs `7/4`:

```>>> meter = abjad.Meter((7, 4))
>>> meter_graph = meter.__graph__()
>>> graph(meter_graph)
```

Returns Graphviz graph.

`__hash__`()

Hashes meter.

Returns integer.

`__iter__`()

Iterates meter.

Iterates `5/4`:

```>>> meter = abjad.Meter((5, 4))
>>> for x in meter:
...    x
...
(NonreducedFraction(0, 4), NonreducedFraction(1, 4))
(NonreducedFraction(1, 4), NonreducedFraction(2, 4))
(NonreducedFraction(2, 4), NonreducedFraction(3, 4))
(NonreducedFraction(0, 4), NonreducedFraction(3, 4))
(NonreducedFraction(3, 4), NonreducedFraction(4, 4))
(NonreducedFraction(4, 4), NonreducedFraction(5, 4))
(NonreducedFraction(3, 4), NonreducedFraction(5, 4))
(NonreducedFraction(0, 4), NonreducedFraction(5, 4))
```

Yields pairs.

`(AbjadObject).``__repr__`()

Gets interpreter representation of Abjad object.

Returns string.

`__str__`()

Gets string representation of meter.

Gets string representation of meters over `8`:

```>>> for numerator in range(1, 9):
...     meter = abjad.Meter((numerator, 8))
...     print(str(meter))
...
1/8
2/8
3/8
4/8
5/8
6/8
7/8
8/8
```

Returns string.

Methods

`generate_offset_kernel_to_denominator`(denominator, normalize=True)

Generates a dictionary of all offsets in a meter up to `denominator`.

Keys are the offsets and the values are the normalized weights of those offsets.

```>>> meter = abjad.Meter((4, 4))
>>> kernel = meter.generate_offset_kernel_to_denominator(8)
>>> for offset, weight in sorted(kernel.kernel.items()):
...     print('{!s}\t{!s}'.format(offset, weight))
...
0	3/16
1/8	1/16
1/4	1/8
3/8	1/16
1/2	1/8
5/8	1/16
3/4	1/8
7/8	1/16
1	3/16
```

This is useful for testing how strongly a collection of offsets responds to a given meter.

Returns dictionary.

Class & static methods

static `fit_meters`(argument, meters, denominator=32, discard_final_orphan_downbeat=True, maximum_run_length=None, starting_offset=None)

Finds the best-matching sequence of meters for the offsets contained in `argument`.

```>>> meters = [(3, 4), (4, 4), (5, 4)]
>>> meters = [abjad.Meter(_) for _ in meters]
```

Matches a series of hypothetical `4/4` measures:

```>>> argument = [(0, 4), (4, 4), (8, 4), (12, 4), (16, 4)]
>>> for x in abjad.Meter.fit_meters(
...     argument, meters):
...     print(x.implied_time_signature)
...
4/4
4/4
4/4
4/4
```

Matches a series of hypothetical `5/4` measures:

```>>> argument = [(0, 4), (3, 4), (5, 4), (10, 4), (15, 4), (20, 4)]
>>> for x in abjad.Meter.fit_meters(
...     argument, meters):
...     print(x.implied_time_signature)
...
3/4
4/4
3/4
5/4
5/4
```

Coerces offsets from `argument` via `MetricAccentKernel.count_offsets()`.

Coerces Meters from `meters` via `MeterList`.

Returns list.

`decrease_monotonic`

Is true when meter divides large primes into collections of `2` and `3` that decrease monotonically.

An asymmetric meter with beats arranged greatest to least:

```>>> meter = abjad.Meter(
...     (7, 4),
...     decrease_monotonic=True,
...     )
```
```>>> meter.decrease_monotonic
True
```
```>>> print(meter.pretty_rtm_format)
(7/4 (
(3/4 (
1/4
1/4
1/4))
(2/4 (
1/4
1/4))
(2/4 (
1/4
1/4))))
```

This is default beahvior.

The same asymmetric meter with unequal beats arranged least to greatest:

```>>> meter = abjad.Meter(
...     (7, 4),
...     decrease_monotonic=False,
...     )
```
```>>> meter.decrease_monotonic
False
```
```>>> print(meter.pretty_rtm_format)
(7/4 (
(2/4 (
1/4
1/4))
(2/4 (
1/4
1/4))
(3/4 (
1/4
1/4
1/4))))
```

Returns true or false.

`denominator`

Gets denominator of meter.

```>>> meter = abjad.Meter((7, 4))
>>> meter.denominator
4
```

Returns positive integer.

`depthwise_offset_inventory`

Gets depthwise offset inventory of meter.

```>>> meter = abjad.Meter((7, 4))
>>> for depth, offsets in enumerate(
...     meter.depthwise_offset_inventory):
...     print(depth, offsets)
...
0 (Offset(0, 1), Offset(7, 4))
1 (Offset(0, 1), Offset(3, 4), Offset(5, 4), Offset(7, 4))
2 (Offset(0, 1), Offset(1, 4), Offset(1, 2), Offset(3, 4), Offset(1, 1), Offset(5, 4), Offset(3, 2), Offset(7, 4))
```

Returns dictionary.

`duration`

Gets duration of meter.

```>>> meter = abjad.Meter((7, 4))
>>> meter.duration
Duration(7, 4)
```

Returns duration.

`implied_time_signature`

Gets implied time signature of meter.

```>>> abjad.Meter((4, 4)).implied_time_signature
TimeSignature((4, 4))
```

Returns time signature.

`is_compound`

Is true when meter is compound.

Compound meters written over `4`:

```>>> for numerator in range(1, 13):
...     meter = abjad.Meter((numerator, 4))
...     string = True if meter.is_compound else ''
...     print(str(meter), string)
...
1/4
2/4
3/4
4/4
5/4
6/4 True
7/4
8/4
9/4 True
10/4
11/4
12/4 True
```

Compound meters written over `8`:

```>>> for numerator in range(1, 13):
...     meter = abjad.Meter((numerator, 8))
...     string = True if meter.is_compound else ''
...     print(str(meter), string)
...
1/8
2/8
3/8
4/8
5/8
6/8 True
7/8
8/8
9/8 True
10/8
11/8
12/8 True
```

Compound meters defined equal to those meters with a numerator divisible by `3` (but not equal to `3`).

Returns true or false.

`is_simple`

Is true when meter is simple.

Simple meters written over `4`:

```>>> for numerator in range(1, 13):
...     meter = abjad.Meter((numerator, 4))
...     string = True if meter.is_simple else ''
...     print(str(meter), string)
...
1/4 True
2/4 True
3/4 True
4/4 True
5/4 True
6/4
7/4 True
8/4 True
9/4
10/4 True
11/4 True
12/4
```

Simple meters written over `8`:

```>>> for numerator in range(1, 13):
...     meter = abjad.Meter((numerator, 8))
...     string = True if meter.is_simple else ''
...     print(str(meter), string)
...
1/8 True
2/8 True
3/8 True
4/8 True
5/8 True
6/8
7/8 True
8/8 True
9/8
10/8 True
11/8 True
12/8
```

Simple meters defined equal to those meters with a numerator not divisible by `3`.

Meters with numerator equal to `3` are also defined as simple.

Returns true or false.

`numerator`

Gets numerator of meter.

```>>> meter = abjad.Meter((7, 4))
>>> meter.numerator
7
```

Returns positive integer.

`pair`

Gets pair of numerator and denominator of meter.

```>>> meter = abjad.Meter((6, 4))
>>> meter.pair
(6, 4)
```

Returns pair.

`preferred_boundary_depth`

Gets preferred boundary depth of meter.

No preferred boundary depth:

```>>> abjad.Meter((6, 8)).preferred_boundary_depth is None
True
```

Customized preferred boundary depth:

```>>> meter = abjad.Meter(
...     (6, 8),
...     preferred_boundary_depth=1,
...     )
>>> meter.preferred_boundary_depth
1
```

Used by `mutate().rewrite_meter()`.

Defaults to none.

Set to integer or none.

Returns integer or none.

`pretty_rtm_format`

Gets pretty RTM format of meter.

```>>> meter = abjad.Meter((7, 4))
>>> print(meter.pretty_rtm_format)
(7/4 (
(3/4 (
1/4
1/4
1/4))
(2/4 (
1/4
1/4))
(2/4 (
1/4
1/4))))
```

Returns string.

`root_node`

Gets root node of meter.

```>>> meter = abjad.Meter((7, 4))
>>> print(format(meter.root_node))
children=(
children=(
is_pitched=True,
),
is_pitched=True,
),
is_pitched=True,
),
),
),
children=(
is_pitched=True,
),
is_pitched=True,
),
),
),
children=(
is_pitched=True,
),
is_pitched=True,
),
),
),
),
)
```

Returns rhythm tree node.

`rtm_format`

Gets RTM format of meter.

```>>> meter = abjad.Meter((7, 4))
>>> meter.rtm_format
'(7/4 ((3/4 (1/4 1/4 1/4)) (2/4 (1/4 1/4)) (2/4 (1/4 1/4))))'
```

Returns string.

class `abjad.meter.``MeterList`(items=None, item_class=None, keep_sorted=False)

Meter list.

```>>> meters = abjad.MeterList([
...     (3, 4), (5, 16), (7, 8),
...     ])
```
```>>> abjad.f(meters)
[
'(3/4 (1/4 1/4 1/4))'
),
'(5/16 ((3/16 (1/16 1/16 1/16)) (2/16 (1/16 1/16))))'
),
'(7/8 ((3/8 (1/8 1/8 1/8)) (2/8 (1/8 1/8)) (2/8 (1/8 1/8))))'
),
]
)
```
```>>> abjad.show(meters, scale=0.5)
```

Attributes Summary

 `__illustrate__` Illustrates meters.

Special methods

`(TypedCollection).``__contains__`(item)

Is true when typed collection contains `item`.

Returns true or false.

`(TypedList).``__delitem__`(i)

Aliases list.__delitem__().

Returns none.

`(TypedCollection).``__eq__`(argument)

Is true when `argument` is a typed collection with items that compare equal to those of this typed collection.

Returns true or false.

`(AbjadObject).``__format__`(format_specification='')

Set `format_specification` to `''` or `'storage'`. Interprets `''` equal to `'storage'`.

Returns string.

`(TypedList).``__getitem__`(argument)

Gets item or slice identified by `argument`.

Returns item or slice.

`(TypedCollection).``__hash__`()

Hashes typed collection.

Redefined in tandem with __eq__.

`(TypedList).``__iadd__`(argument)

Adds `argument` in place to typed list.

```>>> dynamic_list = abjad.TypedList(item_class=abjad.Dynamic)
>>> dynamic_list.append('ppp')
>>> dynamic_list += ['p', 'mp', 'mf', 'fff']
```
```>>> abjad.f(dynamic_list)
[
],
)
```

Returns typed list.

`__illustrate__`(denominator=16, range_=None, scale=None)

Illustrates meters.

```>>> meters = abjad.MeterList([
...     (3, 4), (5, 16), (7, 8),
...     ])
```

Returns LilyPond file.

`(TypedCollection).``__iter__`()

Iterates typed collection.

Returns generator.

`(TypedCollection).``__len__`()

Gets length of typed collection.

Returns nonnegative integer.

`(AbjadObject).``__repr__`()

Gets interpreter representation of Abjad object.

Returns string.

`(TypedList).``__reversed__`()

Aliases list.__reversed__().

Returns generator.

`(TypedList).``__setitem__`(i, argument)

Sets item `i` equal to `argument`.

Sets item:

```>>> pitch_list = abjad.TypedList(
...     )
>>> pitch_list.append(0)
>>> pitch_list.append("d'")
>>> pitch_list.append(('e', 4))
```
```>>> pitch_list[-1] = 'gqs,'
[
],
)
```

Sets slice:

```>>> pitch_list[-1:] = ["f'", "g'", "a'", "b'", "c''"]
[
],
)
```

Returns none.

Methods

`(TypedList).``append`(item)

Appends `item` to typed list.

```>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.append('1')
>>> integer_list.append(2)
>>> integer_list.append(3.4)
>>> integer_list[:]
[1, 2, 3]
```

Returns none.

`(MutableSequence).``clear`() → None -- remove all items from S
`(TypedList).``count`(item)

Gets count of `item` in typed list.

```>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.extend([0, 0., '0', 99])
```
```>>> integer_list.count(0)
3
```
```>>> integer_list.count(1)
0
```
```>>> integer_list.count(99)
1
```

Returns nonnegative integer.

`(TypedList).``extend`(items)

Extends typed list with `items`.

```>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.extend(['0', 1.0, 2, 3.14159])
>>> integer_list
TypedList([0, 1, 2, 3], item_class=int)
```

Returns none.

`(TypedList).``index`(item)

Gets index of `item` in typed list.

```>>> pitch_list = abjad.TypedList(
...     )
>>> pitch_list.extend(['cqf', "as'", 'b,', 'dss'])
```
```>>> pitch_list.index(abjad.NamedPitch('cqf'))
0
```
```>>> pitch_list.index(abjad.NamedPitch("as'"))
1
```
```>>> pitch_list.index('b,')
2
```
```>>> pitch_list.index('dss')
3
```

Returns nonnegative integer.

`(TypedList).``insert`(i, item)

Insert `item` into typed list.

Inserts into typed list.

```>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.extend(['1', 2, 4.3])
>>> integer_list
TypedList([1, 2, 4], item_class=int)
```
```>>> integer_list.insert(0, '0')
>>> integer_list
TypedList([0, 1, 2, 4], item_class=int)
```
```>>> integer_list.insert(1, '9')
>>> integer_list
TypedList([0, 9, 1, 2, 4], item_class=int)
```

Returns none.

`(TypedList).``pop`(i=-1)

Pops item `i` from typed list.

Returns item.

`(TypedList).``remove`(item)

Removes `item` from typed list.

```>>> integer_list = abjad.TypedList(item_class=int)
>>> integer_list.extend(('0', 1.0, 2, 3.14159))
>>> integer_list[:]
[0, 1, 2, 3]
```
```>>> integer_list.remove('1')
>>> integer_list[:]
[0, 2, 3]
```

Returns none.

`(TypedList).``reverse`()

Reverses items in typed list.

`(TypedList).``sort`(cmp=None, key=None, reverse=False)

Sorts items in typed list.

`(TypedList).``keep_sorted`

Is true when typed list keeps items sorted.

Defaults to none.

Set to true, false or none.

Returns true, false or none.

`(TypedCollection).``item_class`

Gets item class of collection.

Collection coerces items according to `item_class`.

Returns class.

`(TypedCollection).``items`

Gets items in collection.

Returns list.

class `abjad.meter.``MetricAccentKernel`(kernel=None)

Metric accent kernel.

```>>> hierarchy = abjad.Meter((7, 8))
>>> kernel = hierarchy.generate_offset_kernel_to_denominator(8)
>>> kernel
MetricAccentKernel(
{
Offset(0, 1): Multiplier(3, 14),
Offset(1, 8): Multiplier(1, 14),
Offset(1, 4): Multiplier(1, 14),
Offset(3, 8): Multiplier(1, 7),
Offset(1, 2): Multiplier(1, 14),
Offset(5, 8): Multiplier(1, 7),
Offset(3, 4): Multiplier(1, 14),
Offset(7, 8): Multiplier(3, 14),
}
)
```

Call the kernel against an expression from which offsets can be counted to receive an impulse-response:

```>>> offsets = [(0, 8), (1, 8), (1, 8), (3, 8)]
>>> kernel(offsets)
Multiplier(1, 2)
```

Attributes Summary

 `__call__` Calls metrical accent kernal on `argument`. `__eq__` Is true when `argument` is a metrical accent kernal with a kernal equal to that of this metrical accent kernel. `__hash__` Hashes metric accent kernel. `count_offsets` Count offsets in `argument`. `duration` Gets duration. `from_meter` Create a metric accent kernel from `meter`. `kernel` The kernel datastructure.

Special methods

`__call__`(argument)

Calls metrical accent kernal on `argument`.

```>>> upper_staff = abjad.Staff("c'8 d'4. e'8 f'4.")
>>> lower_staff = abjad.Staff(r'\clef bass c4 b,4 a,2')
>>> score = abjad.Score([upper_staff, lower_staff])
```
```>>> kernel = abjad.MetricAccentKernel.from_meter((4, 4))
>>> kernel(score)
Multiplier(10, 33)
```

Returns float.

`(AbjadValueObject).``__copy__`(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

`__eq__`(argument)

Is true when `argument` is a metrical accent kernal with a kernal equal to that of this metrical accent kernel.

Returns true or false.

`(AbjadObject).``__format__`(format_specification='')

Set `format_specification` to `''` or `'storage'`. Interprets `''` equal to `'storage'`.

Returns string.

`__hash__`()

Hashes metric accent kernel.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

`(AbjadObject).``__repr__`()

Gets interpreter representation of Abjad object.

Returns string.

Class & static methods

static `count_offsets`(argument)

Count offsets in `argument`.

```>>> upper_staff = abjad.Staff("c'8 d'4. e'8 f'4.")
>>> lower_staff = abjad.Staff(r'\clef bass c4 b,4 a,2')
>>> score = abjad.Score([upper_staff, lower_staff])
```
```>>> abjad.show(score)
```
```>>> MetricAccentKernel = abjad.MetricAccentKernel
>>> leaves = abjad.select(score).leaves()
>>> counter = abjad.MetricAccentKernel.count_offsets(leaves)
>>> for offset, count in sorted(counter.items()):
...     offset, count
...
(Offset(0, 1), 2)
(Offset(1, 8), 2)
(Offset(1, 4), 2)
(Offset(1, 2), 4)
(Offset(5, 8), 2)
(Offset(1, 1), 2)
```
```>>> a = abjad.Timespan(0, 10)
>>> b = abjad.Timespan(5, 15)
>>> c = abjad.Timespan(15, 20)
```
```>>> counter = MetricAccentKernel.count_offsets((a, b, c))
>>> for offset, count in sorted(counter.items()):
...     offset, count
...
(Offset(0, 1), 1)
(Offset(5, 1), 1)
(Offset(10, 1), 1)
(Offset(15, 1), 2)
(Offset(20, 1), 1)
```

Returns counter.

static `from_meter`(meter, denominator=32, normalize=True)

Create a metric accent kernel from `meter`.

Returns new metric accent kernel.

`duration`

Gets duration.

`kernel`

The kernel datastructure.

Returns dict.

class `abjad.meter.``OffsetCounter`(items=None)

Offset counter.

```>>> timespans = abjad.TimespanList([
...     ])
>>> timespan_operand = abjad.Timespan(6, 10)
>>> timespans = timespans - timespan_operand
>>> offset_counter = abjad.OffsetCounter(timespans)
```
```>>> abjad.f(offset_counter)
{
}
)
```
```>>> abjad.show(offset_counter, scale=0.5)
```

Attributes Summary

 `__illustrate__` Illustrates offset counter.

Special methods

`(TypedCounter).``__add__`(argument)

Adds typed counter to `argument`.

Returns new typed counter.

`(TypedCounter).``__and__`(argument)

Logical AND of typed counter and `argument`.

Returns new typed counter.

`(TypedCollection).``__contains__`(item)

Is true when typed collection contains `item`.

Returns true or false.

`(TypedCounter).``__delitem__`(item)

Deletes `item` from typed counter.

Returns none.

`(TypedCollection).``__eq__`(argument)

Is true when `argument` is a typed collection with items that compare equal to those of this typed collection.

Returns true or false.

`(AbjadObject).``__format__`(format_specification='')

Set `format_specification` to `''` or `'storage'`. Interprets `''` equal to `'storage'`.

Returns string.

`(TypedCounter).``__getitem__`(argument)

Gets item or slice identified by `argument`.

Returns item or slice.

`(TypedCollection).``__hash__`()

Hashes typed collection.

Redefined in tandem with __eq__.

`__illustrate__`(range_=None, scale=None)

Illustrates offset counter.

```>>> timespans = abjad.TimespanList([
...     ])
>>> timespan_operand = abjad.Timespan(6, 10)
>>> timespans = timespans - timespan_operand
>>> offset_counter = abjad.OffsetCounter(timespans)
```

Returns LilyPond file.

`(TypedCollection).``__iter__`()

Iterates typed collection.

Returns generator.

`(TypedCollection).``__len__`()

Gets length of typed collection.

Returns nonnegative integer.

`(TypedCounter).``__or__`(argument)

Logical OR of typed counter and `argument`.

Returns new typed counter.

`(TypedCounter).``__radd__`(argument)

Adds `argument` to typed counter.

Returns new typed counter.

`(AbjadObject).``__repr__`()

Gets interpreter representation of Abjad object.

Returns string.

`(TypedCounter).``__setitem__`(item, value)

Sets typed counter `item` to `value`.

Returns none.

`(TypedCounter).``__sub__`(argument)

Subtracts `argument` from typed counter.

Returns new typed counter.

Methods

`(TypedCounter).``clear`()

Clears typed counter.

Returns none.

`(TypedCounter).``copy`()

Copies typed counter.

Returns new typed counter.

`(TypedCounter).``elements`()

Elements in typed counter.

`(Mapping).``get`(k[, d]) → D[k] if k in D, else d. d defaults to None.
`(TypedCounter).``items`()

Items in typed counter.

Returns tuple.

`(TypedCounter).``keys`()

Iterates keys in typed counter.

`(TypedCounter).``most_common`(n=None)

`(MutableMapping).``pop`(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

`(MutableMapping).``popitem`() → (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

`(MutableMapping).``setdefault`(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
`(TypedCounter).``subtract`(iterable=None, **keywords)

Subtracts `iterable` from typed counter.

`(TypedCounter).``update`(iterable=None, **keywords)

Updates typed counter with `iterable`.

`(TypedCounter).``values`()

Iterates values in typed counter.

`(TypedCounter).``viewitems`()

`(TypedCounter).``viewkeys`()

`(TypedCounter).``viewvalues`()

`(TypedCollection).``item_class`
Collection coerces items according to `item_class`.