Section Durations

Durations utility functions

Summary

Return typeFunction and summary
numberduration_256th_of_quarter_to_ms(int nbOf256th, number tempo)
Convert 256ths of quarter to milliseconds, according to tempo.
intduration_256th_of_quarter_to_percent_of_note(int nbOf256th, int noteDuration, number tempo)
Convert 256ths of quarter to a percentage of a note duration, according to tempo.
intduration_ms_to_256th_of_quarter(number milliseconds, int noteDuration, number tempo)
Convert at duration in milliseconds to 256th of quarter, according to tempo
intduration_ms_to_note(number milliseconds, number tempo)
Convert a duration in milliseconds to a note duration according to tempo.
intduration_ms_to_percent_of_note(number milliseconds, int noteDuration, number tempo)
Convert a duration in milliseconds to a percentage of a note duration, according to tempo.
numberduration_note_to_ms(int noteDuration, number tempo)
Convert a note duration to milliseconds, according to tempo.
intduration_percent_of_note_to_256th_of_quarter(int nbOf256th, int noteDuration, number tempo)
Convert a percentage of a note duration to 256ths of quarter, according to tempo.
numberduration_percent_of_note_to_ms(int percent, int noteDuration, number tempo)
Convert a percentage of note duration to milliseconds, according to tempo.

Functions

duration_note_to_ms(int noteDuration, number tempo)

Convert a note duration to milliseconds, according to tempo.

ParameterTypeDefaultDescription
noteDurationint  
temponumber  
Return
number: Rounded to 3 decimals
Error
if noteDuration is nil, if tempo is nil or <= 0

duration_ms_to_note(number milliseconds, number tempo)

Convert a duration in milliseconds to a note duration according to tempo.

ParameterTypeDefaultDescription
millisecondsnumber  
temponumber  
Return
int: A note duration, comparable to DURATION_QUARTER and other constants in MSDefine
Error
if milliseconds is nil, or tempo is nil or <= 0

duration_percent_of_note_to_ms(int percent, int noteDuration, number tempo)

Convert a percentage of note duration to milliseconds, according to tempo.

ParameterTypeDefaultDescription
percentint  
noteDurationint  
temponumber  
Return
number: Rounded to 3 decimals
Error
if percent is nil, if noteDuration is nil, if tempo is nil or <= 0

duration_ms_to_percent_of_note(number milliseconds, int noteDuration, number tempo)

Convert a duration in milliseconds to a percentage of a note duration, according to tempo.

ParameterTypeDefaultDescription
millisecondsnumber  
noteDurationint  
temponumber  
Return
int: Percent of noteDuration
Error
if milliseconds is nil, if noteDuration is nil, if tempo is nil or <= 0

duration_256th_of_quarter_to_ms(int nbOf256th, number tempo)

Convert 256ths of quarter to milliseconds, according to tempo.

ParameterTypeDefaultDescription
nbOf256thint  
temponumber  
Return
number: Rounded to 3 decimals
Error
if nbOf256th is nil, if tempo is nil or <= 0

duration_ms_to_256th_of_quarter(number milliseconds, int noteDuration, number tempo)

Convert at duration in milliseconds to 256th of quarter, according to tempo

ParameterTypeDefaultDescription
millisecondsnumber  
noteDurationint  
temponumber  
Return
int: 256th of quarter
Error
if milliseconds is nil, if noteDuration is nil, if tempo is nil or <= 0

duration_256th_of_quarter_to_percent_of_note(int nbOf256th, int noteDuration, number tempo)

Convert 256ths of quarter to a percentage of a note duration, according to tempo.

ParameterTypeDefaultDescription
nbOf256thint  
noteDurationint  
temponumber  
Return
int:
Error
if nbOf256th is nil, if noteDuration is nil, if tempo is nil or <= 0

duration_percent_of_note_to_256th_of_quarter(int nbOf256th, int noteDuration, number tempo)

Convert a percentage of a note duration to 256ths of quarter, according to tempo.

ParameterTypeDefaultDescription
nbOf256thint  
noteDurationint  
temponumber  
Return
int:
Error
if nbOf256th is nil, if noteDuration is nil, if tempo is nil or <= 0