|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
Namespaces | |
| namespace | detail |
Classes | |
| struct | Chord |
| A chord "recipe" defining the required intervals relative to its root. More... | |
| struct | DiatonicChord |
| Contains the structure and generated symbol name of a diatonic chord. More... | |
| struct | Scale |
| Descriptor holding the name, pitch mask and chord tags for a musical scale. More... | |
Typedefs | |
| using | NoteSet = std::uint16_t |
| A 12-bit bitmask representing the 12 pitch-classes of the chromatic scale. | |
| using | Degree = int |
| Integer index used to select a degree inside standard diatonic representations (0-based). | |
Enumerations | |
| enum class | ChordTag : std::uint16_t { MajorTriad = 1u << 0 , MinorTriad = 1u << 1 , DiminishedTriad = 1u << 2 , AugmentedTriad = 1u << 3 , Major7 = 1u << 4 , Dominant7 = 1u << 5 , Minor7 = 1u << 6 , HalfDim7 = 1u << 7 , Dim7 = 1u << 8 , Sus2Triad = 1u << 9 , Sus4Triad = 1u << 10 , Major9 = 1u << 11 , Dominant9 = 1u << 12 , Minor9 = 1u << 13 , Major11 = 1u << 14 , Dominant11 = 1u << 15 , All = 0xFFFFu } |
| Bitmask flags describing chord "families" characteristic of a scale. More... | |
| enum class | ChordLevel : std::uint8_t { TriadsOnly = 0 , Triads7 = 1 , Triads79 = 2 , Triads7911 = 3 , Triads791113 = 4 } |
| Complexity level describing which extensions to generate for diatonic chords. More... | |
Functions | |
| constexpr ChordTag | operator| (ChordTag lhs, ChordTag rhs) noexcept |
| Bitwise OR operator for ChordTag flags. | |
| constexpr ChordTag | operator& (ChordTag lhs, ChordTag rhs) noexcept |
| Bitwise AND operator for ChordTag flags (intersection). | |
| constexpr bool | hasTags (ChordTag tags, ChordTag wanted) noexcept |
Tests whether tags contains ALL flags in wanted. | |
| consteval NoteSet | makeMask (bool b0, bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7, bool b8, bool b9, bool b10, bool b11) noexcept |
| Build a NoteSet from 12 boolean flags (b0 = C, b1 = C#/Db, ... b11 = B). | |
| consteval NoteSet | makeMask (std::initializer_list< int > degrees) noexcept |
| Build a NoteSet from a list of semitone degrees. | |
| constexpr std::string_view | noteName (int midi, int root=0) noexcept |
| Returns a human-readable note name for the given MIDI note (0..127). | |
| constexpr std::optional< int > | parseNote (std::string_view s) noexcept |
| Parse a simple note name (no octave) into a pitch-class (0..11). | |
| constexpr NoteSet | scaleAtRoot (NoteSet base, int root) noexcept |
| Circularly rotate a NoteSet so it becomes rooted at a specific key. | |
| constexpr std::array< int, 7 > | chordAtRootMidi (const Chord &c, int rootMidi, int inversion=0) noexcept |
| Build MIDI note numbers for a chord recipe located at a specific root. | |
| constexpr std::array< const Scale *, 16 > | scalesForChordMask (NoteSet chordMask) noexcept |
Reverse lookup: find up to 16 scales that fully contain chordMask. | |
| constexpr std::array< const Scale *, 16 > | scalesForChord (const Chord &chord) noexcept |
| Reverse lookup wrapper: find scales that can contain a specific Chord recipe. | |
| constexpr DiatonicChord | diatonicChord (const Scale &sc, Degree degree, ChordLevel level) noexcept |
| Generates the diatonic chord built upon a specific degree of a scale. | |
| constexpr std::array< int, 7 > | diatonicChordToMidi (const DiatonicChord &c, int rootMidi) noexcept |
| Convert a DiatonicChord's interval recipe into absolute MIDI notes. | |
| constexpr std::optional< int > | parseNoteWithOctave (std::string_view note) noexcept |
| Parse a note string containing an optional octave (e.g. "C#4", "C-1"). | |
| constexpr int | getOctaveFromNote (std::string_view note) noexcept |
| Extract octave number from a note string. Supports negative octaves. | |
| constexpr int | transposeByOctaves (int midi, int octaveDelta) noexcept |
| Transpose a MIDI note by a discrete number of full octaves. | |
Variables | |
| constexpr std::array< Scale, 61 > | allScales |
| constexpr std::array< std::string_view, 12 > | sharpNames |
| constexpr std::array< std::string_view, 12 > | flatNames |
| constexpr std::array< bool, 12 > | useSharpsForRoot |
| constexpr std::array< Chord, 15 > | allChords |
Integer index used to select a degree inside standard diatonic representations (0-based).
Definition at line 51 of file HarmonyConstants.h.
A 12-bit bitmask representing the 12 pitch-classes of the chromatic scale.
Bits 0..11 correspond to semitones above the root (0=C, 1=C#/Db, ..., 11=B). Fits perfectly in CPU registers for extremely fast subset/superset evaluations.
Definition at line 45 of file HarmonyConstants.h.
|
strong |
Complexity level describing which extensions to generate for diatonic chords.
| Enumerator | |
|---|---|
| TriadsOnly | Generate base triads only (R-3-5). |
| Triads7 | Generate up to 7th chords. |
| Triads79 | Up to 9ths. |
| Triads7911 | Up to 11ths. |
| Triads791113 | Up to 13ths. |
Definition at line 493 of file HarmonyConstants.h.
|
strong |
Bitmask flags describing chord "families" characteristic of a scale.
Used to filter scales by chord type without computing intervals dynamically.
Definition at line 70 of file HarmonyConstants.h.
|
constexprnoexcept |
Build MIDI note numbers for a chord recipe located at a specific root.
| c | Chord definition to use. |
| rootMidi | MIDI note for chord root (0..127 typical). |
| inversion | Which chord tone to place in bass (0=root position, 1=first inversion...). |
Definition at line 429 of file HarmonyConstants.h.
|
constexprnoexcept |
Generates the diatonic chord built upon a specific degree of a scale.
| sc | Scale definition (assumes root=C internally). |
| degree | The 0-based degree index inside the scale (0..6). |
| level | Which chord extensions to include. |
Definition at line 532 of file HarmonyConstants.h.
|
constexprnoexcept |
Convert a DiatonicChord's interval recipe into absolute MIDI notes.
| c | The DiatonicChord object. |
| rootMidi | The MIDI note assigned as the root of the generated chord. |
Definition at line 601 of file HarmonyConstants.h.
|
constexprnoexcept |
Extract octave number from a note string. Supports negative octaves.
| note | String representation of the note (e.g. "C#5", "C-1"). |
Definition at line 634 of file HarmonyConstants.h.
Tests whether tags contains ALL flags in wanted.
Definition at line 114 of file HarmonyConstants.h.
|
noexcept |
Build a NoteSet from 12 boolean flags (b0 = C, b1 = C#/Db, ... b11 = B).
Definition at line 142 of file HarmonyConstants.h.
|
noexcept |
Build a NoteSet from a list of semitone degrees.
Degree values are taken modulo 12. Negative degrees are ignored.
Definition at line 159 of file HarmonyConstants.h.
|
constexprnoexcept |
Returns a human-readable note name for the given MIDI note (0..127).
| midi | The MIDI note number. |
| root | The pitch-class of the key root (0..11) to decide enharmonic spelling. |
Definition at line 329 of file HarmonyConstants.h.
Bitwise AND operator for ChordTag flags (intersection).
Definition at line 105 of file HarmonyConstants.h.
Bitwise OR operator for ChordTag flags.
Definition at line 95 of file HarmonyConstants.h.
|
constexprnoexcept |
Parse a simple note name (no octave) into a pitch-class (0..11).
| s | String containing note name (e.g., "C#", "Bb", "Fb"). |
Definition at line 341 of file HarmonyConstants.h.
|
constexprnoexcept |
Parse a note string containing an optional octave (e.g. "C#4", "C-1").
| note | String representation of the note. |
Definition at line 619 of file HarmonyConstants.h.
Circularly rotate a NoteSet so it becomes rooted at a specific key.
| base | NoteSet defined with root = C. |
| root | Desired root as semitone offset from C (0..11). |
Definition at line 377 of file HarmonyConstants.h.
|
constexprnoexcept |
Reverse lookup wrapper: find scales that can contain a specific Chord recipe.
| chord | The Chord recipe object. |
Definition at line 476 of file HarmonyConstants.h.
|
constexprnoexcept |
Reverse lookup: find up to 16 scales that fully contain chordMask.
| chordMask | A NoteSet representing the notes of the chord. |
Definition at line 458 of file HarmonyConstants.h.
|
constexprnoexcept |
Transpose a MIDI note by a discrete number of full octaves.
| midi | Original MIDI note number. |
| octaveDelta | Number of octaves to transpose (can be negative). |
Definition at line 665 of file HarmonyConstants.h.
|
inlineconstexpr |
Definition at line 399 of file HarmonyConstants.h.
|
inlineconstexpr |
Definition at line 222 of file HarmonyConstants.h.
|
inlineconstexpr |
Definition at line 309 of file HarmonyConstants.h.
|
inlineconstexpr |
Definition at line 306 of file HarmonyConstants.h.
|
inlineconstexpr |
Definition at line 315 of file HarmonyConstants.h.