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.)
 
m
Line 2: Line 2:
  
 
== Musician's Note ==
 
== Musician's Note ==
Mini Micro does not by default give you duration in musical terms. A good function for calculating this is the formula:
+
Mini Micro does not by default give you duration in musical terms. A good function for calculating this is:
 
      
 
      
 
<ms>CalculateNote = function(tempo, noteValue)
 
<ms>CalculateNote = function(tempo, noteValue)
 
     60 / tempo * noteValue
 
     60 / tempo * noteValue
 
end function</ms>
 
end function</ms>
 +
 +
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 value can be determined by the type of note you want to reproduce:

Revision as of 23:26, 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:

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