Class Chord
- Namespace
- Sigil.Sound
- Assembly
- Sigil.Sound.Notes.dll
A chord: a set of pitches, kept low to high. Make one by name (Chord.Parse("c3:min7")), from a root
(Chord.Minor(C3)), or from the pitches themselves.
public sealed class ChordInheritance
Inherited Members
Constructors
Chord(IEnumerable<int>, string)
A chord of exactly these MIDI pitches (any order; they are sorted).
public Chord(IEnumerable<int> pitches, string name = "custom")Parameters
pitchesIEnumerable<int>namestring
Properties
Name
A label such as "min7".
public string Name { get; }Property Value
Notes
The same pitches as notes at the default velocity.
public IReadOnlyList<Note> Notes { get; }Property Value
Pitches
The MIDI pitches, low to high.
public IReadOnlyList<int> Pitches { get; }Property Value
Methods
Arp(ArpMode, int)
The notes one after another as a repeating pattern, each taking an equal share of the cycle.
public Pattern<Note> Arp(ArpMode mode = ArpMode.Up, int octaves = 1)Parameters
Returns
Augmented(int)
An augmented triad on root.
public static Chord Augmented(int root)Parameters
rootint
Returns
Diminished(int)
A diminished triad on root.
public static Chord Diminished(int root)Parameters
rootint
Returns
Dominant7(int)
A dominant seventh chord on root.
public static Chord Dominant7(int root)Parameters
rootint
Returns
Inversion(int)
Raises the lowest note an octave, count times (or lowers the highest, if negative): a first inversion has the third on the bottom.
public Chord Inversion(int count)Parameters
countint
Returns
Major(int)
A major triad on root (a MIDI pitch).
public static Chord Major(int root)Parameters
rootint
Returns
Major7(int)
A major seventh chord on root.
public static Chord Major7(int root)Parameters
rootint
Returns
Minor(int)
A minor triad on root.
public static Chord Minor(int root)Parameters
rootint
Returns
Minor7(int)
A minor seventh chord on root.
public static Chord Minor7(int root)Parameters
rootint
Returns
Of(int, string)
The chord built on a root from a quality name such as "min7"; see Sigil.Sound.Chord.Parse(System.String) for the names.
public static Chord Of(int root, string quality)Parameters
Returns
Parse(string)
A chord by name: a root and a quality joined by a colon, such as "c3:min7" or "F#2:sus4". A root without an
octave is in octave 3 and no quality means major. Qualities: major (maj, M), minor (min, m), dim, aug, sus2, sus4, 5, 6, m6,
7, maj7, m7, mmaj7, m7b5, dim7, 9, maj9, m9, add9.
public static Chord Parse(string text)Parameters
textstring
Returns
Exceptions
- FormatException
-
The text is not a root and a known quality.
Steps(Pattern<int>)
Plays steps of this chord: step 0 is its lowest tone, 1 the next one up, and so on; past the top it climbs into the next octave, and
below 0 it goes down below the lowest tone. Chord.Major(60).Steps("0 1 2 3") is C E G and the C above.
A step whose note would leave the MIDI range is left out.
public Pattern<Note> Steps(Pattern<int> steps)Parameters
stepsPattern<int>-
The steps, such as
Mini.Integers("7 6 5 4 3 2 1 0"), a fall through two octaves of a triad.
Returns
Examples
// Steps of a chord: 0 is its lowest tone, 1 the next, and past the top the run climbs an octave. -1 is the tone below the lowest.
Chord.Of(60, "maj7").Steps(Mini.Integers("0 1 2 3 4 3 2 1 -1 0"))
.Play(v => Triangle(v.Frequency).Adsr(0.005, 0.15, 0.3, 0.2), bpm: 130) * 0.3
Steps(string)
Plays steps of this chord written in Sigil.Sound.Mini notation; see Sigil.Sound.Chord.Steps(Sigil.Sound.Pattern{System.Int32}).
public Pattern<Note> Steps(string steps)Parameters
stepsstring-
The steps, such as
"0 2 4 [7 5]".
Returns
Examples
// The same steps written as text; they follow whichever chord this is.
Chord.Parse("a3:min7").Steps("0 2 4 [3 1] 2 0")
.Play(v => Saw(v.Frequency).LowPass(2000).Adsr(0.005, 0.15, 0.3, 0.2), bpm: 120) * 0.25
Exceptions
- MiniNotationException
-
The text is not valid.
Sus2(int)
A suspended second chord on root.
public static Chord Sus2(int root)Parameters
rootint
Returns
Sus4(int)
A suspended fourth chord on root.
public static Chord Sus4(int root)Parameters
rootint
Returns
ToPattern()
All the notes at once, filling the cycle.
public Pattern<Note> ToPattern()Returns
ToString()
The chord as text: its pitches and its quality.
public override string ToString()Returns
Transpose(int)
Moves every note by semitones.
public Chord Transpose(int semitones)Parameters
semitonesint