AM Posted March 21, 2021 Share Posted March 21, 2021 hi all little question: i would like to SORT an (single-event)-list by pitch... and be able to keep the event-data "in the set" (=> the attribute-cents should be bound to pitch!) ((e e4 mf) (e a4 mf) (e d5 mf) (e g5 mf) (e b5 mf) (e d6 mf) (e b4 mf 2c) (e e5 mf 2c) (e a5 mf 2c) (e d6 mf 2c) (e fs6 mf 2c) (e a6 mf 2c) (e e5 mf) (e a5 mf) (e d6 mf) (e g6 mf) (e b6 mf) (e d7 mf) (e gs5 mf -14c) (e cs6 mf -14c) (e fs6 mf -14c) (e b6 mf -14c) (e eb7 mf -14c) (e fs7 mf -14c) (e b5 mf 2c) (e e6 mf 2c) (e a6 mf 2c) (e d7 mf 2c) (e fs7 mf 2c) (e a7 mf 2c) (e d6 mf -31c) (e g6 mf -31c) (e c7 mf -31c) (e f7 mf -31c) (e a7 mf -31c) (e c8 mf -31c) (e e6 mf) (e a6 mf) (e d7 mf) (e g7 mf) (e b7 mf) (e d8 mf)) any solutions? thanx! andré Quote Link to comment Share on other sites More sharing options...
opmo Posted March 21, 2021 Share Posted March 21, 2021 I will see what I can do. Quote Link to comment Share on other sites More sharing options...
AM Posted March 21, 2021 Author Share Posted March 21, 2021 thanx! (i'm doing a little function to get all the natural harmonics for guitar tunings equal tempered or microtonal...) Quote Link to comment Share on other sites More sharing options...
opmo Posted March 21, 2021 Share Posted March 21, 2021 Here it is: (defun sort-to-pitch-events (events sort) (let* ((int (loop for i in events collect (list (pitch-to-integer (second i)) i))) (out (sortcar sort int))) (loop for i in out collect (second i)))) (setf events '((e e4 mf) (e a4 mf) (e d5 mf) (e g5 mf) (e b5 mf) (e d6 mf) (e b4 mf 2c) (e e5 mf 2c) (e a5 mf 2c) (e d6 mf 2c) (e fs6 mf 2c) (e a6 mf 2c) (e e5 mf) (e a5 mf) (e d6 mf) (e g6 mf) (e b6 mf) (e d7 mf) (e gs5 mf -14c) (e cs6 mf -14c) (e fs6 mf -14c) (e b6 mf -14c) (e eb7 mf -14c) (e fs7 mf -14c) (e b5 mf 2c) (e e6 mf 2c) (e a6 mf 2c) (e d7 mf 2c) (e fs7 mf 2c) (e a7 mf 2c) (e d6 mf -31c) (e g6 mf -31c) (e c7 mf -31c) (e f7 mf -31c) (e a7 mf -31c) (e c8 mf -31c) (e e6 mf) (e a6 mf) (e d7 mf) (e g7 mf) (e b7 mf) (e d8 mf))) (sort-to-pitch-events events '>) => ((e d8 mf) (e c8 mf -31c) (e b7 mf) (e a7 mf 2c) (e a7 mf -31c) (e g7 mf) (e fs7 mf -14c) (e fs7 mf 2c) (e f7 mf -31c) (e eb7 mf -14c) (e d7 mf) (e d7 mf 2c) (e d7 mf) (e c7 mf -31c) (e b6 mf) (e b6 mf -14c) (e a6 mf 2c) (e a6 mf 2c) (e a6 mf) (e g6 mf) (e g6 mf -31c) (e fs6 mf 2c) (e fs6 mf -14c) (e e6 mf 2c) (e e6 mf) (e d6 mf) (e d6 mf 2c) (e d6 mf) (e d6 mf -31c) (e cs6 mf -14c) (e b5 mf) (e b5 mf 2c) (e a5 mf 2c) (e a5 mf) (e gs5 mf -14c) (e g5 mf) (e e5 mf 2c) (e e5 mf) (e d5 mf) (e b4 mf 2c) (e a4 mf) (e e4 mf)) (sort-to-pitch-events events '<) => ((e e4 mf) (e a4 mf) (e b4 mf 2c) (e d5 mf) (e e5 mf 2c) (e e5 mf) (e g5 mf) (e gs5 mf -14c) (e a5 mf 2c) (e a5 mf) (e b5 mf) (e b5 mf 2c) (e cs6 mf -14c) (e d6 mf) (e d6 mf 2c) (e d6 mf) (e d6 mf -31c) (e e6 mf 2c) (e e6 mf) (e fs6 mf 2c) (e fs6 mf -14c) (e g6 mf) (e g6 mf -31c) (e a6 mf 2c) (e a6 mf 2c) (e a6 mf) (e b6 mf) (e b6 mf -14c) (e c7 mf -31c) (e d7 mf) (e d7 mf 2c) (e d7 mf) (e eb7 mf -14c) (e f7 mf -31c) (e fs7 mf -14c) (e fs7 mf 2c) (e g7 mf) (e a7 mf 2c) (e a7 mf -31c) (e b7 mf) (e c8 mf -31c) (e d8 mf)) AM 1 Quote Link to comment Share on other sites More sharing options...
AM Posted March 21, 2021 Author Share Posted March 21, 2021 thank you, janusz... i will post the FUNCTION... Quote Link to comment Share on other sites More sharing options...
opmo Posted March 21, 2021 Share Posted March 21, 2021 including cent value in the pitch sort: (defun sort-to-pitch-events (events sort) (do-verbose ("sort-to-pitch-events") (let* ((int (loop for i in events collect (list (+ (* (pitch-to-integer (second i)) 100) (if (null (fourth i)) 0 (read-from-string (remove "c" (write-to-string (fourth i)) :key #'string :test #'equal)))) i))) (out (sortcar sort int))) (loop for i in out collect (second i))))) Quote Link to comment Share on other sites More sharing options...
AM Posted March 21, 2021 Author Share Posted March 21, 2021 here it is... but NOT microtonal. just for equal tempered tunings it was too complicated (and not necessary) for me to code it (with attributes and cents, it's a bit ... ), so i coded it just for my needs ... for equal tempered tunings... could use it for guitar/strings, just to have a list of your SCORDATURA-harmonics to work with. would be interesting if someone could CODE a function which transforms a "sounding-pitch-guitar-score" into the "play-score". so i wouldn't have to do it by hand... where are the guitar players here? julio? janusz? greetings andré (defun sort-to-pitch-events (events sort) (let* ((int (loop for i in events collect (list (pitch-to-integer (second i)) i))) (out (sortcar sort int))) (loop for i in out collect (second i)))) ;;----------------------------------------------------------------------------------- (defun gen-natural-harmonics (openstrings &key (scale nil) (n 16)) (progn (add-text-attributes '(str1 "str1") '(str2 "str2") '(str3 "str3") '(str4 "str4")'(str5 "str5") '(str6 "str6")) (let* ((cent-list (cents-to-attribute '(0 2 0 -14 2 -31 0 4 -14 -49 -2 41 -31 -12 0))) (harmonic (loop for i from 2 to n collect (compress (list 'num i)))) (harmonic-seq (loop for i in openstrings for j in (list 'str6 'str5 'str4 'str3 'str2 'str1) collect (make-omn :pitch (rest (harmonics i n)) :length '(q) :articulation (loop for i in cent-list for x in harmonic collect (if (equal i '-) (compress (list x '+ j)) (compress (list i '+ x '+ j)))) :span :pitch)))) (if (null scale) harmonic-seq (sort-to-pitch-events (single-events (flatten harmonic-seq)) '<))))) ;;----------------------------------------------------------------------------------- ;;----------------------------------------------------------------------------------- ;; attributes: string number + partial number + CENTS ;; sorted by strings (gen-natural-harmonics '(e1 a1 ds2 g2 a2 b2) :n 7) => ((q e2 num2+str6 b2 2c+num3+str6 e3 num4+str6 gs3 -14c+num5+str6 b3 2c+num6+str6 d4 -31c+num7+str6) (q a2 num2+str5 e3 2c+num3+str5 a3 num4+str5 cs4 -14c+num5+str5 e4 2c+num6+str5 g4 -31c+num7+str5) (q eb3 num2+str4 bb3 2c+num3+str4 eb4 num4+str4 g4 -14c+num5+str4 bb4 2c+num6+str4 cs5 -31c+num7+str4) (q g3 num2+str3 d4 2c+num3+str3 g4 num4+str3 b4 -14c+num5+str3 d5 2c+num6+str3 f5 -31c+num7+str3) (q a3 num2+str2 e4 2c+num3+str2 a4 num4+str2 cs5 -14c+num5+str2 e5 2c+num6+str2 g5 -31c+num7+str2) (q b3 num2+str1 fs4 2c+num3+str1 b4 num4+str1 eb5 -14c+num5+str1 fs5 2c+num6+str1 a5 -31c+num7+str1)) ;; sorted by pitch (gen-natural-harmonics '(e1 f1 a1 d2) :n 7 :scale t) => ((q e2 mf num2+str6) (q f2 mf num2+str5) (q a2 mf num2+str4) (q b2 mf 2c+num3+str6) (q c3 mf 2c+num3+str5) (q d3 mf num2+str3) (q e3 mf num4+str6) (q e3 mf 2c+num3+str4) (q f3 mf num4+str5) (q gs3 mf -14c+num5+str6) (q a3 mf -14c+num5+str5) (q a3 mf num4+str4) (q a3 mf 2c+num3+str3) (q b3 mf 2c+num6+str6) (q c4 mf 2c+num6+str5) (q cs4 mf -14c+num5+str4) (q d4 mf -31c+num7+str6) (q d4 mf num4+str3) (q eb4 mf -31c+num7+str5) (q e4 mf 2c+num6+str4) (q fs4 mf -14c+num5+str3) (q g4 mf -31c+num7+str4) (q a4 mf 2c+num6+str3) (q c5 mf -31c+num7+str3)) opmo 1 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 21, 2021 Share Posted March 21, 2021 Oh, André ! I´m very bad at programming.... Sorry But I´m happy you mentioned me ! Best Quote Link to comment Share on other sites More sharing options...
AM Posted March 22, 2021 Author Share Posted March 22, 2021 dear julio i would code it! you could do a "systematic/formalized sketch" (not in LISP) and with that you would try to program a function best a. JulioHerrlein 1 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 22, 2021 Share Posted March 22, 2021 Dear André ! This is much better. I have some imagination But I´d like to know exactly your idea. Do you have a score for playing and another for reading (for the musicians) ? This is what I get from the conversation. And you need to convert the harmonics notes played by sampler into readable material ? All the best ! Julio Quote Link to comment Share on other sites More sharing options...
AM Posted March 22, 2021 Author Share Posted March 22, 2021 i am currently working on a piece for piano, guitar and drums. the guitar will have a "scordatura" so that i can do different harmonics and resonances than with the usual tunings. so that I can now make a more readable score, I would like to write the guitar part on two systems: one system as it sounds and one readable for the guitarist (because of the scordatura/fingerings)... it would be nice if we could do a FUNCTION which transforms the "sounding pitch part" (readable in score) into the "guitar-specific-part" (how to play for guitarist)... Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 22, 2021 Share Posted March 22, 2021 THE GUITAR AS A MATRIX Here is a MIDI Chart I did like 20 years ago... For example, MIDI note #76 appears in all strings (in a 24-fret guitar, for example). There is a color code: 1) BLUE NOTES: Appear just in one location in the TAB. 2) BLACK NOTES: Appear in two locations in the TAB. 3) GREEN NOTES: Appear in 3 locations in the TAB. 4) 2) BLACK NOTES (BIG FONT): Appear in 4 locations in the TAB. 5) 2) PINK NOTES: Appear in 5 locations in the TAB. 6) RED NOTE: Appear in 6 locations (in the case of 24-fret guitars) or 5 times (in the case of 20, 21 or 22-fret guitars). Hope it helps to find a solution. If you are using a different Scordatura, you must build a custom table like that for the specific tuning and maybe a table for the harmonic locations. opmo 1 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 22, 2021 Share Posted March 22, 2021 This is related to locations in the fingerboard (TAB) in a 24-fret neck in standard tuning. Quote Link to comment Share on other sites More sharing options...
AM Posted March 23, 2021 Author Share Posted March 23, 2021 thanks, dear julio, i'll take a look at it, but depending on the situation, programming takes more time than doing it by hand JulioHerrlein 1 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 23, 2021 Share Posted March 23, 2021 Dear André ! Sometimes the hand is faster. But maybe you could just do a simple substitute-map to change "playback" notes to "reading performance" notes and just copy/paste in the files... Just a guess. Best ! Quote Link to comment Share on other sites More sharing options...
AM Posted March 23, 2021 Author Share Posted March 23, 2021 (edited) yes, but i do not compose with OPMO - it's too strange with rhythm/instrumentation/notation. most of the time i'm sketching with OPMO and compose "by hand". guitar-scordatura: i thought i'd rather "pull the pitches out of MIDI/XML" and then convert them.. i will see... but, THANX! greetings andré could look like that (excerpt of a piece for solo trp - also with some SORT-ALGORITHMS inside (sketched/calculated with OPMO) works fine with SIBELIUS for layouting etc... Edited March 23, 2021 by AM edited JulioHerrlein 1 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 23, 2021 Share Posted March 23, 2021 There is a lot of automatic stuff in Finale, by the way. Some macros that helps a lot when finishing stuff. I like to: 1) make enharmonic stuff in Musescore 2) the engraving and dynamics in Finale, because of this automatization process plugins. like this: https://www.scoringnotes.com/tutorials/using-jw-changes-sequence-editor-in-finale-to-automate-tasks/ FREE VERSIONS OF JW PLUGINS Download WWW.FINALETIPS.NU Tips, plug-ins, and other resources for the Finale music notation software. Download WWW.FINALETIPS.NU Tips, plug-ins, and other resources for the Finale music notation software. AM 1 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 23, 2021 Share Posted March 23, 2021 Amazing, beautiful and advanced score, André !! The piece I´m working now is almost entirely done inside Opusmodus. Finding my way, now ! Julio AM 1 Quote Link to comment Share on other sites More sharing options...
torstenanders Posted March 29, 2021 Share Posted March 29, 2021 > I would like to SORT an (single-event)-list by pitch... Apologies for a late response. Anyway, such functionality is actually built into Common Lisp. Hardly any coding required. Just specify a key attribute to the builtin sort function to tell it what data to look at for the sorting -- and specify a sort function. (setf events '((e e4 mf) (e a4 mf) (e d5 mf) (e g5 mf) (e b5 mf) (e d6 mf) (e b4 mf 2c) (e e5 mf 2c) (e a5 mf 2c) (e d6 mf 2c) (e fs6 mf 2c) (e a6 mf 2c) (e e5 mf) (e a5 mf) (e d6 mf) (e g6 mf) (e b6 mf) (e d7 mf) (e gs5 mf -14c) (e cs6 mf -14c) (e fs6 mf -14c) (e b6 mf -14c) (e eb7 mf -14c) (e fs7 mf -14c) (e b5 mf 2c) (e e6 mf 2c) (e a6 mf 2c) (e d7 mf 2c) (e fs7 mf 2c) (e a7 mf 2c) (e d6 mf -31c) (e g6 mf -31c) (e c7 mf -31c) (e f7 mf -31c) (e a7 mf -31c) (e c8 mf -31c) (e e6 mf) (e a6 mf) (e d7 mf) (e g7 mf) (e b7 mf) (e d8 mf))) (sort events #'< :key #'(lambda (event) (pitch-to-integer (second event)))) See also CLHS: Function SORT, STABLE-SORT CLHS.LISP.SE Note that this high level of programming and flexibility is what makes programming with Lisp so fun and productive. There are a bunch of other functions builtin doing other sequence operations on the same high level, like count (http://clhs.lisp.se/Body/f_countc.htm ), find (http://clhs.lisp.se/Body/f_find_.htm ) etc. damian and JulioHerrlein 2 Quote Link to comment Share on other sites More sharing options...
AM Posted March 30, 2021 Author Share Posted March 30, 2021 lieber torsten, herzlichen dank! beste grüsse andré Quote Link to comment Share on other sites More sharing options...
torstenanders Posted March 30, 2021 Share Posted March 30, 2021 I understand that builtin functions of Opusmodus are not working on this level of abstraction / expressive power, as it would be a rather steep learning curve for users, but using and defining functions at this flexibility level reduces the length of your code substantially, which then helps to solve bigger problems by very small teams or individuals. I try to have my own libraries work at this kind of level. JulioHerrlein and AM 2 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 30, 2021 Share Posted March 30, 2021 Vintage LISP teaching (MIT, 1986) KIND OF COOL THING (this guy teaches the way I like) Structure and Interpretation of Computer Programs | Electrical Engineering and Computer Science | MIT OpenCourseWare OCW.MIT.EDU This course introduces students to the principles of computation. Upon completion of 6.001, students should be able to explain and apply the basic methods from programming languages to analyze computational systems, and to generate computational solutions to abstract problems. Substantial weekly programming assignments are an integral part of the course. This course is worth 4 Engineering Design Points. LISP MUSIC opmo 1 Quote Link to comment Share on other sites More sharing options...
torstenanders Posted March 30, 2021 Share Posted March 30, 2021 SICP is a really excellent book! (Even though meanwhile it is not used for teaching at MIT anymore.) What I alluded to above (higher-order functions) is already covered relatively early in the book in section 1.3 (link). This book provides a really solid foundation for programming. If you just study the first two chapters that might already be enough for your purposes (well organising code for algorithmic composition). (Fun fact: I read this book during our honey moon ~20 years ago.) Note that the book uses the (smaller & more clean) Lisp dialect Scheme, instead of Common Lisp (which is a huge language, a unification effort of multiple Lisp dialects that includes features of multiple older Lisp dialects). Opusmodus is based on Common Lisp. If you want to study higher-order functions and other matters directly for Common Lisp, there are of course also suitable books, e.g., Practical Common Lisp. Functions incl. higher-order functions are discussed in chapter 5 (link). opmo and JulioHerrlein 1 1 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted March 30, 2021 Share Posted March 30, 2021 Thanks, Torsten !! Best ! Quote Link to comment Share on other sites More sharing options...
torstenanders Posted March 31, 2021 Share Posted March 31, 2021 If you are looking for something fun to read that still covers the big ideas, there is also The Little Schemer (and a number of related books). Note that this book again uses Scheme for clarity, but the fundamental ideas are the same in Common Lisp. Some incomplete preview: https://books.google.com/books?id=xyO-KLexVnMC&printsec=frontcover&dq=the+little+schemer&hl=en&sa=X&ved=2ahUKEwi8ysjBndrvAhXU_7sIHXmKBmkQ6AEwA3oECAIQAg#v=onepage&q=the little schemer&f=false Quote: What you need to know to read this book.The reader must be comfortable reading English, recognizing numbers, and counting. JulioHerrlein 1 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.