alda-clj is a Clojure library for algorithmic music composition and live-coding with Alda.
A simple Clojure DSL provides useful functions like note
and chord
that can
be composed together to create a musical score. The resulting values are
translated into a string of Alda code and played in a subprocess via the alda
command line client.
alda-clj is intended to be used in at least two ways:
-
In an improv / live-coding setting, using a live Clojure REPL to generate and play music on the fly.
-
In a music composition setting, where the composition is a Clojure program / script that uses alda-clj to generate a score.
NOTE: alda-clj requires Alda version 2.0.0 or greater.
- If you haven't already, install Alda and make sure
alda
is available on yourPATH
.
alda-clj will shell out and use
alda
(wherever it's found on yourPATH
) to play your scores. If desired, you can specify an alternatealda
executable by bindingalda.core/*alda-executable*
to something else, e.g."/home/dave/Downloads/some-other-alda"
.
- Add the latest release version of alda-clj to your dependencies:
;; deps.edn
io.djy/alda-clj {:mvn/version "X.X.X"}
;; lein/boot
[io.djy/alda-clj "X.X.X"]
- Require
alda.core
and you're off to the races!
(require '[alda.core :refer :all])
(play!
(part "piano")
(for [notes [[:c :e :g] [:c :f :a] [:c :e :g]]]
(apply chord (map #(note (pitch %)) notes))))
API documentation, a Getting Started guide and more are available at cljdoc.
There are also example scripts in this repo that will give you a sense of what you can do with alda-clj.
Ping @dave
on Slack if you have any questions or if
you just want to chat about alda-clj!
Copyright © 2018-2023 Dave Yarwood
Distributed under the Eclipse Public License version 2.0.