Jorgalad Posted March 10, 2020 Share Posted March 10, 2020 Hi Everyone, I'm looking for a method/function which changes the velocity only for notes that are repeating. In other words, if I have a sequence like this: '(c4 eb4 g4 ab4 ab4 ab4 d4 eb4) I would like to be able to create a crescendo/decrescendo or set a custom velocity for just the Ab notes. In the past I've customised a Pattern Matching function from Stephane to change the velocity for specific note lengths: (defun velocity-map-omn (map omn &key (otherwise '-)) (do-verbose ("velocity-map-omn") (let ((plist (disassemble-omn omn))) (setf (getf plist :velocity) (pattern-map map (getf plist :length) :otherwise otherwise :swallow t)) (apply 'make-omn plist)))) And I think this should be very close to what I want, however, I have no idea how to tell OM to process repeating notes only. Is there anyone who already has a function like this or can steer me in the right direction? Hope this makes sense, any help is very welcome! - Jor Quote Link to comment Share on other sites More sharing options...
AM Posted March 10, 2020 Share Posted March 10, 2020 like that..?... some code... greetings andré (defun replace-velocities-in-a-seq (omn-list &key pitch velocity-list) (flatten (loop with cnt = 0 for i in (single-events omn-list) when (equal (cadr i) pitch) collect (omn-replace :velocity (nth cnt velocity-list) i) and do (incf cnt) else collect i when (> cnt (length velocity-list)) do (setf cnt 0)))) (replace-velocities-in-a-seq '(e c4 ppppp d4 d4 e4 f4 d4 d4 g4 b4 d4 d4 d4 d4) :pitch 'd4 :velocity-list '(p mp mf f ff)) ;=> (e c4 ppppp e d4 p e d4 mp e e4 ppppp e f4 ppppp e d4 mf e d4 f e g4 ppppp e b4 ppppp e d4 ff e d4 ppppp e d4 p e d4 mp) ;; if there are more 'd4's then velocity-values, -> it starts again with first velocity-value (= cycle) Stephane Boussuge and Jorgalad 2 Quote Link to comment Share on other sites More sharing options...
Jorgalad Posted March 11, 2020 Author Share Posted March 11, 2020 Wow that's amazing, I've looked at this for 15 minutes now and I think I gained a few braincells. Learning a lot from these examples, exactly what I needed as well, thanks so much! Quote Link to comment Share on other sites More sharing options...
AM Posted March 12, 2020 Share Posted March 12, 2020 you're welcome!! i think for specific solutions it helps a lot to learn some LISP-basics (loops/conditionals/car/cons/...), then you have the possibility to make your own additional functions/libraries in OPMO. and OPMO is really great for such things!! greetings andré Quote Link to comment Share on other sites More sharing options...
Jorgalad Posted March 13, 2020 Author Share Posted March 13, 2020 Thanks André, this is still on my list, I definitely see the benefits in learning LISP. If you have specific sources (books/links/videos) that you think are good places to start, please feel free to share - Jor Quote Link to comment Share on other sites More sharing options...
AM Posted March 13, 2020 Share Posted March 13, 2020 in german... https://www.amazon.de/Programmieren-COMMON-LISP-Otto-Mayer/dp/3860257102 (but without LOOP) https://www.tutorialspoint.com/lisp/index.htm https://lisptips.com https://www.youtube.com/channel/UCMV8p6Lb-bd6UZtTc_QD4zA Jorgalad 1 Quote Link to comment Share on other sites More sharing options...
torstenanders Posted March 14, 2020 Share Posted March 14, 2020 http://www.gigamonkeys.com/book/ Common Lisp Books | Common Lisp LISP-LANG.ORG Books about Common Lisp For a more music-related introduction to Common Lisp you might want to look at the following books. These books teach algorithmic composition with Common Lisp. The above books introducing only Common Lisp are far more comprehensive on that matter, but you might prefer learning some foundations first within a musical context. Morgan, N. & Legard, P. (2015) Parametric Composition: Computer-Assisted Strategies for Human Performance. West Yorkshire, UK: Tonality Systems Press. Sorry! Something went wrong! WWW.AMAZON.COM Introduces Opusmodus along with some Lisp. Taube, H. (2004) Notes from the Metalevel. London and New York: Taylor & Francis. Sorry! Something went wrong! WWW.AMAZON.COM Code examples online: http://www.moz.ac.at/sem/lehre/lib/cm/Notes from the Metalevel/00/contents.html This book introduces the algorithmic composition system Common Music, along with Lisp fundamentals. Algorithmic Composition: A Gentle Introduction to Music Composition Using Common LISP and Common Music https://quod.lib.umich.edu/s/spobooks/bbv9810.0001.001/1:3/--algorithmic-composition-a-gentle-introduction-to-music?rgn=div1;view=fulltext I have not read this one... AM 1 Quote Link to comment Share on other sites More sharing options...
torstenanders Posted March 14, 2020 Share Posted March 14, 2020 The best document combining both worlds is likely the following. This was an internal textbook of the algorithmic composition teacher Paul Berg at the Sonology course at the Royal Conservatory of The Hague (the author of the composition system AC Toolbox, https://www.actoolbox.net), but it is unprinted, just a copy of a text processor document for internal use, and difficult to obtain (I only have a hard copy I got from a friend). Berg, Paul (n.d.) Elements of Design. An introduction to Programming with Common Lisp. AM and opmo 2 Quote Link to comment Share on other sites More sharing options...
Jorgalad Posted March 18, 2020 Author Share Posted March 18, 2020 Thanks a lot, some great resources! I've started with just the very basics and working my way through Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.