AM Posted April 11, 2017 Share Posted April 11, 2017 dear all i'll try to code a function that overwrites the SEQ with an insert after a pattern-match... not so simple, because to calculate all the length-values in the SEQ so that there ist no "shifting" ist very.... here an easy sketch... but with a simple, so that i haven't got to calculate (beacuse all is mapped on quaternotes)... i hope anyone could CODE that... would be an interesting FUNCTION!!! using things as a NET!! compare -> seq with the function output... the you see the idea (setf seq '(e c4 -e -q q d4 -q s c4 -e. -h. q)) (setf insert '(3q c4 d4 e4 c4 d4 e4 c4 d4 -3q)) (setf insert-span (loop for i in (omn :length insert) sum (abs i))) (progn (setf new-list (loop for i in (single-events seq) with match = 0 when (pattern-matchp i '(q d4 ?)) do (setf match 1) when (= match 1) collect (abs (car (omn :length i))) into bag when (and (= match 1) (<= (sum bag) insert-span)) collect (* -1 (abs (car (omn :length i)))) else collect i )) (flatten (loop for x in new-list with match = 0 when (and (atom x) (= match 0)) collect insert and do (setf match 1) when (listp x) collect x))) Quote Link to comment Share on other sites More sharing options...
opmo Posted April 11, 2017 Share Posted April 11, 2017 (setf map '(((q d4 ?) (3q c4 d4 e4 c4 d4 e4 c4 d4 -3q)))) (pattern-map map '(e c4 -e -q q d4 -q s c4 -e. -h. q)) => (e c4 -e -q 3q c4 d4 e4 c4 d4 e4 c4 d4 -3q s c4 -e. -h. q) Quote Link to comment Share on other sites More sharing options...
AM Posted April 11, 2017 Author Share Posted April 11, 2017 sorry, but this would be easy (for beginners ) ...but that's not correct because it is INSERTRED and not OVERWRITED... there is NO function in OM that's doing this. greetings from "helmut" ...because if you want work with "strukturnetze" you have to keep the NET correct and not to shift the time values (how it is with pattern-map)... so you have to overwrite Quote Link to comment Share on other sites More sharing options...
opmo Posted April 11, 2017 Share Posted April 11, 2017 You need to explain the process a bit better. Should the span after the process stay of the original sequence? Is the insert (which it is) should complete the span with there own loop etc... All this is simple to code if the process is known :-) added 7 minutes later Your example: ;; seq (e c4 -e -q q c4 -q s c4 -e. q) ;; insert (3q c4 d4 e4 c4 d4 e4 c4 d4) ;; pattern-match (q c4) result in block (e c4 -e -q) (3q c4 d4 e4 c4 d4 e4 c4 d4) (-3q q c4) from where is the last list coming from? Quote Link to comment Share on other sites More sharing options...
AM Posted April 11, 2017 Author Share Posted April 11, 2017 an example: Quote Link to comment Share on other sites More sharing options...
opmo Posted April 11, 2017 Share Posted April 11, 2017 This example (above) is simple insert. I like you to explain this: (e c4 -e -q) (3q c4 d4 e4 c4 d4 e4 c4 d4) (-3q q c4) from where is the last list coming from? Quote Link to comment Share on other sites More sharing options...
AM Posted April 11, 2017 Author Share Posted April 11, 2017 last list is THE END of the original seq! last quarternote (which is not overwrited by the insert) Quote Link to comment Share on other sites More sharing options...
opmo Posted April 11, 2017 Share Posted April 11, 2017 How we come to the length: -3q in the last list. this (the rest of the original seq): -q s c4 -e. q needs to be replaced, how? Quote Link to comment Share on other sites More sharing options...
opmo Posted April 11, 2017 Share Posted April 11, 2017 What will happen if there are few matches: (q d4 ?) (setf seq '(e c4 -e -q q d4 -q s q d4 c4 e. q d4 h. q)) (setf insert '(3q c4 d4 e4 c4 d4 e4 c4 d4 -3q)) Quote Link to comment Share on other sites More sharing options...
AM Posted April 11, 2017 Author Share Posted April 11, 2017 i think it has to works in GENERATIONS added 2 minutes later my result is.... with my code is... (no sublists) (e c4 mf -e -q 3q c4 d4 e4 c4 d4 e4 c4 d4 -3q -h. q c4 mf) Quote Link to comment Share on other sites More sharing options...
opmo Posted April 11, 2017 Share Posted April 11, 2017 (setf seq '(e c4 -e -q q d4 -q s q d4 c4 e. q d4 h. q)) (setf insert '(3q c4 d4 e4 c4 d4 e4 c4 d4 -3q)) (setf insert-span (get-span insert)) (setf match '(q d4 ?)) Your code returns: (e c4 mf -e -q 3q c4 d4 e4 c4 d4 e4 c4 d4 -3q q d4 mf q c4 mf e. c4 mf q d4 mf h. d4 mf q d4 mf) ? Quote Link to comment Share on other sites More sharing options...
AM Posted April 11, 2017 Author Share Posted April 11, 2017 sorry but with this code - evaluating all i have... only for THIS input-seq ... you input-seq seems different (setf seq '(e c4 -e -q q d4 -q s c4 -e. -h. q)) (setf insert '(3q c4 d4 e4 c4 d4 e4 c4 d4 -3q)) (setf insert-span (loop for i in (omn :length insert) sum (abs i))) (progn (setf new-list (loop for i in (single-events seq) with match = 0 when (pattern-matchp i '(q d4 ?)) do (setf match 1) when (= match 1) collect (abs (car (omn :length i))) into bag when (and (= match 1) (<= (sum bag) insert-span)) collect (* -1 (abs (car (omn :length i)))) else collect i )) (flatten (loop for x in new-list with match = 0 when (and (atom x) (= match 0)) collect insert and do (setf match 1) when (listp x) collect x))) => (e c4 mf -e -q 3q c4 d4 e4 c4 d4 e4 c4 d4 -3q -h. q c4 mf) Quote Link to comment Share on other sites More sharing options...
opmo Posted April 11, 2017 Share Posted April 11, 2017 My question is what will happen if there are few matches in a sequence and not only one. Quote Link to comment Share on other sites More sharing options...
AM Posted April 11, 2017 Author Share Posted April 11, 2017 i see 4 possibilities... 1) you could work in generations => only 1 match per gen => but it could end in a stack overflow (when it's recursiv, when match is also inside the insert) 2) could overwrite in generations from last to first match -> means right to left in the list (but not with matches inside the insert) => so when it's more then one match it will be overlapping 3) could generate overlaying voices by few matches 4) you could limited it by &key :nooverlapping 't added 4 minutes later if it will work, i wll code a nice example for OM to present it Quote Link to comment Share on other sites More sharing options...
AM Posted April 18, 2017 Author Share Posted April 18, 2017 ... in the future... do exist such a function in OM...? greetings andré 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.