Module: MTK::Lang::Intensities

Extended by:
PseudoConstants
Defined in:
lib/mtk/lang/intensities.rb

Overview

Note:

Including this module shadows Ruby’s built-in p() method. If you include this module, you can access the built-in p() method via Kernel.p()

Defines intensity constants using standard dynamic symbols.

These can be thought of like constants, but in order to distinguish ‘f’ (forte) from the PitchClass ‘F’ it was necessary to use lower-case names and therefore define them as “pseudo constant” methods. The methods are available either through the module (MTK::Intensities::f) or via mixin (include MTK::Intensities; f)

These values are intensities in the range 0.125 - 1.0 (in increments of 1/8), so they can be easily scaled (unlike MIDI velocities).

It is also possible to retrieve values in increments of 1/24 by using the ‘+’ and ‘-’ suffix when looking up values via the [] method.

See Also:

  • Note

Constant Summary collapse

INTENSITIES =

The values of all “psuedo constants” defined in this module

[ppp, pp, p, mp, mf, o, ff, fff].freeze
INTENSITY_NAMES =

The names of all “psuedo constants” defined in this module

MTK::Core::Intensity::NAMES

Instance Attribute Summary collapse

Method Summary

Methods included from PseudoConstants

define_constant

Instance Attribute Details

#ffMTK::Core::Intensity[0.875] (readonly)

fortissimo

Returns:



48
# File 'lib/mtk/lang/intensities.rb', line 48

define_constant 'ff', MTK::Core::Intensity[0.875]

#fffMTK::Core::Intensity[1.0] (readonly)

fortississimo

Returns:



51
# File 'lib/mtk/lang/intensities.rb', line 51

define_constant 'fff', MTK::Core::Intensity[1.0]

#mfMTK::Core::Intensity[0.625] (readonly)

mezzo-forte

Returns:



42
# File 'lib/mtk/lang/intensities.rb', line 42

define_constant 'mf', MTK::Core::Intensity[0.625]

#mpMTK::Core::Intensity[0.5] (readonly)

mezzo-piano

Returns:



39
# File 'lib/mtk/lang/intensities.rb', line 39

define_constant 'mp', MTK::Core::Intensity[0.5]

#oMTK::Core::Intensity[0.75] (readonly)

forte

Returns:



45
# File 'lib/mtk/lang/intensities.rb', line 45

define_constant 'o', MTK::Core::Intensity[0.75]

#pMTK::Core::Intensity[0.375] (readonly)

Note:

Including this module shadows Ruby’s built-in p() method. If you include this module, you can access the built-in p() method via Kernel.p()

piano

Returns:



36
# File 'lib/mtk/lang/intensities.rb', line 36

define_constant 'p', MTK::Core::Intensity[0.375]

#ppMTK::Core::Intensity[0.25] (readonly)

pianissimo

Returns:



31
# File 'lib/mtk/lang/intensities.rb', line 31

define_constant 'pp', MTK::Core::Intensity[0.25]

#pppMTK::Core::Intensity[0.125] (readonly)

Returns intensity value for ppp.

Returns:



28
# File 'lib/mtk/lang/intensities.rb', line 28

define_constant 'ppp', MTK::Core::Intensity[0.125]