torstenanders Posted April 3, 2017 Share Posted April 3, 2017 It is great that we meanwhile have user-defined attributes, but I sometimes like to add some ad-hoc text to the score without the need to first define them -- without any impact on the playback. This can be useful, e.g., to add rehearsal marks, various expressions and playing techniques, chord symbols, fingerings, or details for live electronics control. Beyond that, I like adding analytical information to the resulting score to inform later manual revisions, e.g., labelling motifs and perhaps even their transformation, adding custom chord and scale names etc. Doing this with user-defined attributes is kind of OK, but it could be more convenient to add certain texts to single notes, without announcing it to the system in general first. Therefore, I defined a little function that does just that. However, this function currently works only in a few cases. We can add multiple integers or floats above a note, without registering them first (useful, e.g., as parameters for live electronics). `(q ,(text-attribute -7 2 3.14 1000)) ; try notating this note => (q -7+2+3.14+1000) Here is the actual definition. (defun text-attribute (&rest args) "Convenient addition of arbitrary text directly the the score. Function transforms an arbitrary symbol, number or string or a list of symbols, numbers and strings into a an articulation symbol that is implicitly registered and can directly be added to an OMN note." (flet ((text-attr (x) (let ((s (format nil "~A" x))) (list (intern s) s)))) (merge-articulations (apply #'add-text-attributes (mapcar #'text-attr args))))) The definition depends on some other function I shared here before, but include again for convenience. (defun merge-articulations (arts &key (empty-articulations '(- default))) "Merges list of OMN articulations to a combined attribute. Args: arts: a list of OMN articulations empty-attributes: articulations to ignore in a combination. Examples: (merge-articulations '(ten ponte ubow)) => ten+ponte+ubow (merge-articulations '(- stacc)) => stacc" (intern (reduce #'(lambda (a1 a2) (format nil "~A+~A" a1 a2)) (mappend #'(lambda (art) (unless (some #'(lambda (a) (eq art a)) empty-articulations) (list (symbol-name art)))) arts)))) I would like to use the above scheme more generally, but that does not work yet. Here are a few examples that cause problems, but that I would like to see work. These examples are correctly translated into the corresponding symbols, but when trying to notate them OMN parse fails. ;; Works when symbol is registered separately, but seemingly cannot be registered "behind the scene" `(q ,(text-attribute 'espressivo)) ;; With a single expression like above, it could be argued that they can be registered explicitly with add-text-attributes, but for more specific texts this does not necessarily make sense, as they may be used only once `(q ,(text-attribute "like a whisper")) ;; Rehearsal mark (NOTE: individual letter symbols can cause confusion and should likely be avoided, e.g., "F" is understandably misunderstood by systemas dynamic mark) `(q ,(text-attribute "A")) `(q ,(text-attribute "r A")) ; rehearsal mark trying to avoid confusion with dynamic marks ;; Indications for live electronics -- using purely numbers might be OK to a certain degree `(q ,(text-attribute "delay 100ms")) `(q ,(text-attribute 'delay 100)) ;; Chord symbols need to be distinguishable from note names, hence the underscore here (could also be a space perhaps) `(q ,(text-attribute "C_7")) Strangely, on my system the following is turned into a second quarter note, even though the symbol test is unbound and not registered as a user attribute. `(q ,(text-attribute 'test)) Other applications might cause principle problems with what OMN expressions the system can parse. For example, if we use single numbers (useful, e.g., for fingering instructions) then these are misinterpreted as note durations. `(q ,(text-attribute 1)) `(q ,(text-attribute 1/4)) Single floats cause errors again. `(q ,(text-attribute 3.14)) Janusz: Is there perhaps a way to make some more of the examples above working? Also, I hope that there is no problem in calling add-text-attributes several times with the same symbol? I guess you store the total of all symbols in some data structure (e.g., a hash table) that prevents having them added multiple times? Thanks! Best, Torsten Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.