DSPark 1.8.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::harmony::detail Namespace Reference

Functions

constexpr void copy (char *dst, std::string_view src, std::size_t dstCapacity) noexcept
 Safe small string copy used only for compile-time-friendly name building.
 
constexpr std::array< int, 7 > activeDegrees (NoteSet mask) noexcept
 Extract active scale degrees and expand them sequentially across the octave.
 
constexpr int interval (const std::array< int, 7 > &deg, int degIdx, int skip) noexcept
 Calculate semitone interval skipping 'skip' degrees in the scale.
 

Function Documentation

◆ activeDegrees()

constexpr std::array< int, 7 > dspark::harmony::detail::activeDegrees ( NoteSet  mask)
constexprnoexcept

Extract active scale degrees and expand them sequentially across the octave.

Always returns exactly 7 degrees, whatever the mask cardinality:

  • exactly 7 set bits (heptatonic): the 7 degrees in ascending order;
  • fewer than 7 (pentatonic/hexatonic): the list WRAPS – entry i >= count repeats entry i % count one octave (+12) higher, so a pentatonic yields its 5 degrees plus 2 octave duplicates;
  • more than 7 (octatonic, chromatic): TRUNCATED to the lowest 7; upper degrees (e.g. the 8th degree of the Diminished scale) are unreachable through diatonicChord();
  • empty mask: the degenerate chromatic run 0..6.

Definition at line 198 of file HarmonyConstants.h.

◆ copy()

constexpr void dspark::harmony::detail::copy ( char *  dst,
std::string_view  src,
std::size_t  dstCapacity 
)
constexprnoexcept

Safe small string copy used only for compile-time-friendly name building.

Definition at line 177 of file HarmonyConstants.h.

◆ interval()

constexpr int dspark::harmony::detail::interval ( const std::array< int, 7 > &  deg,
int  degIdx,
int  skip 
)
constexprnoexcept

Calculate semitone interval skipping 'skip' degrees in the scale.

Definition at line 223 of file HarmonyConstants.h.