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
— Function
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_time
— Function
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.translate
— Function
translate(notes, ticks)
Translate the notes
for the given amount of ticks
. Also works for a single note.
#
Base.transpose
— Function
transpose(notes, semitones)
Transpose the notes
by the given amount of semitones
. Also works for a single note.
#
MusicManipulations.louden
— Function
louden(notes, v::Int)
Change the velocity of the notes by v
(which could also be negative). Also works for a single note.
#
Base.repeat
— Function
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 timesort
ed.
#
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:
#
MusicManipulations.randomnotes
— Function
randomnotes(n::Int, tpq = 960)
Generate some random notes that start sequentially.