Static utilities for music theory calculations: scale intervals, frequency conversion, tempo math. These are shared across CsoundUnity features (Timelines, standalone components, etc.).
More...
|
| static int[] | GetIntervals (Scale scale) |
| | Returns the semitone interval array for the given scale.
|
| static float[] | BuildPitchArray (float rootHz, Scale scale, int octaves, bool includeClosingRoot=false) |
| | Builds a flat array of frequencies in Hz spanning octaves octaves of the given scale, starting from rootHz .
|
| static int[] | GetChordIntervals (Chord chord) |
| | Returns the semitone interval array for the given chord. Returns null for Chord.Custom — the caller must supply the intervals.
|
| static float[] | BuildPitchArrayFromChord (float rootHz, Chord chord, int octaves, int[] customIntervals=null, bool includeClosingRoot=false) |
| | Builds a flat array of frequencies in Hz from a chord, spanning octaves octaves. Chord intervals may already span more than one octave (e.g. 9ths, 11ths, 13ths); additional octaves stack the same intervals shifted up by 12 semitones per octave.
|
| static float | DivisionToSeconds (float bpm, RhythmicDivision division) |
| | Returns the interval in seconds between notes for a given BPM and rhythmic division.
|
| static float | MidiToHz (int midiNote) |
| | Converts a MIDI note number to frequency in Hz (A4 = MIDI 69 = 440 Hz).
|
| static int | HzToMidi (float hz) |
| | Converts a frequency in Hz to the nearest MIDI note number.
|
| static string | MidiToNoteName (int midi) |
| | Returns the note name for a MIDI note number (e.g. 60 → "C4").
|
| static string | HzToNoteName (float hz) |
| | Returns the note name for a frequency in Hz (e.g. 261.63 → "C4").
|
| static int | NoteNameToMidi (string name) |
| | Parses a note name (e.g. "C4", "C#3", "Db4") into a MIDI note number (0–127). Returns -1 if the name cannot be parsed.
|
| static float | GetPitchAtStep (float[] pitches, int stepIndex, ArpDirection direction) |
| | Picks a pitch from pitches based on the current step index and the desired direction .
|
| static bool[] | BuildEuclideanPattern (int hits, int steps, int rotation=0) |
| | Builds a Euclidean (Bjorklund) rhythm pattern as a boolean array. Distributes hits active steps as evenly as possible across steps total steps, then rotates the result by rotation positions.
|
|
| static readonly int[] | IntervalsChromatic = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 } |
| | Semitone intervals for the Scale.Chromatic scale (all 12 semitones).
|
| static readonly int[] | IntervalsMajor = { 0, 2, 4, 5, 7, 9, 11 } |
| | Semitone intervals for the Scale.Major (Ionian) scale.
|
| static readonly int[] | IntervalsMinor = { 0, 2, 3, 5, 7, 8, 10 } |
| | Semitone intervals for the Scale.Minor (Aeolian) scale.
|
| static readonly int[] | IntervalsPentatonic = { 0, 2, 4, 7, 9 } |
| | Semitone intervals for the Scale.Pentatonic (major pentatonic) scale.
|
| static readonly int[] | IntervalsDorian = { 0, 2, 3, 5, 7, 9, 10 } |
| | Semitone intervals for the Scale.Dorian mode.
|
| static readonly int[] | IntervalsPhrygian = { 0, 1, 3, 5, 7, 8, 10 } |
| | Semitone intervals for the Scale.Phrygian mode.
|
| static readonly int[] | IntervalsLydian = { 0, 2, 4, 6, 7, 9, 11 } |
| | Semitone intervals for the Scale.Lydian mode.
|
| static readonly int[] | IntervalsMixolydian = { 0, 2, 4, 5, 7, 9, 10 } |
| | Semitone intervals for the Scale.Mixolydian mode.
|
| static readonly int[] | IntervalsHarmonicMinor = { 0, 2, 3, 5, 7, 8, 11 } |
| | Semitone intervals for the Scale.HarmonicMinor scale.
|
| static readonly int[] | ChordUnison = { 0 } |
| | Semitone intervals for the Chord.Unison (root only).
|
| static readonly int[] | ChordMinorThird = { 0, 3 } |
| | Semitone intervals for the Chord.MinorThird dyad.
|
| static readonly int[] | ChordMajorThird = { 0, 4 } |
| | Semitone intervals for the Chord.MajorThird dyad.
|
| static readonly int[] | ChordFourth = { 0, 5 } |
| | Semitone intervals for the Chord.Fourth dyad.
|
| static readonly int[] | ChordFifth = { 0, 7 } |
| | Semitone intervals for the Chord.Fifth dyad.
|
| static readonly int[] | ChordMajor = { 0, 4, 7 } |
| | Semitone intervals for the Chord.Major triad.
|
| static readonly int[] | ChordMinor = { 0, 3, 7 } |
| | Semitone intervals for the Chord.Minor triad.
|
| static readonly int[] | ChordDiminished = { 0, 3, 6 } |
| | Semitone intervals for the Chord.Diminished triad.
|
| static readonly int[] | ChordAugmented = { 0, 4, 8 } |
| | Semitone intervals for the Chord.Augmented triad.
|
| static readonly int[] | ChordSus2 = { 0, 2, 7 } |
| | Semitone intervals for the Chord.Sus2 triad.
|
| static readonly int[] | ChordSus4 = { 0, 5, 7 } |
| | Semitone intervals for the Chord.Sus4 triad.
|
| static readonly int[] | ChordMajor7 = { 0, 4, 7, 11 } |
| | Semitone intervals for the Chord.Major7 chord.
|
| static readonly int[] | ChordMinor7 = { 0, 3, 7, 10 } |
| | Semitone intervals for the Chord.Minor7 chord.
|
| static readonly int[] | ChordDominant7 = { 0, 4, 7, 10 } |
| | Semitone intervals for the Chord.Dominant7 chord.
|
| static readonly int[] | ChordDiminished7 = { 0, 3, 6, 9 } |
| | Semitone intervals for the Chord.Diminished7 chord.
|
| static readonly int[] | ChordHalfDiminished7 = { 0, 3, 6, 10 } |
| | Semitone intervals for the Chord.HalfDiminished7 chord.
|
| static readonly int[] | ChordMinorMajor7 = { 0, 3, 7, 11 } |
| | Semitone intervals for the Chord.MinorMajor7 chord.
|
| static readonly int[] | ChordAugmented7 = { 0, 4, 8, 10 } |
| | Semitone intervals for the Chord.Augmented7 chord.
|
| static readonly int[] | ChordAugmentedMajor7 = { 0, 4, 8, 11 } |
| | Semitone intervals for the Chord.AugmentedMajor7 chord.
|
| static readonly int[] | ChordMajor9 = { 0, 4, 7, 11, 14 } |
| | Semitone intervals for the Chord.Major9 chord.
|
| static readonly int[] | ChordMinor9 = { 0, 3, 7, 10, 14 } |
| | Semitone intervals for the Chord.Minor9 chord.
|
| static readonly int[] | ChordDominant9 = { 0, 4, 7, 10, 14 } |
| | Semitone intervals for the Chord.Dominant9 chord.
|
| static readonly int[] | ChordAdd9 = { 0, 4, 7, 14 } |
| | Semitone intervals for the Chord.Add9 chord (major triad + 9th, no 7th).
|
| static readonly int[] | ChordMajor11 = { 0, 4, 7, 11, 14, 17 } |
| | Semitone intervals for the Chord.Major11 chord.
|
| static readonly int[] | ChordMinor11 = { 0, 3, 7, 10, 14, 17 } |
| | Semitone intervals for the Chord.Minor11 chord.
|
| static readonly int[] | ChordDominant11 = { 0, 4, 7, 10, 14, 17 } |
| | Semitone intervals for the Chord.Dominant11 chord.
|
| static readonly int[] | ChordMajor13 = { 0, 4, 7, 11, 14, 17, 21 } |
| | Semitone intervals for the Chord.Major13 chord.
|
| static readonly int[] | ChordMinor13 = { 0, 3, 7, 10, 14, 17, 21 } |
| | Semitone intervals for the Chord.Minor13 chord.
|
| static readonly int[] | ChordDominant13 = { 0, 4, 7, 10, 14, 17, 21 } |
| | Semitone intervals for the Chord.Dominant13 chord.
|
Static utilities for music theory calculations: scale intervals, frequency conversion, tempo math. These are shared across CsoundUnity features (Timelines, standalone components, etc.).