module MTK::Lang::Durations

Defines duration constants using abbreviations for standard rhythm values (‘w’ for whole note, ‘h’ for half note, etc).

These can be thought of like constants, but in order to support the lower case names, it was necessary to define them as “pseudo constant” methods. Like constants, these methods are available either through the module (MTK::Lang::Durations::q) or via mixin (include MTK::Lang::Durations; q). They are listed under the “Instance Attribute Summary” of this page.

These values assume the quarter note is one beat, so you may find they work best with 4/4 and other */4 time signatures (although it’s certainly possible to use them with less common time signatures like 5/8).

@note Including this module defines a bunch of single-character variables, which may shadow existing variable names.

Just be mindful of what is defined in this module when including it.

@see Core::Duration @see Events::Note

Constants

DURATIONS

All “psuedo constants” defined in this module

DURATION_NAMES

The names of all “psuedo constants” defined in this module @see MTK::Core::Duration::NAMES

Public Class Methods

define_duration(name, value, description, beats) click to toggle source

@private @!macro [attach] define_duration

$3: $4 beat(s)
@!attribute [r]
@return [MTK::Core::Duration] duration of $4 beat(s)
# File lib/mtk/lang/durations.rb, line 29
def self.define_duration name, value, description, beats
  define_constant name, value
end