Sound.duration

From MiniScript Wiki
Revision as of 06:15, 28 April 2020 by SpatialPlays (talk | contribs)
Jump to navigation Jump to search

Sound.duration controls 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:

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

For tempo, use the standard tempo in beats per minute (BPM) for how fast you want your music to be (for example, a march is typically 120 BPM, Adagio would be around 66-76 BPM, and Allegro would be around 120-168 BPM.)

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