Difference between revisions of "Sound.duration"

From MiniScript Wiki
Jump to navigation Jump to search
(Created Sound.duration, and included a function on how to convert musical notation into time for musicians.)
(No difference)

Revision as of 23:21, 27 April 2020

Sound.duration controls for how long a sound will play in seconds.

Musician's Note

Mini Micro does not by default give you duration in musical terms. A good function for calculating this is the formula:

CalculateNote = function(tempo, noteValue)
    60 / tempo * noteValue
end function

Note value can be determined by the type of note you want to reproduce:

Note Type Value
Sixteenth Note 0.25
Eighth Note 0.5
Quarter Note 1.0
Half Note 2.0
Whole Note 4.0

Dotted notes take the value of the original note and adds half to it:

Note Type Value
Dotted Sixteenth Note 0.375
Eighth Note 0.75
Dotted Quarter Note 1.5
Dotted Half Note 3.0
Dotted Whole Note 6.0

Triplets, likewise, are 1/3 of the value above it (so a triplet eighth note is a third the value of a quarter note):

Note Type Value
Triplet Sixteenth Note 0.165
Triplet Eighth Note 0.333
Triplet Quarter Note 0.667
Triplet Half Note 1.333

See also: Sound.init