Class Mini
- Namespace
- Sigil.Sound
- Assembly
- Sigil.Sound.Notes.dll
Writing a pattern as text, in the style of Strudel and TidalCycles. The steps of a sequence share one cycle equally.
public static class MiniInheritance
Inherited Members
Remarks
a b c | three steps in a cycle |
a ~ b | a rest (~, or - on its own) |
a [b c] | a group: b and c share the second step |
[a,b,c] | layers played together (a chord); commas also work at the top level |
<a b c> | one per cycle, in turn |
a*2, a/2 | twice as fast, half as fast |
a(3,8), a(3,8,2) | a Euclidean rhythm: 3 hits over 8 steps, rotated by 2 |
a@3, a _ _ | take 3 shares of the cycle instead of 1 |
a!3, a ! | repeat the step (three in all, and once more) |
a?, a?0.3 | drop it at random (half the time, or 30%), the same way each time |
Methods
Chords(string)
Chords by name, such as "c3:min7 f3:7 [g3:sus4 g3]"; see Sigil.Sound.Chord.Parse(System.String) for the names. Turn them into notes with
Sigil.Sound.ChordPatterns.Notes(Sigil.Sound.Pattern{Sigil.Sound.Chord}) or Sigil.Sound.ChordPatterns.Arp(Sigil.Sound.Pattern{Sigil.Sound.Chord},Sigil.Sound.ArpMode,System.Int32).
public static Pattern<Chord> Chords(string text)Parameters
textstring
Returns
Exceptions
- MiniNotationException
-
The text is not valid.
Drums(string)
Drums by name, such as "bd ~ sn ~" or "hh*8", as notes on the General MIDI drum map, so the same pattern
also drives a MIDI drum kit. Names are case-insensitive and :0.6 sets the velocity (hh:0.4). Play each drum
as its own pattern, and give it the sound you want.
public static Pattern<Note> Drums(string text)Parameters
textstring
Returns
Examples
var bpm = 110;
var kick = Mini.Drums("bd ~ ~ bd ~ bd ~ ~");
var hats = Mini.Drums("hh*8");
kick.Play(v => Sine(Fn(t => 48 + 110 * Exp(-t * 28))).Adsr(0.001, 0.25, 0, 0.02), bpm) * 0.9
+ hats.Play(v => Noise(4).HighPass(7000).Adsr(0.001, 0.04, 0, 0.01), bpm) * 0.25
Remarks
bd | bass drum (36) |
rim | side stick (37) |
sn | snare (38) |
cp | hand clap (39) |
lt, mt, ht | low, mid and high tom (41, 47, 50) |
hh, oh | closed and open hi-hat (42, 46) |
cr, rd | crash and ride cymbal (49, 51) |
cb | cowbell (56) |
Exceptions
- MiniNotationException
-
The text is not valid, or a word is not a drum name.
Integers(string)
Whole numbers, such as scale degrees: "0 2 <4 -1> ~". Pair with Sigil.Sound.Scale.Notes(Sigil.Sound.Pattern{System.Int32}).
public static Pattern<int> Integers(string text)Parameters
textstring
Returns
Exceptions
- MiniNotationException
-
The text is not valid, or a word is not a whole number.
Notes(string)
Notes by name, such as "c3 [e3 g3]*2 ~ <b3 d4>". Names are case-insensitive, sharps are # and flats b
(eb4), and a name without an octave is in octave 3. Add :0.6 for the velocity (c4:0.6).
public static Pattern<Note> Notes(string text)Parameters
textstring
Returns
Exceptions
- MiniNotationException
-
The text is not valid.
Numbers(string)
Numbers, such as "400 800 1600 3200", for driving a parameter.
public static Pattern<double> Numbers(string text)Parameters
textstring
Returns
Exceptions
- MiniNotationException
-
The text is not valid.
Parse<T>(string, Func<string, T>)
Parses mini-notation whose words become values through atom; throw System.FormatException for a word it does not accept.
public static Pattern<T> Parse<T>(string text, Func<string, T> atom)Parameters
Returns
- Pattern<T>
Type Parameters
T
Exceptions
- MiniNotationException
-
The text is not valid.