if you like to change dynamics/velocity of specific lengths
(defun replace-velocity-of-a-length (omnseq length/velocity-map) (loop for i in (single-events (flatten omnseq)) when (length-restp (car i)) collect i else append (omn-replace :velocity (cadr (assoc (car (omn :length i)) length/velocity-map)) i))) (setf omn-seq '(s c4 ffff e e s e. s q q q q q)) (replace-velocity-of-a-length omn-seq '((1/16 mp) (2/16 pp) (3/16 ppp))) => (s c4 mp e c4 pp e c4 pp s c4 mp e. c4 ppp s c4 mp q c4 ffff q c4 ffff q c4 ffff q c4 ffff q c4 ffff)
if you want to change VELOCITY of a technique...
(defun replace-velocity-of-a-technique (omn-list &key technique velocity) (flatten (loop for i in (single-events omn-list) when (equal (car (omn :articulation i)) technique) collect (pattern-map (list (list (list '? technique) (list velocity technique))) i) else collect i))) (replace-velocity-of-a-technique '(e. c4 p tasto d4 ponte e4) :technique 'tasto :velocity 'f)
I would like to algorithmically generate dynamic markings with dynamic indications like mp plus hairpins. The code snippet below shows vector values created with custom envelopes that I would like to translate, and the function velocity-to-dynamic almost does that for me already (vector-to-velocity is primarily there to translate a vector into a list).
#(0.0 0.07936508 0.15873016 0.23809525 0.31746033 0.39682543 0.4761905 0.5555556 0.63492066 0.71428573 0.79365087 0.8730159 0.952381 0.9259259 0.74074066 0.5555556 0.37037033 0.18518525 0.0)))
My problem is that velocity-to-dynamic creates lots of intermediate dynamic indications, where instead I would prefer a long hairpin connecting only the extreme dynamic indications. Instead of
(pppp< < ppp< pp< < p< < mp< mf< < f< < ff> > mf> mp> p> ppp> pppp)
I would like to get something like the following result, which is much clearer for the performer.
(pppp< < < < < < < < < < < < ff> > > > > > pppp)
Would it be possible to revise velocity-to-dynamic accordingly, or should I better roll my own? Thanks!
EDIT: On second thought, a separate function would likely be better, because that can then be used for all functions that generate hairpins, e.g., also gen-dynamic.
PS: A remaining problem would be how to handle rests, where hairpins will be interrupted. A possible solution could be to keep the output of velocity-to-dynamic as is, and instead be able to specify that the final score generation leaves out intermediate dynamic markings as those shown above, but keeps them for rests. However, that might be tricky to implement. Leaving the proper handling of rests to users and instead to simplify the output of velocity-to-dynamic with a new function is much simpler.