Class MidiImportOptions
Options controlling MIDI import into a NoteBuffer.
public sealed record MidiImportOptions : IEquatable<MidiImportOptions>
- Inheritance
-
MidiImportOptions
- Implements
- Inherited Members
Remarks
SortByOffset used to change nothing. The notes were fetched from the whole file already merged in time order, and the sort that false skipped was a stable sort of a sequence already in that order, so a caller who asked for the file's own order got the merged one and had no way to tell.
The percussion channel used to be imported like any other. A drum track is note-ons and note-offs like a piano track, so its hits came into the buffer as pitches — a closed hi-hat is note number 42, an F# — and the commonest file there is, a piano track with a drum track under it, key-detected as F# minor when the piano was in C major.
Constructors
MidiImportOptions(int?, int?, bool, bool)
Options controlling MIDI import into a NoteBuffer.
public MidiImportOptions(int? Channel = null, int? MaxNotes = null, bool SortByOffset = true, bool IncludePercussion = false)
Parameters
Channelint?If set, keep only notes on this MIDI channel. Setting it to 9 asks for the percussion channel by name and gets it, whatever
IncludePercussionsays.MaxNotesint?If set, stop after importing this many notes — the first so many in the order
SortByOffsetchooses.SortByOffsetbooltrue, the default, merges every track into one sequence in time order, so the buffer comes back ready for GetChords(). false keeps the order the file lists the notes in: each track chunk in turn, its notes in the order they occur within it, so a melody track and a bass track come out one after the other rather than interleaved.
IncludePercussionboolNotes on the General MIDI percussion channel (channel 10, index 9) are instrument numbers, not pitches, and are left out unless this is set. true imports them as the note numbers they carry, for a caller who wants every note-on the file holds.
Remarks
SortByOffset used to change nothing. The notes were fetched from the whole file already merged in time order, and the sort that false skipped was a stable sort of a sequence already in that order, so a caller who asked for the file's own order got the merged one and had no way to tell.
The percussion channel used to be imported like any other. A drum track is note-ons and note-offs like a piano track, so its hits came into the buffer as pitches — a closed hi-hat is note number 42, an F# — and the commonest file there is, a piano track with a drum track under it, key-detected as F# minor when the piano was in C major.
Properties
Channel
If set, keep only notes on this MIDI channel. Setting it to 9 asks
for the percussion channel by name and gets it, whatever
IncludePercussion says.
public int? Channel { get; init; }
Property Value
- int?
IncludePercussion
Notes on the General MIDI percussion channel (channel 10, index 9) are instrument numbers, not pitches, and are left out unless this is set. true imports them as the note numbers they carry, for a caller who wants every note-on the file holds.
public bool IncludePercussion { get; init; }
Property Value
MaxNotes
If set, stop after importing this many notes — the first so many in
the order SortByOffset chooses.
public int? MaxNotes { get; init; }
Property Value
- int?
SortByOffset
true, the default, merges every track into one sequence in time order, so the buffer comes back ready for GetChords(). false keeps the order the file lists the notes in: each track chunk in turn, its notes in the order they occur within it, so a melody track and a bass track come out one after the other rather than interleaved.
public bool SortByOffset { get; init; }