12#ifndef __AUDIO_SCALE_H__
13#define __AUDIO_SCALE_H__
19#include <glib/gi18n.h>
27#define SCALE_SCHEMA_VERSION 2
59 SCALE_MAJOR_PENTATONIC,
60 SCALE_MINOR_PENTATONIC,
61 SCALE_OCTATONIC_HALF_WHOLE,
62 SCALE_OCTATONIC_WHOLE_HALF,
70 SCALE_PHRYGIAN_DOMINANT,
74 SCALE_DOUBLE_HARMONIC,
77 SCALE_DOMINANT_DIMINISHED,
79 SCALE_EIGHT_TONE_SPANISH,
84 SCALE_HUNGARIAN_GYPSY,
86 SCALE_NEAPOLITAN_MAJOR,
87 SCALE_NEAPOLITAN_MINOR,
97 SCALE_ENIGMATIC_MINOR,
100 SCALE_HUNGARIAN_MINOR,
106 SCALE_PROMETHEUS_NEAPOLITAN,
107 SCALE_PROMETHEUS_LISZT,
118 SCALE_HALF_DIMINISHED,
121 SCALE_LYDIAN_AUGMENTED,
123 SCALE_UKRANIAN_DORIAN,
128static const cyaml_strval_t musical_scale_type_strings[] = {
130 { N_ (
"Major"), SCALE_MAJOR },
133 { N_ (
"Dorian"), SCALE_DORIAN },
134 { N_ (
"Phrygian"), SCALE_PHRYGIAN },
135 { N_ (
"Lydian"), SCALE_LYDIAN },
136 { N_ (
"Mixolydian"), SCALE_MIXOLYDIAN },
138 { N_ (
"Locrian"), SCALE_LOCRIAN },
139 { N_ (
"Melodic Minor"), SCALE_MELODIC_MINOR },
140 { N_ (
"Harmonic Minor"), SCALE_HARMONIC_MINOR },
141 { N_ (
"Whole Tone"), SCALE_WHOLE_TONE },
142 { N_ (
"Major Pentatonic"), SCALE_MAJOR_PENTATONIC },
143 { N_ (
"Minor Pentatonic"), SCALE_MINOR_PENTATONIC },
144 { N_ (
"Octatonic Half Whole"), SCALE_OCTATONIC_HALF_WHOLE },
145 { N_ (
"Octatonic Whole Half"), SCALE_OCTATONIC_WHOLE_HALF },
147 { N_ (
"Harmonic Major"), SCALE_HARMONIC_MAJOR },
148 { N_ (
"Phrygian Dominant"), SCALE_PHRYGIAN_DOMINANT },
149 { N_ (
"Major Locrian"), SCALE_MAJOR_LOCRIAN },
150 { N_ (
"Algerian"), SCALE_ALGERIAN },
151 { N_ (
"Augmented"), SCALE_AUGMENTED },
152 { N_ (
"Double Harmonic"), SCALE_DOUBLE_HARMONIC },
153 { N_ (
"Chinese"), SCALE_CHINESE },
154 { N_ (
"Diminished"), SCALE_DIMINISHED },
155 { N_ (
"Dominant Diminished"), SCALE_DOMINANT_DIMINISHED },
156 { N_ (
"Egyptian"), SCALE_EGYPTIAN },
157 { N_ (
"Eight Tone Spanish"), SCALE_EIGHT_TONE_SPANISH },
158 { N_ (
"Enigmatic"), SCALE_ENIGMATIC },
159 { N_ (
"Geez"), SCALE_GEEZ },
160 { N_ (
"Hindu"), SCALE_HINDU },
161 { N_ (
"Hirajoshi"), SCALE_HIRAJOSHI },
162 { N_ (
"Hungarian Gypsy"), SCALE_HUNGARIAN_GYPSY },
163 { N_ (
"Insen"), SCALE_INSEN },
164 { N_ (
"Neapolitan Major"), SCALE_NEAPOLITAN_MAJOR },
165 { N_ (
"Neapolitan Minor"), SCALE_NEAPOLITAN_MINOR },
166 { N_ (
"Oriental"), SCALE_ORIENTAL },
167 { N_ (
"Romanian Minor"), SCALE_ROMANIAN_MINOR },
168 { N_ (
"Altered"), SCALE_ALTERED },
169 { N_ (
"Maqam"), SCALE_MAQAM },
170 { N_ (
"Yo"), SCALE_YO },
171 { N_ (
"Bebop Locrian"), SCALE_BEBOP_LOCRIAN },
172 { N_ (
"Bebop Dominant"), SCALE_BEBOP_DOMINANT },
173 { N_ (
"Bebop Major"), SCALE_BEBOP_MAJOR },
174 { N_ (
"Super Locrian"), SCALE_SUPER_LOCRIAN },
175 { N_ (
"Enigmatic Minor"), SCALE_ENIGMATIC_MINOR },
176 { N_ (
"Composite"), SCALE_COMPOSITE },
177 { N_ (
"Bhairav"), SCALE_BHAIRAV },
178 { N_ (
"Hungarian Minor"), SCALE_HUNGARIAN_MINOR },
179 { N_ (
"Persian"), SCALE_PERSIAN },
180 { N_ (
"Iwato"), SCALE_IWATO },
181 { N_ (
"Kumoi"), SCALE_KUMOI },
182 { N_ (
"Pelog"), SCALE_PELOG },
183 { N_ (
"Prometheus"), SCALE_PROMETHEUS },
184 { N_ (
"Prometheus Neapolitan"), SCALE_PROMETHEUS_NEAPOLITAN},
185 { N_ (
"Prometheus Liszt"), SCALE_PROMETHEUS_LISZT },
186 { N_ (
"Balinese"), SCALE_BALINESE },
187 { N_ (
"RagaTodi"), SCALE_RAGATODI },
188 { N_ (
"Japanese 1"), SCALE_JAPANESE1 },
189 { N_ (
"Japanese 2"), SCALE_JAPANESE2 },
206static const cyaml_schema_field_t musical_scale_fields_schema[] = {
208 YAML_FIELD_ENUM (
MusicalScale, type, musical_scale_type_strings),
209 YAML_FIELD_ENUM (
MusicalScale, root_key, musical_note_strings),
214static const cyaml_schema_value_t musical_scale_schema = {
297 MusicalNote chord_root,
bool musical_scale_contains_note(const MusicalScale *scale, MusicalNote note)
Returns if the given key is in the given MusicalScale.
bool musical_scale_contains_chord(const MusicalScale *const scale, const ChordDescriptor *const chord)
Returns if all of the chord's notes are in the scale.
char * musical_scale_as_string(MusicalScale *scale)
Returns the scale in human readable string.
char * musical_scale_to_string(const MusicalScale *const self)
Prints the MusicalScale to a string.
ChordAccent
Chord accents.
void musical_scale_strcpy(MusicalScale *scale, char *buf)
Same as above but uses a buffer instead of allocating.
MusicalScale * musical_scale_new(MusicalScaleType type, MusicalNote root)
Creates new scale using type and root note.
RETURNS_NONNULL const ChordType * musical_scale_get_triad_types(MusicalScaleType scale_type, bool ascending)
Returns the triads in the given scale.
void musical_scale_free(MusicalScale *scale)
Frees the MusicalScale.
const bool * musical_scale_get_notes(MusicalScaleType scale_type, bool ascending)
Returns the notes in the given scale.
int musical_scale_is_accent_in_scale(MusicalScale *scale, MusicalNote chord_root, ChordType type, ChordAccent chord_accent)
Returns if the accent is in the scale.
MusicalScale * musical_scale_clone(MusicalScale *src)
Clones the scale.
MusicalScaleType
Scale type (name) eg Aeolian.
@ SCALE_MINOR
Natural minor.
@ SCALE_AEOLIAN
Natural minor (same as SCALE_MINOR).
@ SCALE_CHROMATIC
All keys.
@ SCALE_ACOUSTIC
Lydian dominant.
@ SCALE_IONIAN
Major (same as SCALE_MAJOR).
#define YAML_VALUE_PTR(cc, fields_schema)
Schema to be used as a pointer.
A ChordDescriptor describes a chord and is not linked to any specific object by itself.
Musical scale descriptor.
MusicalScaleType type
Identification of the scale (e.g.
MusicalNote root_key
Root key of the scale.