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:

MIDI.metric_timeFunction
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.

MIDI.duration_metric_timeFunction
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.

MusicManipulations.translateFunction
translate(notes, ticks)

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

Base.transposeFunction
transpose(notes, semitones)

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

MusicManipulations.loudenFunction
louden(notes, v::Int)

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

Base.repeatFunction
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.

MusicManipulations.timesort!Function
timesort!(notes::Notes)

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


And for getting default notes:

MIDI.testmidiFunction
testmidi()

Return the path to a test MIDI file.

MIDI.testnotesFunction
testnotes()

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