Liking cljdoc? Tell your friends :D

music-theory.duration


->note-lengthclj/s

(->note-length string)

Given a string representation of a note length, returns its numeric value.

A string representation of a note length consists of a number representing a note value (e.g. '2' = a half note), followed by any number of dots.

e.g. (->note-length '4') => 4 (quarter note) (->note-length '4.') => 2.6666... (dotted quarter note)

Given a string representation of a note length, returns its numeric value.

A string representation of a note length consists of a number representing a
note value (e.g. '2' = a half note), followed by any number of dots.

e.g.
(->note-length '4') =>  4         (quarter note)
(->note-length '4.') => 2.6666... (dotted quarter note)
sourceraw docstring

beatsclj/s

(beats & note-values)

Converts a note value to a number of beats.

e.g. An eighth note has a note value of 8, and equals 0.5 beats. A quarter note has a note value of 4, and equals 1 beat. A half note has a note value of 2, and equals 2 beats. A whole note has a note value of 1, and equals 4 beats.

When given more than one note value, adds them up and returns the sum.

Note values can be provided as either numbers, note-length constants (which are numbers), or strings consisting of an integer note value followed by any number of dots.

A collection of note values (e.g. a measure) is also an acceptable value.

e.g. (beats 1 2 4 8) (beats WHOLE HALF QUARTER EIGHTH) (beats '1.' '2..' 4 SIXTEENTH) (beats [4 4 4 4])

Converts a note value to a number of beats.

e.g.
An eighth note has a note value of 8, and equals 0.5 beats.
A quarter note has a note value of 4, and equals 1 beat.
A half note has a note value of 2, and equals 2 beats.
A whole note has a note value of 1, and equals 4 beats.

When given more than one note value, adds them up and returns the sum.

Note values can be provided as either numbers, note-length constants (which
are numbers), or strings consisting of an integer note value followed by any
number of dots.

A collection of note values (e.g. a measure) is also an acceptable value.

e.g.
(beats 1 2 4 8)
(beats WHOLE HALF QUARTER EIGHTH)
(beats '1.' '2..' 4 SIXTEENTH)
(beats [4 4 4 4])
sourceraw docstring

BREVEclj/s

source

CROTCHETclj/s

source

DEMISEMIQUAVERclj/s

source

dotsclj/s

(dots dots note-length)

Adds dots dots to a note value, returning an 'adjusted' note value.

NOTE: These note values are not expressed in beats, but rather in terms of the denominator of a fraction of a whole note, which is the system used to describe the base note values. In other words, the value of a quarter note is 4 because it equals one quarter (1/4) of a whole note. Mathematically, a single note in a quarter note triplet can be thought of as a 'sixth note' (with a note value of 6) because it equals 1/6 of a whole note.

Dotted notes make for more complicated fractions. The value of a dotted quarter note is 2.666, or 8/3. The value of a double-dotted quarter note is 2.2857..., or 16/7. As more dots are added, the value of the note becomes smaller, asymptotically approaching the next longer note length (which in this case is 2, a half note).

(dots 0 QUARTER) = a quarter note (4) (dots 1 QUARTER) = a dotted quarter note (2.6666...) (dots 2 QUARTER) = a double-dotted quarter note (2.2857...) (dots 3 QUARTER) = a triple-dotted quarter note (2.1333...)

The beats function can be used to convert these adjusted note values into the number of beats.

Adds `dots` dots to a note value, returning an 'adjusted' note value.

NOTE: These note values are not expressed in beats, but rather in terms of
the denominator of a fraction of a whole note, which is the system used to
describe the base note values. In other words, the value of a quarter note
is 4 because it equals one quarter (1/4) of a whole note. Mathematically,
a single note in a quarter note triplet can be thought of as a 'sixth note'
(with a note value of 6) because it equals 1/6 of a whole note.

Dotted notes make for more complicated fractions. The value of a dotted
quarter note is 2.666, or 8/3. The value of a double-dotted quarter note is
2.2857..., or 16/7. As more dots are added, the value of the note becomes
smaller, asymptotically approaching the next longer note length (which in
this case is 2, a half note).

(dots 0 QUARTER) = a quarter note (4)
(dots 1 QUARTER) = a dotted quarter note (2.6666...)
(dots 2 QUARTER) = a double-dotted quarter note (2.2857...)
(dots 3 QUARTER) = a triple-dotted quarter note (2.1333...)

The `beats` function can be used to convert these adjusted note values into
the number of beats.
sourceraw docstring

DOUBLE-WHOLEclj/s

source

dupletclj/s

(duplet & note-lengths)

Applies the duplet ratio 2/3 to each note length and returns the sum of the adjusted note lengths.

Applies the duplet ratio 2/3 to each note length and returns the sum of the
adjusted note lengths.
sourceraw docstring

duration-msclj/s

(duration-ms beats tempo)

