SoundSequence#
A tracker sequence: rows are ticks (BPM and rows per beat set their length); tracks of note columns play instruments from a table of up to 255 slots (00 to FE); patterns hold the grid, played in the Order. One short pattern is a stinger; a song is several patterns in an order. Cells use the note language of Note. ToText and Parse give a plain-text form for writing, diffing and review.
public sealed class SoundSequenceMembers: AddPattern · AddTrack · BeatsPerBar · Bpm · Effects · EnvironmentSend · Instruments · Loop · MaxInstruments · Name · Order · Parse · Patterns · RemoveTrack · RowSeconds · Rows · RowsPerBeat · Seconds · SoundSequence · ToText · TotalRows · Tracks · Validate
AddPattern#
public SequencePattern AddPattern(int rows = 64);Add an empty pattern (it plays once listed in Order); returns it.
AddTrack#
public SequenceTrack AddTrack(string name, int instrument, int columns = 1);Add a track playing an instrument slot, with 1 to 12 note columns.
BeatsPerBar#
public int BeatsPerBar { get; set; }Beats in a bar: groups rows for display only.
Bpm#
public float Bpm { get; set; }Effects#
public EffectChain? Effects { get; set; }An effect chain the whole sequence's sound runs through, once (null: none).
EnvironmentSend#
public float EnvironmentSend { get; set; }The share of its sound sent to the Environment bus (the scene's reverb), 0 to 1.
Instruments#
public SoundAsset? [] Instruments { get; }Initial value: new SoundAsset?[MaxInstruments]
The instrument table: slot → Sound (null for an empty slot).
Loop#
public bool Loop { get; set; }Initial value: true
Start again after the order's end (otherwise it plays once and its last notes ring out).
MaxInstruments#
public const int MaxInstruments = 255, MaxColumns = 12, MaxRows = 4096, MaxPatterns = 256, MaxOrder = 1024;Name#
public string Name { get; set; }Initial value: "Sequence"
Order#
public List<int> Order { get; }Initial value: [0]
Patterns in the order they play, by index (a new sequence plays pattern 0 once).
Parse#
public static SoundSequence Parse(string text, Func<string, SoundAsset?> resolve);Read the text form. resolve maps an instrument name to a Sound (null when unknown, which is an error). Throws FormatException naming the line and what is wrong.
Patterns#
public List<SequencePattern> Patterns { get; }Initial value: new()
The patterns; a new sequence has one of 64 rows.
RemoveTrack#
public void RemoveTrack(SequenceTrack track);Remove a track and its cells in every pattern.
RowSeconds#
public double RowSeconds { get; }Seconds per row: 60 / (BPM × rows per beat).
Rows#
public int Rows { get; set; }Rows of the first pattern (a single-pattern sequence's length).
RowsPerBeat#
public int RowsPerBeat { get; set; }How many rows make a beat (4: each row is a sixteenth note in 4/4).
Seconds#
public double Seconds { get; }SoundSequence#
public SoundSequence();ToText#
public string ToText(Func<SoundAsset, string>? instrumentName = null);The sequence as plain text. Instruments are written by name (instrumentName, default the Sound's name); a reader resolves names back to Sounds. Every row is written (empty cells as dashes) so the grid reads as one. A single pattern played once is written plainly (rows in the header, then pattern); otherwise each pattern is pattern NN rows and the order line lists them. bpm 120 rows-per-beat 4 beats-per-bar 4 rows 8 loop yes instruments 00 Kick tracks Drums 00 1 vol -3 pan -0.2 pattern 00 C-4 01 ---
TotalRows#
public int TotalRows { get; }Rows played once through the order.
Tracks#
public List<SequenceTrack> Tracks { get; }Initial value: new()
Validate#
public void Validate();Checks the order names existing patterns (throws InvalidOperationException naming the entry).
Related types#
EffectChain · SequencePattern · SequenceTrack · SoundAsset
Source#
- SoundSequence.cs