A library for common manipulations of
Confirms that the given NoteSequence has been quantized by absolute time.
Confirms that the given NoteSequence has been quantized.
Confirms that the given NoteSequence has been quantized relative to tempo.
Create an empty quantized NoteSequence with steps per quarter note and tempo.
The number of steps per quarter note to use.
The tempo to use.
A new quantized NoteSequence.
Returns whether the given NoteSequence has been quantized by absolute time.
Returns whether or not a NoteSequence proto has been quantized.
Returns whether the given NoteSequence has been quantized relative to tempo.
Any consecutive notes of the same pitch are merged into a sustained note. Does not merge notes that connect on a measure boundary. This process also rearranges the order of the notes - notes are grouped by instrument, then ordered by timestamp.
NoteSequence to be merged.
NoteSequence with sustained notes merged.
Assign instruments to the notes, pitch bends, and control changes of a
NoteSequence based on program numbers and drum status. All drums will be
assigned the last instrument (and program 0). All non-drum events with the
same program number will be assigned to a single instrument.
NoteSequence for which to merge instruments. Will not be
A copy of
ns with merged instruments.
Quantize a NoteSequence proto relative to tempo.
The input NoteSequence is copied and quantization-related fields are
populated. Sets the
steps_per_quarter field in the
message in the NoteSequence.
Note start and end times, and chord times are snapped to a nearby quantized
step, and the resulting times are stored in a separate field (e.g.,
QuantizedStartStep). See the comments above
QUANTIZE_CUTOFF for details
on how the quantizing algorithm works.
NoteSequence to quantize.
Each quarter note of music will be divided into this many quantized time steps.
A copy of the original NoteSequence, with quantized times added.
Quantizes seconds to the nearest step, given steps_per_second.
See the comments above
QUANTIZE_CUTOFF for details on how the
quantizing algorithm works.
Seconds to quantize.
Value to use for quantizing cutoff.
the quantized step.
Replaces all the notes in an input sequence that match the instruments in
a second sequence. For example, if
replaceSequence has notes that all have
instrument=1, then any notes in
with instruments 0 or 1 will be removed and replaced with the notes in
replaceSequence. If there are instruments in
replaceSequence that are
originalSequence, they will not be added.
NoteSequence to be changed.
NoteSequence that will replace the notes in
sequence with the same instrument.
NoteSequence with the instruments replaced.
Splits a quantized
NoteSequence into smaller
equal chunks. If a note splits across a chunk boundary, then it will be
split between the two chunks.
Silent padding may be added to the final chunk to make it
The number of steps per chunk. For example, if you want to split the sequence into 2 bar chunks, then if the sequence has 4 steps/quarter, that will be 32 steps for each 2 bars (so a chunkSize of 32).
An array of
NoteSequences each of which are at most
Calculates steps per second given stepsPerQuarter and a QPM.
Trim notes from a NoteSequence to lie within a specified time range.
Notes starting before
start are not included. Notes ending after
end are not included, unless
truncateEndNotes is true.
The NoteSequence for which to trim notes.
The time after which all notes should begin. This should be either seconds (if ns is unquantized), or a quantized step (if ns is quantized).
The time before which all notes should end. This should be either seconds (if ns is unquantized), or a quantized step (if ns is quantized).
Optional. If true, then notes starting before the end time but ending after it will be included and truncated.
A new NoteSequence with all notes trimmed to lie between
end, and time-shifted to begin at 0.
Create an unquantized version of a quantized
Any existing times will be replaced in the output
quantization info and steps will be removed.
The tempo to use. If not provided, the tempo in
ns is used,
or the default of 120 if it is not specified in the sequence either.
a new non-quantized
NoteSequence with time in seconds.
Generated using TypeDoc