Table of Contents

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 Chord

Inheritance

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

pitches IEnumerable<int>
name string

Properties

Name

A label such as "min7".

public string Name { get; }

Property Value

string

Notes

The same pitches as notes at the default velocity.

public IReadOnlyList<Note> Notes { get; }

Property Value

IReadOnlyList<Note>

Pitches

The MIDI pitches, low to high.

public IReadOnlyList<int> Pitches { get; }

Property Value

IReadOnlyList<int>

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

mode ArpMode
octaves int

Returns

Pattern<Note>

Augmented(int)

An augmented triad on root.

public static Chord Augmented(int root)

Parameters

root int

Returns

Chord

Diminished(int)

A diminished triad on root.

public static Chord Diminished(int root)

Parameters

root int

Returns

Chord

Dominant7(int)

A dominant seventh chord on root.

public static Chord Dominant7(int root)

Parameters

root int

Returns

Chord

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

count int

Returns

Chord

Major(int)

A major triad on root (a MIDI pitch).

public static Chord Major(int root)

Parameters

root int

Returns

Chord

Major7(int)

A major seventh chord on root.

public static Chord Major7(int root)

Parameters

root int

Returns

Chord

Minor(int)

A minor triad on root.

public static Chord Minor(int root)

Parameters

root int

Returns

Chord

Minor7(int)

A minor seventh chord on root.

public static Chord Minor7(int root)

Parameters

root int

Returns

Chord

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

root int
quality string

Returns

Chord

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

text string

Returns

Chord

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

steps Pattern<int>

The steps, such as Mini.Integers("7 6 5 4 3 2 1 0"), a fall through two octaves of a triad.

Returns

Pattern<Note>

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

steps string

The steps, such as "0 2 4 [7 5]".

Returns

Pattern<Note>

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

root int

Returns

Chord

Sus4(int)

A suspended fourth chord on root.

public static Chord Sus4(int root)

Parameters

root int

Returns

Chord

ToPattern()

All the notes at once, filling the cycle.

public Pattern<Note> ToPattern()

Returns

Pattern<Note>

ToString()

The chord as text: its pitches and its quality.

public override string ToString()

Returns

string

Transpose(int)

Moves every note by semitones.

public Chord Transpose(int semitones)

Parameters

semitones int

Returns

Chord