Jump to content

Adding free text to the score output


Recommended Posts

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

Link to comment
Share on other sites

I would stick with ADD-TEXT-ATTRIBUTES and with unique names (hash table).

Just add your specific list of the attributes at the beginning of each of your score (no need to add them to the Extensions folder).

(add-text-attributes
 '(esp "espressivo")
 '(law "like a whisper")
 '(n3.14 "3.14")
 '(pc4 "C4")
 '(n3.14-pc4 "C4 3.14")
 '(delay100 "delay 100")
 '(s1 "-7 2 3.14 1000")
 '(rq "1/4")
 '(n1 "1"))

Examples:
(q c4 n3.14+delay100+s1)
(q c4 n3.14+delay100)
(q c4 n3.14+pc4)
(q c4 n3.14-pc4)
(q c4 law)
(q c4 n1)
(q c4 rq)
(q c4 s1)

 

The attribute must work with midi, musicxml and omn. This is why the solution '(name string) is the must reliable way to create/add new attributes to the system - less errors :smile:

Link to comment
Share on other sites

Fair enough.  In order to avoid further complicating OMN, it makes sense to stick to unique symbols and to avoid "numbers as symbols" etc.

 

Good point also that these attributes can be piece-specific simply by adding their "registration" to the score file :)

 

Thanks for your help!

 

Best,

Torsten

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy