Liking cljdoc? Tell your friends :D

alda.lisp

alda.parser transforms Alda code into Clojure code, which can then be evaluated with the help of this namespace.

alda.parser transforms Alda code into Clojure code, which can then be
evaluated with the help of this namespace.
raw docstring

*attribute-table*clj

source

*initial-attr-vals*clj

source

absolute-offsetclj

(absolute-offset this score)

Returns the offset in ms from the start of the score.

Returns the offset in ms from the start of the score.
sourceraw docstring

add-eventclj

(add-event {:keys [instruments events markers] :as score}
           {:keys [instrument offset] :as event})
source

add-eventsclj

(add-events score events)
source

add-note-or-restclj

(add-note-or-rest {:keys [beats-tally beats-tally-default instruments
                          voice-instruments current-voice]
                   :as score}
                  {:keys [beats] :as event})
source

alda-codeclj

(alda-code code)

Attempts to parse a string of text within the context of the current score; if the code parses successfully, the result is one or more events that are spliced into the score.

Attempts to parse a string of text within the context of the current score;
if the code parses successfully, the result is one or more events that are
spliced into the score.
sourceraw docstring

ALDA-LISP-LOADEDclj

source

apply-attributeclj

(apply-attribute {:keys [beats-tally] :as score} inst attr val)

Given an instrument map, a keyword representing an attribute, and a value, returns the updated instrument with that attribute update applied.

Given an instrument map, a keyword representing an attribute, and a value,
returns the updated instrument with that attribute update applied.
sourceraw docstring

apply-global-attributesclj

(apply-global-attributes)

For each instrument in :current-instruments, looks between the instrument's :last-offset and :current-offset and applies any attribute changes occurring within that window.

Both global and per-instrument attributes are applied; in the case that a per-instrument attribute is applied at the exact same time as a global attribute, the per-instrument attribute takes precedence for that instrument.

For each instrument in :current-instruments, looks between the instrument's
:last-offset and :current-offset and applies any attribute changes occurring
within that window.

Both global and per-instrument attributes are applied; in the case that a
per-instrument attribute is applied at the exact same time as a global
attribute, the per-instrument attribute takes precedence for that instrument.
sourceraw docstring

at-markerclj

(at-marker name)

Set the marker at which events will be added.

Set the marker at which events will be added.
sourceraw docstring

barlineclj

(barline)

Barlines, at least currently, do nothing when evaluated in alda.lisp.

Barlines, at least currently, do nothing when evaluated in alda.lisp.
sourceraw docstring

calculate-durationclj

