(calculate-duration beats tempo time-scaling & [ms])
Given a number of beats, a tempo, and a time-scaling factor, calculates the duration in milliseconds.
Takes as an optional final argument a number of milliseconds to add to the total.
Given a number of beats, a tempo, and a time-scaling factor, calculates the duration in milliseconds. Takes as an optional final argument a number of milliseconds to add to the total.
(duration & components)
Combines a variable number of tied note-lengths into one.
Note-lengths can be expressed in beats or milliseconds. This distinction is made via the :type key in the map. The number of beats/milliseconds is provided via the :value key in the map.
e.g. (note-length 1) => {:type :beats, :value 4} (ms 4000) => {:type :milliseconds, :value 4000}
To preserve backwards compatibility, a note-length expressed as a simple number (not wrapped in a map) is interpreted as a number of beats.
Barlines can be inserted inside of a duration -- these currently serve a
purpose in the parse tree only, and evaluate to nil
in alda.lisp. This
function ignores barlines by removing the nils.
Returns a map containing the total number of beats (counting only those note-lengths that are expressed in standard musical notation) and the total number of milliseconds (counting only those note-lengths expressed in milliseconds).
This information is used by events (like notes and rests) to calculate the total duration in milliseconds (as this depends on the score's time-scaling factor and the tempo of the instrument the event belongs to).
Combines a variable number of tied note-lengths into one. Note-lengths can be expressed in beats or milliseconds. This distinction is made via the :type key in the map. The number of beats/milliseconds is provided via the :value key in the map. e.g. (note-length 1) => {:type :beats, :value 4} (ms 4000) => {:type :milliseconds, :value 4000} To preserve backwards compatibility, a note-length expressed as a simple number (not wrapped in a map) is interpreted as a number of beats. Barlines can be inserted inside of a duration -- these currently serve a purpose in the parse tree only, and evaluate to `nil` in alda.lisp. This function ignores barlines by removing the nils. Returns a map containing the total number of beats (counting only those note-lengths that are expressed in standard musical notation) and the total number of milliseconds (counting only those note-lengths expressed in milliseconds). This information is used by events (like notes and rests) to calculate the total duration in milliseconds (as this depends on the score's time-scaling factor and the tempo of the instrument the event belongs to).
(ms n)
Represents a duration value specified in milliseconds.
Wraps it in a map to give the duration
function context that we're talking
about milliseconds, not beats.
Represents a duration value specified in milliseconds. Wraps it in a map to give the `duration` function context that we're talking about milliseconds, not beats.
(note-length number)
(note-length number {:keys [dots]})
Converts a number, representing a note type, e.g. 4 = quarter, 8 = eighth, into a number of beats. Handles dots if present.
Wraps the result in a map to give the duration
function context that we're
talking about a number of beats.
Converts a number, representing a note type, e.g. 4 = quarter, 8 = eighth, into a number of beats. Handles dots if present. Wraps the result in a map to give the `duration` function context that we're talking about a number of beats.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close