FoscMeter

Returns a FoscMeter.


Description

FoscMeter

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.


Attributes Summary

Class Methods

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

Instance Properties

decreaseDurationsMonotonically Is true when meter divides large primes into collections of 2 and 3 that decrease monotonically. Otherwise false.
denominator Gets denominator of meter.
depthwiseOffsetInventory Gets depthwise offset inventory of meter.
duration Gets duration of meter.
impliedTimeSignature Gets implied time signature of meter.
isCompound Is true when meter is compound.
isSimple Is true when meter is simple. Otherwise false.
numerator Gets numerator of meter.
pair Gets numerator and denominator pair.
preferredBoundaryDepth Gets preferred boundary depth of meter. Used by rewriteMeter method.
rootNode Gets root node of meter.

Instance Methods: Special Methods

== Is true when argument is a meter with an rtm format equal to that of this meter. Otherwise false.
format Formats meter.
hash Hashes meter.
inspect
iter Iterates meter.
str !!!TODO: make identical to abjad.

Instance Methods

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


Usage

  1. Example

    FoscMeter(FoscTimeSignature([5, 4])).inspect;
    FoscMeter.new
  2. Example

    FoscMeter(FoscDuration(5, 4)).inspect;
    FoscMeter.new
  3. Example

    FoscMeter(FoscFraction(5, 4)).inspect;
    FoscMeter.new
  4. Example

    FoscMeter([5, 4]).inspect;
    FoscMeter.new
  5. Example

    FoscMeter(FoscRhythm([5, 4], [2, 3])).inspect;
    FoscMeter.new
  6. Example

    FoscMeter(FoscRhythm([5, 4], [1, [7, [3, 2, 2]], 2])).inspect;
    FoscMeter.new
  7. Example

    FoscMeter([5, 4], increaseMonotonic: true).inspect;
    FoscMeter.new
  8. Example

    a = FoscMeter([5,4]);
    a.inspect;
    FoscMeter.new
    a.increaseMonotonic;
    false
    a.denominator;
    4
    a.numerator;
    5
    a.preferredBoundaryDepth.isNil;
    true
    a.rootNode;
    FoscRhythm.new


Class Methods


fitMeters

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

Coerces offsets from argument via MetricAccentKernel.count_offsets().

Coerces Meters from meters via MeterList.

Returns array.


Instance Properties


decreaseDurationsMonotonically

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

  1. Example

    FoscMeter([7, 8], decreaseDurationsMonotonically: true).inspect;
    FoscMeter([7, 8], decreaseDurationsMonotonically: false).inspect;
    FoscMeter.new


denominator

Gets denominator of meter.

  1. Example

    FoscMeter([7, 8]).denominator;
    8


depthwiseOffsetInventory

Gets depthwise offset inventory of meter.

Returns array.

  1. Example

    a = FoscMeter([7, 4]);
    a.depthwiseOffsetInventory.do { |offsets, i|
        Post << i << nl;
        offsets.do { |each| Post.space << each.pair << nl };
    };


duration

Gets duration of meter.

  1. Example

    m = FoscMeter([7, 4]);
    m.duration.inspect;
    ObjectInspector.new


impliedTimeSignature

Gets implied time signature of meter.

  1. Example

    m = FoscMeter([4, 4]);
    m.impliedTimeSignature.inspect;
    FoscTimeSignature.new


isCompound

Is true when meter is compound.

Compound meters are defined as those equal with a numerator divisible by 3 but not equal 3.

  1. Example

    FoscMeter([3, 4]).isCompound;
    false
    FoscMeter([4, 8]).isCompound;
    false
    FoscMeter([6, 8]).isCompound;
    true
    FoscMeter([15, 32]).isCompound;
    true


isSimple

Is true when meter is simple. Otherwise false.

Simple meters are defined as those equal with a numerator not divisible by 3.

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

  1. Example

    FoscMeter([3, 4]).isSimple;
    true
    FoscMeter([4, 8]).isSimple;
    true
    FoscMeter([6, 8]).isSimple;
    false
    FoscMeter([15, 32]).isSimple;
    false


numerator

Gets numerator of meter.

Returns positive integer.

  1. Example

    m = FoscMeter([7, 4]);
    m.numerator;
    7


pair

Gets numerator and denominator pair.

  1. Example

    FoscMeter([7, 8]).pair;
    [ 7, 8 ]


preferredBoundaryDepth

Gets preferred boundary depth of meter. Used by rewriteMeter method.

Returns integer or nil.

  1. Example

    m = FoscMeter([4, 4]);
    m.preferredBoundaryDepth;
  2. Example

    m = FoscMeter([4, 4], preferredBoundaryDepth: 2);
    m.preferredBoundaryDepth;
    2


rootNode

Gets root node of meter.

Returns rhythm tree node.

  1. Example

    m = FoscMeter([7, 4]);
    m.rootNode;
    FoscRhythm.new


Instance Methods: Special Methods


==

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

Returns true or false.


format

Formats meter.

Returns string.

  1. Gets storage format of 7/4:

    a = FoscMeter(#[7,4]);
    a.format;
    7/4


hash

Hashes meter.

Returns integer.


inspect

  1. Example

    a = FoscMeter(#[7,4]);
    a.inspect;
    FoscMeter.new
  2. Example

    a = FoscMeter(#[7,4], increaseMonotonic: true);
    a.inspect;
    FoscMeter.new


iter

Iterates meter.

Yields pairs.


str

!!!TODO: make identical to abjad.

Gets string representation of meter.

Returns string.

  1. Example

    FoscMeter([7, 4]).str;
    7/4


Instance Methods


generateOffsetKernelToDenominator

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.

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

Returns dictionary.