Документация Engee

Note Tools

Страница в процессе перевода.

This page describes functions that allow you to very conveniently work with and manipulate Note, Notes, and similar for example you can easily translate in time or transpose them in pitch.

The functions velocities, positions, pitches, durations return the respective property when given some Notes.

Other functions follow:

metric_time(midi::MIDIFile,note::AbstractNote)::Float64

Return how many milliseconds elapsed at note position. Matric time calculations need tpq field of MIDIFile. Apparently it only make sense if the note coming from MIDIFile, otherwise you can’t get the correct result.

duration_metric_time(midi::MIDIFile,note::AbstractNote)::Float64

Return note duration time in milliseconds. Matric time calculations need tpq field of MIDIFile. Apparently it only make sense if the note coming from MIDIFile, otherwise you can’t get the correct result.

translate(notes, ticks)

Translate the notes for the given amount of ticks. Also works for a single note.

transpose(notes, semitones)

Transpose the notes by the given amount of semitones. Also works for a single note.

louden(notes, v::Int)

Change the velocity of the notes by v (which could also be negative). Also works for a single note.

repeat(notes, i = 1)

Repeat the notes i times, by successively adding duplicates of notes shifted by the total duration of notes. Return a single Notes container for convenience.

The function assumes that notes are timesorted.

timesort!(notes::Notes)

In-place sort the notes by their temporal position. Use timesort for a non-mutating version.


And for getting default notes:

testmidi()

Return the path to a test MIDI file.

testnotes()

Return a test set of human-played MIDI notes on the piano.

randomnotes(n::Int, tpq = 960)

Generate some random notes that start sequentially.