You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Take the variable concept and apply it to entire files.
For example, each instrument's part could be written in a separate file in the same directory as a main file, then in the main file (say, "score.alda"), you could write something like:
and each of these statements would be replaced by the contents of each file at compile time.
This would be especially cool in that you could define custom instruments (e.g. custom synth instruments) as standalone files and then load them in as modules in any piece of music in which you'd like to use them.
NOTE: Modules might be a little tricky to implement and preserve line numbers for error reporting. Ideally we'd be able to report the line/column number and name of the file where the error occurred.
A more recent insight:
For modules, I never really liked the &filename.alda syntax I came up with. Now that we can leverage inline Clojure code, maybe it should just be (load-module "/path/to/file.alda") and/or (load-score "/path/to/file.alda")
Interestingly, since inline Clojure code evaluation was added, it has been possible to load Clojure code from other files (via clojure.core/load-file), which is great in itself and gets us halfway there. load-module could read Alda (and by extension, Clojure) code from a file and parse and evaluate it within the context of the current score. Instrument parts and even rudimentary plugins could thus be written and distributed as .alda files.
An open question I have is how load-file and load-module will handle relative paths. Ideally, it will be possible to distribute Alda scores as folders containing multiple .alda files, as git repos, etc. So, relative paths should ideally be interpreted relative to the score they're written in, not the user's current working directory.
The text was updated successfully, but these errors were encountered:
The original idea which I proposed in #7:
A more recent insight:
Interestingly, since inline Clojure code evaluation was added, it has been possible to load Clojure code from other files (via
clojure.core/load-file
), which is great in itself and gets us halfway there.load-module
could read Alda (and by extension, Clojure) code from a file and parse and evaluate it within the context of the current score. Instrument parts and even rudimentary plugins could thus be written and distributed as.alda
files.An open question I have is how
load-file
andload-module
will handle relative paths. Ideally, it will be possible to distribute Alda scores as folders containing multiple.alda
files, as git repos, etc. So, relative paths should ideally be interpreted relative to the score they're written in, not the user's current working directory.The text was updated successfully, but these errors were encountered: