Deluge Firmware 1.3.0
Build date: 2026.11.28
Loading...
Searching...
No Matches
deluge::scale_degrees Namespace Reference

Classes

struct  LetterNotes
 For each letter 0..6, the intervals of the scale's notes with it. -1 means "none". More...

Typedefs

using DegreeLetters = std::array<int8_t, 12>
 Letter 0..6 of each interval of a scale, -1 for intervals not in it.

Functions

std::optional< DegreeLetters > degreeLetters (NoteSet scale)
int spellLetter (int interval, bool flats)
LetterNotes letterNotes (const DegreeLetters &letters)
int majorNote (int letter)
std::optional< ScaleChange > letterChange (const MusicalKey &key, NoteSet target)

Detailed Description

Diatonic degree letters: which 1st..7th (measured against the major scale 0 2 4 5 7 9 11) each note of a scale is, so a scale change can map degree to degree (pentatonic minor is 1 b3 4 5 b7) rather than by index.

Function Documentation

◆ degreeLetters()

std::optional< DegreeLetters > deluge::scale_degrees::degreeLetters ( NoteSet scale)

The letters of the notes of a scale of at most 7 notes. 7-note scales: letter = index. Fewer notes: the order-preserving assignment with the root alone on letter 0 and at most two notes per letter which minimises the total alteration from the major scale (at most 2 each); sharing a letter costs extra, and ties go to flats (a sharp costs a bit more than a flat). Returns nullopt if the scale has more than 7 notes or no such assignment exists. The root is always counted as present.

◆ letterChange()

std::optional< ScaleChange > deluge::scale_degrees::letterChange ( const MusicalKey & key,
NoteSet target )

Builds a ScaleChange from key.modeNotes to target which maps every note by its degree letter (see LetterMapping). Returns nullopt if either scale has no letters. key also decides how anchors which aren't in the source scale are spelled (flats or sharps).

◆ letterNotes()

LetterNotes deluge::scale_degrees::letterNotes ( const DegreeLetters & letters)

Splits the notes sharing letters into primary and secondary. The primary is the one nearer the major scale's note, the lower one if equally near.

◆ majorNote()

int deluge::scale_degrees::majorNote ( int letter)

Interval of the major scale's note with this letter.

◆ spellLetter()

int deluge::scale_degrees::spellLetter ( int interval,
bool flats )

Letter 0..6 an interval outside the scale is spelled with against the major scale: the next letter below it (a sharp) or, if flats, the next at or above it (a flat).