Table of Contents

Class PlayingNote

Namespace
Sigil.Sound
Assembly
Sigil.Sound.Notes.dll

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.

public sealed class PlayingNote

Inheritance

Inherited Members

Examples

// Two notes on the same pitch. One is bent a third of a semitone sharp, so the pair beats slowly.
var keys = new NoteInput();
var synth = keys.Play(v => Saw(v.Frequency).LowPass(1500).Adsr(0.01, 0.1, 0.8, 0.3), polyphony: 4);
var first = keys.Start(57);
var second = keys.Start(57);
second.Bend = 0.33;
synth * 0.3

Remarks

The setters are safe from any thread and take no lock. The sound reads them once per block and glides to the new value (about 10 ms), so a controller sending a few hundred updates a second is heard as a smooth curve, not as steps. The library knows nothing about MIDI: a host that speaks MIDI, a touch screen or a game maps its own gestures onto these three numbers.

A sound shapes itself from the note with the Sigil.Sound.Voice signals Bend, Pressure and Slide; its Frequency and Pitch already follow the bend. A released note keeps listening while it rings out, so a bend can carry on into the release.

Fields

MaxBend

The most a note can be bent either way, in semitones.

public const double MaxBend = 96

Field Value

double

Properties

Bend

How far the note's pitch is moved, in semitones; 0 is the note itself and 12 is an octave up. Clamped to plus or minus Sigil.Sound.PlayingNote.MaxBend. Seen by a voice as v.Bend, and already part of v.Frequency and v.Pitch.

public double Bend { get; set; }

Property Value

double

Exceptions

ArgumentOutOfRangeException

Set to NaN or infinity.

IsHeld

True from Sigil.Sound.NoteInput.Start(System.Int32,System.Single) until Sigil.Sound.PlayingNote.Release (or Sigil.Sound.NoteInput.AllNotesOff).

public bool IsHeld { get; }

Property Value

bool

Pitch

The MIDI pitch the note was started on, 0 to 127.

public int Pitch { get; }

Property Value

int

Pressure

How hard the note is pressed after it started, from 0 to 1. Seen by a voice as v.Pressure. Clamped.

public double Pressure { get; set; }

Property Value

double

Exceptions

ArgumentOutOfRangeException

Set to NaN or infinity.

Slide

A third dimension the player moves the finger along, such as up and down the key, from 0 to 1. Seen by a voice as v.Slide. What it does is up to the sound: brightness is the usual choice. Clamped.

public double Slide { get; set; }

Property Value

double

Exceptions

ArgumentOutOfRangeException

Set to NaN or infinity.

Velocity

How hard the note was started, from 0 to 1.

public float Velocity { get; }

Property Value

float

Methods

Release()

Ends this note only; its voice releases and rings out. Does nothing if the note has already ended.

public void Release()

ToString()

A short description of the note and what the player is doing to it.

public override string ToString()

Returns

string