|
Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
|
Musical scale descriptor. More...
#include <src/dsp/musical_scale.h>


Data Structures | |
| struct | DiatonicTriad |
| A diatonic triad: the root note and chord type for a scale degree. More... | |
Public Types | |
| enum class | ScaleType : std::uint8_t { Chromatic , Major , Minor , Ionian , Dorian , Phrygian , Lydian , Mixolydian , Aeolian , Locrian , MelodicMinor , HarmonicMinor , WholeTone , MajorPentatonic , MinorPentatonic , OctatonicHalfWhole , OctatonicWholeHalf , Acoustic , HarmonicMajor , PhrygianDominant , MajorLocrian , Algerian , Augmented , DoubleHarmonic , Chinese , Diminished , DominantDiminished , Egyptian , EightToneSpanish , Enigmatic , Geez , Hindu , Hirajoshi , HungarianGypsy , Insen , NeapolitanMajor , NeapolitanMinor , Oriental , RomanianMinor , Altered , Maqam , Yo , BebopLocrian , BebopDominant , BebopMajor , SuperLocrian , EnigmaticMinor , Composite , Bhairav , HungarianMinor , Persian , Iwato , Kumoi , Pelog , Prometheus , PrometheusNeapolitan , PrometheusLiszt , Balinese , Ragatodi , Japanese1 , Japanese2 , Blues , Flamenco , Gypsy , HalfDiminished , In , Istrian , LydianAugmented , Tritone , UkranianDorian } |
| Scale type (name) eg Aeolian. More... | |
Public Member Functions | |
| MusicalScale (QObject *parent=nullptr) | |
| MusicalScale (ScaleType type, MusicalNote root, QObject *parent=nullptr) | |
| auto | scaleType () const |
| void | setScaleType (ScaleType type) |
| Q_SIGNAL void | scaleTypeChanged (ScaleType type) |
| auto | rootKey () const |
| void | setRootKey (MusicalNote root_key) |
| Q_SIGNAL void | rootKeyChanged (MusicalNote root_key) |
| Q_INVOKABLE QString | toString () const |
| Q_INVOKABLE bool | containsNote (MusicalNote note) const |
| Returns if the given key is in the given MusicalScale. | |
| utils::Utf8String | to_string () const |
| Prints the MusicalScale to a string. | |
| Q_INVOKABLE bool | containsChord (MusicalNote root, ChordType type, ChordAccent accent=ChordAccent::None) const |
| Returns if all of the chord's notes are in the scale. | |
| Q_INVOKABLE bool | isAccentInScale (MusicalNote chord_root, ChordType type, ChordAccent chord_accent) const |
| Returns if the accent is in the scale. | |
| bool | is_same_scale (const MusicalScale &other) const |
Static Public Member Functions | |
| static Q_INVOKABLE bool | scaleContainsNote (ScaleType type, MusicalNote rootKey, MusicalNote note) |
| static Q_INVOKABLE QString | noteToString (MusicalNote note) |
| static Q_INVOKABLE QStringList | allNoteNames () |
| Returns the display names of all 12 notes in a single octave. | |
| static Q_INVOKABLE QVariantList | availableScaleTypes () |
| static Q_INVOKABLE QVariantList | availableScaleTypesExotic () |
| static Q_INVOKABLE QVariantList | availableScaleTypesWithTriads () |
| Scales with pre-defined triad data in get_triad_types_for_type. | |
| static Q_INVOKABLE QVariantList | getDiatonicChords (ScaleType type, MusicalNote rootKey) |
| Returns a QVariantList of diatonic chord descriptors for the given scale, each as {display, rootNote, chordType}. | |
| static std::array< bool, 12 > | get_notes_for_type (ScaleType type, bool ascending) |
| Returns the notes in the given scale. | |
| static std::array< ChordType, 12 > | get_triad_types_for_type (ScaleType type, bool ascending) |
| Returns the triads in the given scale. | |
| static boost::container::static_vector< DiatonicTriad, 12 > | get_diatonic_triads (ScaleType type, MusicalNote root_note) |
| Returns the diatonic triads for the given scale and root note. | |
| static utils::Utf8String | type_to_string (ScaleType type) |
Properties | |
| ScaleType | scaleType |
| zrythm::dsp::chords::MusicalNote | rootKey |
Friends | |
| void | init_from (MusicalScale &obj, const MusicalScale &other, utils::ObjectCloneType clone_type) |
| void | to_json (nlohmann::json &j, const MusicalScale &s) |
| void | from_json (const nlohmann::json &j, MusicalScale &s) |
Musical scale descriptor.
Definition at line 25 of file musical_scale.h.
|
strong |
Scale type (name) eg Aeolian.
| Enumerator | |
|---|---|
| Chromatic | All keys. |
| Minor | Natural minor. |
| Ionian | Major (same as SCALE_MAJOR). |
| Aeolian | Natural minor (same as Minor). |
| Acoustic | Lydian dominant. |
Definition at line 37 of file musical_scale.h.
|
inline |
Definition at line 133 of file musical_scale.h.
|
inline |
Definition at line 134 of file musical_scale.h.
|
static |
Returns the display names of all 12 notes in a single octave.
Convenience for QML consumers that need the full list in a single call instead of invoking noteToString 12 times.
|
static |
Scales with pre-defined triad data in get_triad_types_for_type.
Used by the chord pad to populate chords from a scale.
| Q_INVOKABLE bool zrythm::dsp::MusicalScale::containsNote | ( | MusicalNote | note | ) | const |
Returns if the given key is in the given MusicalScale.
| note | A note inside a single octave (0-11). |
|
static |
Returns the diatonic triads for the given scale and root note.
Enumerates the enabled notes in the scale, pairs each with its corresponding triad type, and computes the absolute root note. Returns an empty result if the scale type is unimplemented.
| type | The scale type. |
| root_note | The root note of the scale. |
|
static |
Returns the notes in the given scale.
| ascending | Whether to get the notes when ascending or descending (some scales have different notes when rising/falling). |
|
static |
Returns the triads in the given scale.
There will be as many chords are enabled notes in the scale, and the rest of the array will be filled with CHORD_TYPE_NONE.
| ascending | Whether to get the triads when ascending or descending (some scales have different triads when rising/falling). |
|
inline |
Definition at line 277 of file musical_scale.h.
|
inline |
Definition at line 159 of file musical_scale.h.
|
inline |
Definition at line 147 of file musical_scale.h.
|
inline |
Definition at line 160 of file musical_scale.h.
|
inline |
Definition at line 148 of file musical_scale.h.
|
readwrite |
Definition at line 29 of file musical_scale.h.
|
readwrite |
Definition at line 28 of file musical_scale.h.