Class PatternPlayback
- Namespace
- Sigil.Sound
- Assembly
- Sigil.Sound.Notes.dll
Playing a note pattern live: Mini.Notes("c3 e3 g3").Play(v => Saw(v.Frequency).Adsr(...)).
public static class PatternPlaybackInheritance
Inherited Members
Methods
Jux(Pattern<Note>, Func<Pattern<Note>, Pattern<Note>>, Func<Voice, Sound>, double?, int, double)
Plays the pattern on the left and a changed copy of it on the right, so a transformation becomes stereo width:
notes.Jux(p => p.Transpose(7), voice) doubles every note a fifth up on the other side.
public static Sound Jux(this Pattern<Note> pattern, Func<Pattern<Note>, Pattern<Note>> transform, Func<Voice, Sound> voice, double? bpm = null, int polyphony = 8, double width = 1)Parameters
patternPattern<Note>-
The notes; played as they are, to the left.
transformFunc<Pattern<Note>, Pattern<Note>>-
Makes the right-hand copy from the pattern.
voiceFunc<Voice, Sound>-
The sound of one note, as for Sigil.Sound.PatternPlayback.Play(Sigil.Sound.Pattern{Sigil.Sound.Note},System.Func{Sigil.Sound.Voice,Sigil.Sound.Sound},System.Nullable{System.Double},System.Int32).
bpmdouble?-
The tempo, or null to follow the host clock.
polyphonyint-
The most notes sounding at once on each side.
widthdouble-
How far each side is panned: 1 is hard left and right, 0 puts both in the center.
Returns
Play(Pattern<Note>, Func<Voice, Sound>, double?, int)
Turns a pattern into sound. Unlike Sigil.Sound.Patterns.Play(Sigil.Sound.Pattern,System.Func{Sigil.Sound.Voice,Sigil.Sound.Sound},System.Nullable{System.Double},System.Int32) on a written-out Sigil.Sound.Pattern, the pattern is asked
for each block as it plays, so it can run forever and change from cycle to cycle (<a b>, Every,
Degrade) without being repeated, and replacing the sound or changing the tempo needs no rebuilding.
public static Sound Play(this Pattern<Note> pattern, Func<Voice, Sound> voice, double? bpm = null, int polyphony = 8)Parameters
patternPattern<Note>-
The notes to play.
voiceFunc<Voice, Sound>-
Describes the sound of one note from its Sigil.Sound.Voice signals. Called while the sound is built, not per note.
bpmdouble?-
The tempo, or null to follow the host clock (or 120 without one).
polyphonyint-
The most notes sounding at once, from 1 to 64. Defaults to 8.
Returns
Examples
Mini.Notes("c3 [e3 g3]*2 ~ <b3 d4>").Every(4, p => p.Rev()).Play(v => Saw(v.Frequency).Adsr(0.003, 0.15, 0.4, 0.2))
Remarks
Each note lasts as long as its event in the pattern, and its velocity scales the voice. Voices are built up front and reused, so
playing allocates nothing. Time is bound to the music as in Sigil.Sound.Patterns.Play(Sigil.Sound.Pattern,System.Func{Sigil.Sound.Voice,Sigil.Sound.Sound},System.Nullable{System.Double},System.Int32): with a Sigil.Sound.HostClock and no
bpm the pattern follows the host's beat position and tempo, and a replacement stays on the grid; otherwise
it counts from when it starts, at bpm (120 if not given). One cycle is Sigil.Sound.Pat.BeatsPerCycle beats.