Given a number of beats and a tempo, calculates the duration in milliseconds.

Given a number of beats and a tempo, calculates the duration in
milliseconds.
sourceraw docstring

EIGHTHclj/s

source

HALFclj/s

source

HEMIDEMISEMIQUAVERclj/s

source

HUNDRED-TWENTY-EIGHTHclj/s

source

measure?clj/s

(measure? time-signature note-lengths)

Returns true if the provided note-lengths equal exactly one measure in the provided time-signature.

time-signature is represented as a fraction, e.g. 4/4 (or (/ 4 4) in ClojureScript)

note-lengths is a collection of note values, which may be represented as numbers (e.g. 4 is a quarter note), constants (e.g. EIGHTH), or strings consisting of a note value and any number of dots (e.g. '2..')

(measure? 4/4 [4 4 '4..' 16]) => true

Returns true if the provided note-lengths equal exactly one measure in the
provided time-signature.

`time-signature` is represented as a fraction, e.g. 4/4 (or (/ 4 4) in
ClojureScript)

`note-lengths` is a collection of note values, which may be represented as
numbers (e.g. 4 is a quarter note), constants (e.g. EIGHTH), or strings
consisting of a note value and any number of dots (e.g. '2..')

(measure? 4/4 [4 4 '4..' 16]) => true
sourceraw docstring

MINIMclj/s

source

note-length+clj/s

(note-length+ & note-lengths)

Adds together a variable number of note-lengths.

e.g. 4 + 4 = 2 (quarter + quarter = half)

Adds together a variable number of note-lengths.

e.g. 4 + 4 = 2    (quarter + quarter = half)
sourceraw docstring

quadrupletclj/s

(quadruplet & note-lengths)

Applies the quadruplet ratio 4/3 to each note length and returns the sum of the adjusted note lengths.

Applies the quadruplet ratio 4/3 to each note length and returns the sum of
the adjusted note lengths.
sourceraw docstring

QUARTERclj/s

source

QUAVERclj/s

source

quintupletclj/s

(quintuplet & note-lengths)

Applies the quintuplet ratio 5/4 to each note length and returns the sum of the adjusted note lengths.

Applies the quintuplet ratio 5/4 to each note length and returns the sum of
the adjusted note lengths.
sourceraw docstring

SEMIBREVEclj/s

source

SEMIHEMIDEMISEMIQUAVERclj/s

source

SEMIQUAVERclj/s

source

SIXTEENTHclj/s

source

SIXTY-FOURTHclj/s

source

THIRTY-SECONDclj/s

source

tripletclj/s

(triplet & note-lengths)

Applies the triplet ratio 3/2 to each note length and returns the sum of the adjusted note lengths.

Applies the triplet ratio 3/2 to each note length and returns the sum of the
adjusted note lengths.
sourceraw docstring

tupletclj/s

(tuplet ratio & note-lengths)

Applies a tuplet ratio to each note length and returns the sum of the adjusted note lengths.

For more information about tuplets: http://www2.siba.fi/muste1/index.php?id=100&la=en

e.g.:

  • A single quarter note triplet is mathematically a 'sixth note', since six of them will fit into a whole note.
  • A single quarter note triplet therefore has a value of 6, mathematically speaking.
  • From a musician's perspective, a quarter note triplet (as in 3 notes) is three (3) quarter notes stuffed into the duration of a half note (2).
  • The ratio of this type of note is therefore 3/2.
  • Similarly, a 'duplet' (e.g. two eighth notes spread across a bar of 3/8) has a 2/3 ratio. In other words, 4 notes spread across a bar of 6/8 has a 4/6 ratio, which is the same ratio, mathematically.

NOTE: in ClojureScript, ratios must be expressed like (/ 2 3)

(tuplet 2/3 4) => 6 (tuplet 2/3 4 4 4) => 2

Applies a tuplet ratio to each note length and returns the sum of the
adjusted note lengths.

For more information about tuplets:
http://www2.siba.fi/muste1/index.php?id=100&la=en

e.g.:
- A single quarter note triplet is mathematically a 'sixth note', since six
  of them will fit into a whole note.
- A single quarter note triplet therefore has a value of 6, mathematically
  speaking.
- From a musician's perspective, a quarter note triplet (as in 3 notes) is
  three (3) quarter notes stuffed into the duration of a half note (2).
- The ratio of this type of note is therefore 3/2.
- Similarly, a 'duplet' (e.g. two eighth notes spread across a bar of 3/8)
  has a 2/3 ratio. In other words, 4 notes spread across a bar of 6/8 has a
  4/6 ratio, which is the same ratio, mathematically.

NOTE: in ClojureScript, ratios must be expressed like (/ 2 3)

(tuplet 2/3 4) => 6
(tuplet 2/3 4 4 4) => 2
sourceraw docstring

WHOLEclj/s

source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close