Namespace Sigil.Sound
Namespaces
Classes
- AudioBuffer
-
Stereo audio held in memory: a rendered sound, or a sample decoded from a WAV file for Sigil.Sound.Sounds.Sample(Sigil.Sound.AudioBuffer,System.Nullable{Sigil.Sound.Param},Sigil.Sound.PlaybackMode,System.Double,System.Nullable{System.Double}).
- Beats
-
Common note lengths, in beats (a beat is a quarter note), for Sigil.Sound.Patterns.Every(System.Collections.Generic.IEnumerable{Sigil.Sound.Note},System.Double,System.Double).
- Chord
-
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. - ChordPatterns
-
Patterns of chords: playing them as block chords, or as arpeggios.
- Control
-
A value the game or UI sets while sound is playing, such as engine RPM or how tense the music is. The audio thread follows it smoothly, so a jump in Sigil.Sound.Control.Value (a game frame is 16 ms, a block is 5 ms) glides over
slewSecondsinstead of clicking. Setting it from any thread is safe and takes no lock. - HostClock
-
The host's notion of "now": how many frames it has rendered and where it is on a musical grid. Put one on Sigil.Sound.RenderContext.Clock and time no longer starts over each time a sound is compiled, which is what keeps a live-coded LFO in phase and a looping pattern on the beat when the sound under them is swapped for another.
- HostSequence
-
Lets a host learn that a script plays a sequence on the host's clock, so it can offer play, pause and stop and a tempo for it. A pattern played without a tempo (
pattern.Play(voice)) follows the host; one given abpmkeeps its own time and does not report. - Mini
-
Writing a pattern as text, in the style of Strudel and TidalCycles. The steps of a sequence share one cycle equally.
- MiniNotationException
-
The text given to Sigil.Sound.Mini is not valid mini-notation. Sigil.Sound.MiniNotationException.Position is the zero-based column of the problem.
- NoteEmitter
-
Gathers the notes a raw function makes from one note; see Sigil.Sound.NoteStream.SelectMany(Sigil.Sound.NoteExpander).
- NoteInput
-
Notes played live, from a keyboard, a game or a UI, as opposed to a Sigil.Sound.Pattern written in advance. Create one, build a sound from it with Sigil.Sound.NoteInput.Play(System.Func{Sigil.Sound.Voice,Sigil.Sound.Sound},System.Int32), and call Sigil.Sound.NoteInput.NoteOn(System.Int32,System.Single,System.Double) and Sigil.Sound.NoteInput.NoteOff(System.Int32) from any thread while that sound renders.
- NotePatterns
-
Working with patterns of notes.
- NoteStream
-
Notes as they happen: a description of live notes (from a keyboard, a device, a pattern) and what is done to them on the way to an instrument or the next device. Where a Sigil.Sound.Pattern`1 is a score, a function of time, a stream is a performance: its notes start when a key goes down and end when it comes up, and each has an identity that every operator keeps.
- NoteStreamRunner
-
A Sigil.Sound.NoteStream built to run: a host calls Sigil.Sound.NoteStreamRunner.Process(System.Int32) once per block and reads the notes that come out, to send them to a device or an instrument of its own. This is the other half of Sigil.Sound.NoteStream.Play(System.Func{Sigil.Sound.Voice,Sigil.Sound.Sound},System.Int32), which plays the notes itself.
- Notes
-
Creating note sequences. Sequences are plain System.Collections.Generic.IEnumerable`1 values, so LINQ (
Where,Select, ...) already works on them; timing, playback and MIDI file reading come later. - Operator
-
Creating Sigil.Sound.IOperator instances without declaring a class.
- ParamSource
-
The compiled, stateful form of a Sigil.Sound.Param. Produces one value per frame.
- Pat
-
Building patterns from scratch:
using static Sigil.Sound.Pat;thenSeq(Pure(1), Pure(2)). - Pattern
-
Notes placed in time: an immutable timeline that Sigil.Sound.Patterns.Play(Sigil.Sound.Pattern,System.Func{Sigil.Sound.Voice,Sigil.Sound.Sound},System.Nullable{System.Double},System.Int32) turns into sound. Create one with Sigil.Sound.Patterns.Every(System.Collections.Generic.IEnumerable{Sigil.Sound.Note},System.Double,System.Double), change it with Sigil.Sound.Pattern.Loop and Sigil.Sound.Pattern.Transpose(System.Int32).
- Pattern<T>
-
Values arranged in cycle time, as a question you can ask of any stretch of time: "what happens between 3 and 4.5?". Because it is a function and not a stored list,
Fast,Rev,Everyand friends compose freely and a pattern can run forever or change from cycle to cycle. Build one with Sigil.Sound.Pat or Sigil.Sound.Mini (Mini.Notes("c3 [e3 g3]*2 ~ <b3 d4>")), reshape it with the methods on Sigil.Sound.PatternExtensions. - PatternExtensions
-
Reshaping patterns. Every method returns a new pattern and leaves the original alone.
- PatternPlayback
-
Playing a note pattern live:
Mini.Notes("c3 e3 g3").Play(v => Saw(v.Frequency).Adsr(...)). - PatternSignals
-
Turning a pattern of numbers into a signal that drives a parameter.
- Patterns
-
Placing notes in time and playing them:
notes.Every(Beats.Eighth).Loop().Play(v => ...). - Pitch
-
MIDI pitches by name, for writing notes in code:
using static Sigil.Sound.Pitch;thenScale.Minor(C3)ornew Note(Eb4). A trailingsis a sharp andba flat, soCs4is C sharp andDb4is D flat. Octave 4 holds middle C (C4is 60); the range is octave 0 to octave 8. - PlayingNote
-
One note a player is holding, which the player can keep shaping while it sounds: bend its pitch, press harder, slide. Get one from Sigil.Sound.NoteInput.Start(System.Int32,System.Single). Two notes at the same pitch are two notes, each with its own bend, pressure and slide, which is how an MPE controller plays: one note per channel.
- SampleLibrary
-
The samples available to a script, by name. In a script it is the
Samplesobject:Samples.Load("kick.wav")gives an Sigil.Sound.AudioBuffer to play with Sigil.Sound.Sounds.Sample(Sigil.Sound.AudioBuffer,System.Nullable{Sigil.Sound.Param},Sigil.Sound.PlaybackMode,System.Double,System.Nullable{System.Double}). The browser REPL fills it with the WAV files you drop onto the page, and Audio Workbench's Sound Script with the Asset Manager's sample library, so a script reads the same in both. - SampleNameAttribute
-
Marks a System.String parameter that takes the name of a sample in the host's sample library, such as the
nameof Sigil.Sound.SampleLibrary.Load(System.String). Editors that recognise it offer the library's sample names while you type the argument, so you pick a file instead of remembering how it is spelled. - Scale
-
A scale: a root note and the steps above it. Degrees count up the scale from 0 and run past the octave, so degree 7 of a seven-note scale is the root again an octave up, and negative degrees go below the root.
- Slot
-
A hot-swappable place in a chain. Sigil.Sound.Slot.Sound can go anywhere a sound goes; Sigil.Sound.Slot.Swap(Sigil.Sound.Sound,System.Nullable{System.Double}) replaces what plays there in every running render, with a short equal-power crossfade so the change doesn't click.
- Sound
-
An immutable description of a sound. Composing a Sigil.Sound.Sound never renders anything and never mutates the original; every operator returns a new value, so a sound can be reused, shared and rendered many times. State only exists in the Sigil.Sound.IOperator produced by Sigil.Sound.Sound.Compile(Sigil.Sound.RenderContext).
- SoundContext
-
The entry point for live playback: one running output that you Sigil.Sound.SoundContext.Play(Sigil.Sound.Sound,System.Nullable{System.Double}) sounds into and an audio callback (Web Audio, a sound card, a test) pulls frames from with Sigil.Sound.SoundContext.Render(System.Span{Sigil.Sound.StereoFrame}). Every Sigil.Sound.SoundContext.Play(Sigil.Sound.Sound,System.Nullable{System.Double}) hot-swaps what is playing, crossfading from the previous sound.
- Sounds
-
Sources: the starting points of a sound. Designed for
using static Sigil.Sound.Sounds;. - Voice
-
The note a voice is playing, as signals you build a sound from. Each one follows the note that triggered the voice, so
Saw(v.Frequency)plays the right pitch for every note, and the voice is reused without being rebuilt. See Sigil.Sound.Patterns.Play(Sigil.Sound.Pattern,System.Func{Sigil.Sound.Voice,Sigil.Sound.Sound},System.Nullable{System.Double},System.Int32).
Structs
- Arc
-
A stretch of cycle time, from Sigil.Sound.Arc.Begin up to but not including Sigil.Sound.Arc.End.
- CycleSplitter
-
Walks an Sigil.Sound.Arc one cycle at a time without allocating; use it in a
foreach. - Fraction
-
An exact fraction of a cycle. Pattern time is rational so that
Fast(3)followed bySlow(3)lands exactly where it started and a loop does not drift after hours, as floating-point beats would. - Note
-
An immutable note: a MIDI pitch, a velocity in [0, 1] and a length in beats.
- NoteEvent
-
One thing that happens to a note in a Sigil.Sound.NoteStream: it starts, or it ends. Unlike a Sigil.Sound.Note in a pattern, which knows how long it lasts, a live note has no length: it lasts until its Sigil.Sound.NoteEventKind.Off arrives.
- Param
-
A value that drives an operator: a constant, another Sigil.Sound.Sound (audio-rate modulation), or a function of time in seconds. Converts implicitly from all three, so one overload covers them.
- PatternEvent<T>
-
A value placed in time. Sigil.Sound.PatternEvent`1.Whole is the full extent of the event; Sigil.Sound.PatternEvent`1.Part is the piece of it that falls inside the queried arc (a query that cuts an event in two returns two events sharing a whole).
- RenderContext
-
Everything an operator needs to know about the render it belongs to. Passed explicitly when a Sigil.Sound.Sound is compiled; there is no global audio context.
- StereoFrame
-
One stereo sample: a left and a right single-precision value. This is the unit every operator renders.
- TimedNote
-
A note and when it starts, in beats from the start of the pattern.
Interfaces
- IOperator
-
The low-level contract for a running piece of DSP: a compiled, stateful instance produced from a Sigil.Sound.Sound for one Sigil.Sound.RenderContext.
- IResettable
-
Optional: an operator that can return to its just-compiled state without being rebuilt. The engine uses it to reuse note voices without allocating. Built-in operators all implement it, and Sigil.Sound.Sound.Through(System.Func{Sigil.Sound.IOperator,Sigil.Sound.IOperator},System.String) and Sigil.Sound.Operator.From(Sigil.Sound.BlockRenderer,System.Action) forward it for you, so most custom operators never need to.
- ISampleSource
-
Where a host keeps the sample files its scripts can use: a folder, a browser's storage, an asset database. Scripts never see this; they go through Sigil.Sound.SampleLibrary, which only passes on names this source lists.
Enums
- ArpMode
-
How an arpeggio walks through a chord.
- ChordLatch
-
What Sigil.Sound.NoteStream.Chord(System.Double,Sigil.Sound.ChordLatch,Sigil.Sound.ChordSwitch) does when every key is up.
- ChordSwitch
-
When a new chord takes over in Sigil.Sound.NoteStream.Chord(System.Double,Sigil.Sound.ChordLatch,Sigil.Sound.ChordSwitch), the same choices as the AutoArp device.
- ControlCurve
-
How Sigil.Sound.Control.Map(System.Double,System.Double,Sigil.Sound.ControlCurve) spreads the control's range over the output range.
- ControlPolarity
-
What a signal sent to Sigil.Sound.Control.SetFromSignal(System.Double) spans.
- ControlStyle
-
A hint to a host UI about which widget suits a Sigil.Sound.Control. A host may ignore it.
- ControlTaper
-
How a UI's travel (a knob turn or a fader position, 0 to 1) maps onto a Sigil.Sound.Control's value. It describes the hand, not the sound: it never changes what the control does once it has a value, so it is a hint a host UI reads and Sigil.Sound.Control.Travel applies. Compare Sigil.Sound.ControlCurve, which maps a control's value onto another range.
- DistortionMode
-
The curve Sigil.Sound.Sound.Distort(System.Nullable{Sigil.Sound.Param},Sigil.Sound.DistortionMode,System.Nullable{Sigil.Sound.Param}) shapes the signal with.
- FunctionRate
-
How often Sigil.Sound.Sounds.Fn(System.Func{System.Double,System.Double},Sigil.Sound.FunctionRate) runs its function.
- IrNormalize
-
How Sigil.Sound.Sound.Convolve(Sigil.Sound.AudioBuffer,System.Nullable{Sigil.Sound.Param},Sigil.Sound.IrNormalize) scales an impulse response before using it.
- NoteEventKind
-
Whether a Sigil.Sound.NoteEvent starts a note or ends it.
- NotePriority
-
Which note Sigil.Sound.NoteStream.Mono(Sigil.Sound.NotePriority) keeps when several are held.
- PlaybackMode
-
How a Sigil.Sound.Sounds.Sample(Sigil.Sound.AudioBuffer,System.Nullable{Sigil.Sound.Param},Sigil.Sound.PlaybackMode,System.Double,System.Nullable{System.Double}) plays once it reaches its loop end, or the end of the sample.
- QuantizeMode
-
Which scale tone Sigil.Sound.NoteEvent.Snap(Sigil.Sound.Scale,Sigil.Sound.QuantizeMode) picks for a note between two of them.
Delegates
- BlockRenderer
-
The shape of a block renderer written as a lambda; see Sigil.Sound.Operator.From(Sigil.Sound.BlockRenderer). A custom delegate, because System.Span`1 cannot be a type argument of System.Action`1.
- NoteExpander
-
Turns one note into several; see Sigil.Sound.NoteStream.SelectMany(Sigil.Sound.NoteExpander).