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() Also be aware you might shadow existing variable names, like f.

Defines intensity constants using standard dynamic symbols.

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::Intensities::f) or via mixin (include MTK::Lang::Intensities; f). They are listed under the “Instance Attribute Summary” of this page.

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).

Constant Summary collapse

INTENSITIES =

All “psuedo constants” defined in this module

[ppp, pp, p, mp, mf, f, 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

#fMTK::Core::Interval (readonly)

forte: 75% intensity

Returns:



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

define_intensity 'f', MTK::Core::Intensity[0.75], 'forte', 75

#ffMTK::Core::Interval (readonly)

fortissimo: 87.5% intensity

Returns:



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

define_intensity 'ff', MTK::Core::Intensity[0.875], 'fortissimo', '87.5'

#fffMTK::Core::Interval (readonly)

fortississimo: 100% intensity

Returns:



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

define_intensity 'fff', MTK::Core::Intensity[1.0], 'fortississimo', 100

#mfMTK::Core::Interval (readonly)

mezzo-forte: 62.5% intensity

Returns:



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

define_intensity 'mf', MTK::Core::Intensity[0.625], 'mezzo-forte', '62.5'

#mpMTK::Core::Interval (readonly)

mezzo-piano: 50% intensity

Returns:



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

define_intensity 'mp', MTK::Core::Intensity[0.5], 'mezzo-piano', 50

#pMTK::Core::Interval (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: 37.5% intensity

Returns:



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

define_intensity 'p', MTK::Core::Intensity[0.375], 'piano', '37.5'

#ppMTK::Core::Interval (readonly)

pianissimo: 25% intensity

Returns:



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

define_intensity 'pp', MTK::Core::Intensity[0.25], 'pianissimo', 25

#pppMTK::Core::Interval (readonly)

pianississimo: 12.5% intensity

Returns:



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

define_intensity 'ppp', MTK::Core::Intensity[0.125], 'pianississimo', '12.5'