MUSX Document Model
|
A dependency-free, header-only collection of useful functions for music theory. More...
Classes | |
class | Transposer |
Provides dependency-free transposition utilities that work with any scale that has 7 diatonic steps and an equal number of divisions of the octave (EDO). The most common Western scales use 12 divisions of the octave, .i.e., 12-EDO. More... | |
Enumerations | |
enum class | DiatonicMode : int { Ionian = 0 , Dorian = 1 , Phrygian = 2 , Lydian = 3 , Mixolydian = 4 , Aeolian = 5 , Locrian = 6 } |
Represents the seven standard diatonic musical modes. More... | |
Functions | |
int | calcDisplacement (int pitchClass, int octave) |
Calculates the displacement value for a given absolute pitch class and octave. | |
template<typename T > | |
constexpr T | sign (T n) |
Calculates the sign of an integer. | |
template<typename T > | |
constexpr T | signedModulus (T n, T d) |
Calculates the modulus of positive and negative numbers in a predictable manner. | |
Variables | |
constexpr int | STANDARD_DIATONIC_STEPS = 7 |
currently this is the only supported number of diatonic steps. | |
constexpr int | STANDARD_12EDO_STEPS = 12 |
this can be overriden when constructing a Transposer instance. | |
A dependency-free, header-only collection of useful functions for music theory.
|
strong |
Represents the seven standard diatonic musical modes.
Values correspond to their roots with no sharps or flats C (0) through B (6).
Enumerator | |
---|---|
Ionian | major |
Dorian | minor with raised 6 |
Phrygian | minor with flat 2 |
Lydian | major with raised 4 |
Mixolydian | major with flat 7 |
Aeolian | natural minor |
Locrian | diminished with flat 2 and 5 |
|
inline |
Calculates the displacement value for a given absolute pitch class and octave.
pitchClass | 0..6 corresponding to C..B |
octave | Octave 4 is the middle-C octave |
|
inlineconstexpr |
Calculates the sign of an integer.
n | The integer to process. |
|
constexpr |
Calculates the modulus of positive and negative numbers in a predictable manner.
T | an integer type |
n | The number (positive or negative) for which to calculate the modulus |
d | The base of the modulus. This must be a positive number. |
%
. For negative numbers, the result is -1 * (abs(n) % d)
.