(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.
sourceraw docstring

chordclj

(chord & events)

Causes every instrument in :current-instruments to play each note in the chord simultaneously at the instrument's :current-offset.

Causes every instrument in :current-instruments to play each note in the
chord simultaneously at the instrument's :current-offset.
sourceraw docstring

continueclj

(continue score & body)

Continues the score represented by the score map score, evaluating the events in body and returning the completed score.

Continues the score represented by the score map `score`, evaluating the
events in `body` and returning the completed score.
sourceraw docstring

continue!clj

(continue! score-atom & body)

Convenience function for dealing with Alda scores stored in atoms.

(continue! my-score (part "bassoon" (note (pitch :c))))

is short for:

(swap! my-score continue (part "bassoon" (note (pitch :c))))

Convenience function for dealing with Alda scores stored in atoms.

(continue! my-score
  (part "bassoon"
    (note (pitch :c))))

is short for:

(swap! my-score
       continue
       (part "bassoon"
         (note (pitch :c))))
sourceraw docstring

cramclj

(cram & events)

A cram expression evaluates the events it contains, time-scaled based on the inner tally of beats in the events and the outer durations of each current instrument.

A cram expression evaluates the events it contains, time-scaled based on the
inner tally of beats in the events and the outer durations of each current
instrument.
sourceraw docstring

defattributecljmacro

(defattribute attr-name & things)

Convenience macro for setting up attributes.

Convenience macro for setting up attributes.
sourceraw docstring

determine-midi-noteclj

(determine-midi-note {:keys [letter accidentals midi-note]}
                     octave
                     key-sig
                     transpose)

Determines the MIDI note number of a note, within the context of an instrument's octave and key signature.

Determines the MIDI note number of a note, within the context of an
instrument's octave and key signature.
sourceraw docstring

durationclj

(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).
sourceraw docstring

end-voice-groupclj

(end-voice-group score)
source

end-voicesclj

(end-voices)

By default, the score remains in 'voice mode' until it reaches an end-voices event. This is so that if an instrument part ends with a voice group, the same voices can be appended later if the part is resumed, e.g. when building a score gradually in the Alda REPL or in a Clojure process.

The end-voices event is emitted by the parser when it parses 'V0:'.

By default, the score remains in 'voice mode' until it reaches an end-voices
event. This is so that if an instrument part ends with a voice group, the
same voices can be appended later if the part is resumed, e.g. when building
a score gradually in the Alda REPL or in a Clojure process.

The end-voices event is emitted by the parser when it parses 'V0:'.
sourceraw docstring

get-attrclj

(get-attr kw)

Given a keyword representing an attribute (which could be an alias, e.g. :quant for :quantization), returns the attribute map, which includes the attribute's keyword name (e.g. :quantization) and its transform function.

The transform function is a higher-order function which takes a new, user-friendly value (e.g. 100 instead of 1.0) and returns the function to apply to an instrument's existing value to update it to the new value. (See alda.lisp.attributes for examples of transform functions.)

Throws an exception if the argument supplied is not a valid keyword name or alias for an existing attribute.

Given a keyword representing an attribute (which could be an alias, e.g.
:quant for :quantization), returns the attribute map, which includes the
attribute's keyword name (e.g. :quantization) and its transform function.

The transform function is a higher-order function which takes a new,
user-friendly value (e.g. 100 instead of 1.0) and returns the function to
apply to an instrument's existing value to update it to the new value.
(See alda.lisp.attributes for examples of transform functions.)

Throws an exception if the argument supplied is not a valid keyword name
or alias for an existing attribute.
sourceraw docstring

get-variableclj

(get-variable var-name)

Returns any number of events previously defined as a variable.

Returns any number of events previously defined as a variable.
sourceraw docstring

global-attributeclj

(global-attribute attr val)

Public fn for setting global attributes in a score. e.g. (global-attribute :tempo 100)

Public fn for setting global attributes in a score.
e.g. (global-attribute :tempo 100)
sourceraw docstring

global-attributesclj

(global-attributes & attrs)

Convenience fn for setting multiple global attributes at once. e.g. (global-attributes :tempo 100 :volume 50)

Convenience fn for setting multiple global attributes at once.
e.g. (global-attributes :tempo 100 :volume 50)
sourceraw docstring

instrumentsclj

source

instruments-all-at-same-offsetclj

(instruments-all-at-same-offset {:keys [current-instruments instruments]
                                 :as score})

If all of the :current-instruments are at the same absolute offset, returns that offset. Returns nil otherwise.

(Returns 0 if there are no instruments defined yet, e.g. when placing a marker or a global attribute at the beginning of a score.)

If all of the :current-instruments are at the same absolute offset, returns
that offset. Returns nil otherwise.

(Returns 0 if there are no instruments defined yet, e.g. when placing a
 marker or a global attribute at the beginning of a score.)
sourceraw docstring

key-sigclj

(key-sig x__13746__auto__)
source

key-sig!clj

(key-sig! x__13747__auto__)
source

key-signatureclj

(key-signature x__13746__auto__)
source

key-signature!clj

(key-signature! x__13747__auto__)
source

log-attribute-changeclj

(log-attribute-change {:keys [id] :as inst} attr old-val new-val)
source

markerclj

(marker name)

Places a marker at the current absolute offset. Throws an exception if there are multiple instruments active at different offsets.

Places a marker at the current absolute offset. Throws an exception if there
are multiple instruments active at different offsets.
sourceraw docstring

metric-modulationclj

(metric-modulation old new)

Express tempo in terms of metric modulation, where the new note takes the same amount of time (one beat) as the old note. (e.g. (metric-modulation "4." 2) means that the new length of a half note equals the length of a dotted quarter note in the previous measure)

Express tempo in terms of metric modulation, where the new note takes the
same amount of time (one beat) as the old note.
(e.g. (metric-modulation "4." 2) means that the new length of a half note
equals the length of a dotted quarter note in the previous measure)
sourceraw docstring

metric-modulation!clj

(metric-modulation! old new)

Global version of metric-modulation.

Global version of `metric-modulation`.
sourceraw docstring

midi->hzclj

(midi->hz ref-pitch note)

Converts a MIDI note number to the note's frequency in Hz.

Converts a MIDI note number to the note's frequency in Hz.
sourceraw docstring

midi-noteclj

(midi-note note-number)
source

msclj

(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.
sourceraw docstring

new-scoreclj

(new-score)
source

non-percussion-instrumentsclj

A list of the 128 instruments in the General MIDI spec, in order.

Each instrument is represented as a vector where the first item is the "official"/preferred name to be used in the Alda instrument list, and is followed by recognized aliases.

A list of the 128 instruments in the General MIDI spec, in order.

Each instrument is represented as a vector where the first item is the
"official"/preferred name to be used in the Alda instrument list, and is
followed by recognized aliases.
sourceraw docstring

noteclj

(note pitch)
(note pitch x)
(note {:keys [letter accidentals midi-note]} {:keys [beats ms slurred]} slur?)

Causes every instrument in :current-instruments to play a note at its :current-offset for the specified duration.

If no duration is specified, the note is played for the instrument's own internal duration, which will be the duration last specified on a note or rest in that instrument's part.

Causes every instrument in :current-instruments to play a note at its
:current-offset for the specified duration.

If no duration is specified, the note is played for the instrument's own
internal duration, which will be the duration last specified on a note or
rest in that instrument's part.
sourceraw docstring

note-lengthclj

(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.
sourceraw docstring

octaveclj

(octave x__13746__auto__)
source

octave!clj

(octave! x__13747__auto__)
source

Offsetcljprotocol

source

offset+clj

(offset+ this bump)

Returns a new offset bump ms later.

Returns a new offset bump ms later.
sourceraw docstring

offset<=clj

(offset<= score & offsets)

Convenience fn for determining if offsets are in order.

Convenience fn for determining if offsets are in order.
sourceraw docstring

offset=clj

(offset= score & offsets)

Convenience fn for comparing absolute/relative offsets.

Convenience fn for comparing absolute/relative offsets.
sourceraw docstring

panclj

(pan x__13746__auto__)
source

pan!clj

(pan! x__13747__auto__)
source

panningclj

(panning x__13746__auto__)
source

panning!clj

(panning! x__13747__auto__)
source

partclj

(part instrument-call & events)

Determines the current instrument instance(s) based on the instrument-call and evaluates the events within that context.

instrument-call can either be a map containing :names and an optional :nickname (e.g. {:names ['piano' 'trumpet'] :nickname ['trumpiano']}) or a valid Alda instrument call string, e.g. 'piano/trumpet 'trumpiano''.

Determines the current instrument instance(s) based on the `instrument-call`
and evaluates the `events` within that context.

`instrument-call` can either be a map containing :names and an optional
:nickname (e.g. {:names ['piano' 'trumpet'] :nickname ['trumpiano']}) or a
valid Alda instrument call string, e.g. 'piano/trumpet 'trumpiano''.
sourceraw docstring

pauseclj

(pause & [{:keys [beats ms] :as dur}])

Causes every instrument in :current-instruments to rest (not play) for the specified duration.

If no duration is specified, each instrument will rest for its own internal duration, which will be the duration last specified on a note or rest in that instrument's part.

Causes every instrument in :current-instruments to rest (not play) for the
specified duration.

If no duration is specified, each instrument will rest for its own internal
duration, which will be the duration last specified on a note or rest in
that instrument's part.
sourceraw docstring

percussion-instrumentsclj

There is only one percussion instrument: midi-percussion

This is a definition of that instrument that has the same shape as non-percussion-instruments.

There is only one percussion instrument: midi-percussion

This is a definition of that instrument that has the same shape as
`non-percussion-instruments`.
sourceraw docstring

pitchclj

(pitch letter & accidentals)
source

quantclj

(quant x__13746__auto__)
source

quant!clj

(quant! x__13747__auto__)
source

quantizationclj

(quantization x__13746__auto__)
source

quantization!clj

(quantization! x__13747__auto__)
source

quantizeclj

(quantize x__13746__auto__)
source

quantize!clj

(quantize! x__13747__auto__)
source

reference-pitchclj

(reference-pitch x__13746__auto__)
source

reference-pitch!clj

(reference-pitch! x__13747__auto__)
source

scoreclj

(score & body)

Initializes a new score, evaluates the events contained in body (updating the score accordingly) and returns the completed score.

A score and its evaluation context are effectively the same thing. This means that an evaluated score can be used as an input to continue, which returns an updated score.

Initializes a new score, evaluates the events contained in `body` (updating
the score accordingly) and returns the completed score.

A score and its evaluation context are effectively the same thing. This
means that an evaluated score can be used as an input to `continue`, which
returns an updated score.
sourceraw docstring

set-attributeclj

(set-attribute attr val)

Public fn for setting attributes in a score. e.g. (set-attribute :tempo 100)

Public fn for setting attributes in a score.
e.g. (set-attribute :tempo 100)
sourceraw docstring

set-attributesclj

(set-attributes & attrs)

Convenience fn for setting multiple attributes at once. e.g. (set-attributes :tempo 100 :volume 50)

Convenience fn for setting multiple attributes at once.
e.g. (set-attributes :tempo 100 :volume 50)
sourceraw docstring

set-durationclj

(set-duration x__13746__auto__)
source

set-duration!clj

(set-duration! x__13747__auto__)
source

set-note-lengthclj

(set-note-length length)

Sets note duration in terms of alda note-lengths (e.g. quarter note = 4, dotted note = "4.")

Sets note duration in terms of alda note-lengths
(e.g. quarter note = 4, dotted note = "4.")
sourceraw docstring

set-tempoclj

(set-tempo x__13746__auto__)
source

set-tempo!clj

(set-tempo! x__13747__auto__)
source

set-variableclj

(set-variable var-name & events)

Defines any number of events as a variable so that they can be referenced by name.

Defines any number of events as a variable so that they can be referenced by
name.
sourceraw docstring

tempoclj

(tempo val)
(tempo note-length val)

Multi-arity function that allows for an additional parameter to represent the tempo in terms of non-quarter notes (e.g.(tempo 2 60) <--> (tempo 120)).

Multi-arity function that allows for an additional parameter to represent
the tempo in terms of non-quarter notes (e.g.(tempo 2 60) <--> (tempo 120)).
sourceraw docstring

tempo!clj

(tempo! val)
(tempo! note-length val)

Global version of tempo.

Global version of `tempo`.
sourceraw docstring

timesclj

(times n event)

Repeats an Alda event (or sequence of events) n times. Also implements the alternate endings function. Takes as input a sequence of events optionally paired with which repetitions they play in. If no repetition position is specified for a certain event, then that event will play during all repetitions. e.g. (times 4 [[[1 3] note1] [[2] [note2 note3]] note4]) results in [[note1 note4] [note2 note3 note4] [note1 note4] [note4]]

Repeats an Alda event (or sequence of events) `n` times.
Also implements the alternate endings function. Takes as input a sequence of
events optionally paired with which repetitions they play in. If no
repetition position is specified for a certain event, then that event will
play during all repetitions.
e.g. (times 4 [[[1 3] note1] [[2] [note2 note3]] note4]) results in
     [[note1 note4] [note2 note3 note4] [note1 note4] [note4]]
sourceraw docstring

track-volclj

(track-vol x__13746__auto__)
source

track-vol!clj

(track-vol! x__13747__auto__)
source

track-volumeclj

(track-volume x__13746__auto__)
source

track-volume!clj

(track-volume! x__13747__auto__)
source

transposeclj

(transpose x__13746__auto__)
source

transpose!clj

(transpose! x__13747__auto__)
source

transpositionclj

(transposition x__13746__auto__)
source

transposition!clj

(transposition! x__13747__auto__)
source

tuning-constantclj

(tuning-constant x__13746__auto__)
source

tuning-constant!clj

(tuning-constant! x__13747__auto__)
source

update-master-tempo-valuesclj

(update-master-tempo-values score)

In an Alda score, each part has its own tempo and it can differ from the other parts' tempos.

Nonetheless, we need to maintain a notion of a single "master" tempo in order to support features like MIDI export.

A score has exactly one part whose role is the tempo "master".

The master tempo is derived from local tempo attribute changes for this part, as well as global tempo attribute changes.

In an Alda score, each part has its own tempo and it can differ from the
other parts' tempos.

Nonetheless, we need to maintain a notion of a single "master" tempo in
order to support features like MIDI export.

A score has exactly one part whose role is the tempo "master".

The master tempo is derived from local tempo attribute changes for this part,
as well as global tempo attribute changes.
sourceraw docstring

update-scoreclj

(update-score score event)

Events in Alda are represented as maps containing, at the minimum, a value for :event-type to serve as a unique identifier (by convention, a keyword) to be used as a dispatch value.

An Alda score S-expression simply reduces update-score over all of the score's events, with the initial score state as the initial value to be reduced.

Lists/vectors are a special case -- they are reduced internally and treated as a single 'event sequence'.

Events in Alda are represented as maps containing, at the minimum, a value
for :event-type to serve as a unique identifier (by convention, a keyword)
to be used as a dispatch value.

An Alda score S-expression simply reduces `update-score` over all of the
score's events, with the initial score state as the initial value to be
reduced.

Lists/vectors are a special case -- they are reduced internally and treated
as a single 'event sequence'.
sourceraw docstring

update-score*cljmultimethod

See update-score.

See `update-score`.
sourceraw docstring

voiceclj

(voice voice-number & events)

One voice in a voice group.

One voice in a voice group.
sourceraw docstring

volclj

(vol x__13746__auto__)
source

vol!clj

(vol! x__13747__auto__)
source

volumeclj

(volume x__13746__auto__)
source

volume!clj

(volume! x__13747__auto__)
source

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

× close