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_time
— Functionmetric_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_time
— Functionduration_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.translate
— Functiontranslate(notes, ticks)
Translate the notes
for the given amount of ticks
. Also works for a single note.
Base.transpose
— Functiontranspose(notes, semitones)
Transpose the notes
by the given amount of semitones
. Also works for a single note.
MusicManipulations.louden
— Functionlouden(notes, v::Int)
Change the velocity of the notes by v
(which could also be negative). Also works for a single note.
Base.repeat
— Functionrepeat(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 timesort
ed.
MusicManipulations.timesort!
— Functiontimesort!(notes::Notes)
In-place sort the notes
by their temporal position. Use timesort
for a non-mutating version.
And for getting default notes:
MIDI.testmidi
— Functiontestmidi()
Return the path to a test MIDI file.
MIDI.testnotes
— Functiontestnotes()
Return a test set of human-played MIDI notes on the piano.
MusicManipulations.randomnotes
— Functionrandomnotes(n::Int, tpq = 960)
Generate some random notes that start sequentially.