rcadiz Posted August 29, 2023 Share Posted August 29, 2023 Hi! If I have an omn sequence including pitches, lengths, and articulations is there any way to change events into rests? Some kind of procedure of "filtering out" (silencing) some notes in either a deterministic or random fashion. Thanks! Rodrigo Quote Link to comment Share on other sites More sharing options...
Stephane Boussuge Posted August 30, 2023 Share Posted August 30, 2023 Hi Rodrigo, You can use the function length-to-rest: (length-to-rest 'e '(q c4 e cs4 e d4 s e4 f4 fs4 g4 q gs4 e a4 s bb4 b4) :swallow nil :type 'under) => (q c4 -e - -s - - - q cs4 -e -s -) You can use length-rest-series: (length-rest-series '(1 2 1 3 2 4) '((1/8 1/8 1/8) (1/4 1/4 1/4 1/4 1/4) (1/16 1/16 1/16 1/16))) => ((1/8 -1/8 1/8) (1/4 -1/4 1/4 -1/4 1/4) (1/16 1/16 -1/16 1/16)) you may also use the wonderful density function. to display just few possibilities... Best ! S. Quote Link to comment Share on other sites More sharing options...
Stephane Boussuge Posted August 30, 2023 Share Posted August 30, 2023 And i forgot to mention: length-weight (setf mat '((e. gs4 mf e g4 g4 e. eb4 e e4 eb4 fs4) (e. e4 mf eb4 fs4 d4 q f4) (e. f4 mf e g4 gs4 e. bb4 e e4 gs4 d4) (h e4 mf gs4))) (setf with-rest (length-weight mat)) Also the Opusmodus binary functions could help a lot to build some process to "restify" some notes. SB. Quote Link to comment Share on other sites More sharing options...
opmo Posted August 31, 2023 Share Posted August 31, 2023 New function rnd-rest in version 3.0.29077 (setf lengths (gen-repeat 8 1/16)) => (1/16 1/16 1/16 1/16 1/16 1/16 1/16 1/16) (rnd-rest 2 lengths) => (1/16 1/16 1/16 -1/16 1/16 -1/16 1/16 1/16) (rnd-rest 5 lengths) => (-1/16 -1/16 1/16 -1/16 -1/16 -1/16 1/16 1/16) (rnd-rest '(2 3 1 2 1 3 2 1) '((1/10 1/10 1/10 1/10 1/10) (1/6 1/6 1/6) (1/16 1/16 1/16 1/16 1/16 1/16 1/16 1/16) (1/16 1/16 1/16 1/16) (1/20 1/20 1/20 1/20 1/20) (1/6 1/6 1/6) (1/10 1/10 1/10 1/10 1/10) (1/10 1/10 1/10 1/10 1/10) (1/6 1/6 1/6) (1/6 1/6 1/6) (1/10 1/10 1/10 1/10 1/10) (1/16 1/16 1/16 1/16) (1/16 1/16 1/16 1/16) (1/6 1/6 1/6) (1/6 1/6 1/6) (1/10 1/10 1/10 1/10 1/10) (1/10 1/10 1/10 1/10 1/10)) :omn t) => ((-5h - = = =) (-3h - -) (s - = = = = = =) (-s = - =) (5q - = = =) (-3h - -) (-5h = = = -) (5h - = = =) (-3h = -) (-3h - -) (5h - = = =) (s - = -) (s = - =) (-3h - -) (-3h = -) (-5h = = = =) (5h - = - =)) (setf omn '((q c5gs4f4 e f5c5gs4 e gs5f5c5 s c6gs5f5) (e c6eb5 c5eb4 e eb4c4 eb5c5) (q b4g4d4 e g4d4b3 s d4b3g3 b3g3d3 q g3d3b2))) (rnd-rest 2 omn :seed 11) => ((-q -e gs5f5c5 mf s c6gs5f5) (-e - eb4c4 mf eb5c5) (q b4g4d4 mf e g4d4b3 s d4b3g3 - -q)) AM and Stephane Boussuge 1 1 Quote Link to comment Share on other sites More sharing options...
AM Posted August 31, 2023 Share Posted August 31, 2023 very nice, like a SIEVE!! if it would be like: (rnd-rest '(8 7 6 5 4 3 2 1) omn-seq) you could manage the event-density in time... or... (rnd-rest '(0.1 0.2 0.23 0.4 0.7 0.6 0.3 0.43 0.91) omn-seq) ...perhaps also with (gen-envelope-tendency) (or something like that just a spontanious idea Stephane Boussuge and opmo 2 Quote Link to comment Share on other sites More sharing options...
rcadiz Posted September 1, 2023 Author Share Posted September 1, 2023 This is great! Thanks! However, I am trying to understand better how to use this function. What I actually don't understand is the significance of the parameter n and why it must be an integer. If I set n to 1 it should erase only one note from the omn sequence, right? This is not what I am seeing. This is an example of what I mean. (setf mat '((5q e2 ff stacc+marc e4 mf e2 ff stacc+marc) (5q fs2 mf d4 fs2) (5q a2 mf c4 a2) (5q b2 mf a3 b2) (5q cs3 mf g3 cs3) (5q c4 mf stacc c4 stacc c4 stacc c4 stacc c4 stacc) (5q b2 mf a3 b2) (5q a2 mf c4 a2) (5q fs2 mf d4 fs2) (5q e2 ff stacc+marc e4 mf e2 ff stacc+marc) (5q f2 mf eb4 f2) (5q g2 mf cs4 g2) (5q bb2 mf bb3 bb2) (5q c3 mf gs3 c3) (5q eb3 mf fs3 eb3) (5q c3 mf gs3 c3) (5q bb2 mf bb3 bb2) (5q g2 mf cs4 g2) (5q f2 mf eb4 f2) (5q eb2 mf fs4 eb2) (5q fs2 mf d4 fs2) (5q b2 mf a3 b2) (5q cs3 mf g3 cs3) (5q a2 mf c4 a2) (5q e2 ff stacc+marc e4 mf e2 ff stacc+marc) (5q g2 mf cs4 g2) (5q c3 mf gs3 c3) (5q c4 mf stacc c4 stacc c4 stacc c4 stacc c4 stacc) (5q g2 mf cs4 g2) (5q eb2 mf fs4 eb2) (5q f2 mf eb4 f2) (5q bb2 mf bb3 bb2) (5q eb3 mf fs3 eb3) (5q bb2 mf bb3 bb2) (5q f2 mf eb4 f2) (5q fs2 mf d4 fs2) (5q b2 mf a3 b2) (5q cs3 mf g3 cs3) (5q a2 mf c4 a2) (5q e2 ff stacc+marc e4 mf e2 ff stacc+marc) (5q b2 mf a3 b2) (5q a2 mf c4 a2) (5q g2 mf cs4 g2) (5q c3 mf gs3 c3) (5q eb2 mf fs4 eb2) (5q bb2 mf bb3 bb2) (5q c4 mf stacc c4 stacc c4 stacc c4 stacc c4 stacc))) ;; Erases a lot of notes (rnd-rest '(1) mat :seed 1) ;; Even more notes (rnd-rest '(2) mat :seed 1) ;; Erases almost all notes (rnd-rest '(3) mat :seed 1) ;; Erases all but three notes (rnd-rest '(4) mat :seed 1) ;; Crashes (rnd-rest '(5) mat :seed 1) ;; Works great! (rnd-rest '(0.1) mat :seed 1) When n is 1, I get many notes erased from the sequence instead of only one. Perhaps this is because the omn expression is not flattened out? However, if that's the case this function should erase one note per each group of 5q, and that's not what I see. When n is 5 the function crashes, I guess that is because the length of each grouping has only 5 notes? Also, I can use decimals without any trouble at all and it works great, exactly what I had in mind. So, how should I interpret these results? Thanks!! Quote Link to comment Share on other sites More sharing options...
rcadiz Posted September 1, 2023 Author Share Posted September 1, 2023 I found another case where it does not work, please see below (setf mat2 '(w. f3 p arp q g3 ff stacc+marc w. a3 p arp q c4 ff stacc+marc)) ;; Crashes ;; Error: In a call to length: t (of type boolean) is not of type sequence. (rnd-rest '(1) mat2 :omn t) Quote Link to comment Share on other sites More sharing options...
Stephane Boussuge Posted September 1, 2023 Share Posted September 1, 2023 5 hours ago, rcadiz said: I found another case where it does not work, please see below (setf mat2 '(w. f3 p arp q g3 ff stacc+marc w. a3 p arp q c4 ff stacc+marc)) ;; Crashes ;; Error: In a call to length: t (of type boolean) is not of type sequence. (rnd-rest '(1) mat2 :omn t) I think this error is normal in that case because you are using it on a single list. In that case you have to use (rnd-rest 1 mat2 :omn t) , don't put the 1 into parenthesis. this is normal Opusmodus syntax. Or if you want to keep you 1 in parenthesis do: (setf mat2 '((w. f3 p arp q g3 ff stacc+marc w. a3 p arp q c4 ff stacc+marc))) (rnd-rest '(1) mat2 :omn t) It is normal if you don't use correct syntax you get error. S. Quote Link to comment Share on other sites More sharing options...
opmo Posted September 1, 2023 Share Posted September 1, 2023 Revised rnd-rest in version 3.0.29080 The function RND-REST convert a subset of the length notes in the list to length rests, such that the sum of all length rests (including any existing ones) becomes equal to the given percentage of the sum (span) of the absolute values of all lengths in the list. (setf lengths (gen-repeat 8 1/16)) => (1/16 1/16 1/16 1/16 1/16 1/16 1/16 1/16) (rnd-rest 0.3 lengths) => (1/16 1/16 1/16 1/16 1/16 -1/16 1/16 -1/16) (rnd-rest 0.5 lengths) => (1/16 1/16 -1/16 1/16 -1/16 -1/16 1/16 -1/16) (rnd-rest '(0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9) (gen-repeat 9 (list lengths)) :seed 76) (setf percent (vector-round 0.2 0.8 (gen-sine 16 1 0.8))) => (0.5 0.61480505 0.71213204 0.77716387 0.8 0.77716387 0.71213204 0.614805 0.5 0.38519496 0.28786793 0.2228361 0.2 0.22283617 0.28786805 0.38519496) (setf seq '((1/10 1/10 1/10 1/10 1/10) (1/6 1/6 1/6) (1/16 1/16 1/16 1/16 1/16 1/16 1/16 1/16) (1/16 1/16 1/16 1/16) (1/20 1/20 1/20 1/20 1/20) (1/6 1/6 1/6) (1/10 1/10 1/10 1/10 1/10) (1/10 1/10 1/10 1/10 1/10) (1/6 1/6 1/6) (1/6 1/6 1/6) (1/10 1/10 1/10 1/10 1/10) (1/16 1/16 1/16 1/16) (1/16 1/16 1/16 1/16) (1/6 1/6 1/6) (1/6 1/6 1/6) (1/10 1/10 1/10 1/10 1/10) (1/10 1/10 1/10 1/10 1/10))) (rnd-rest percent seq :omn t :seed 32) => ((5h - = = -) (3h - =) (s - - - = - = -) (-s - = -) (-5q - - - =) (-3h = -) (-5h = - - =) (-5h = = - -) (3h - =) (-3h = =) (-5h = = = =) (s = = =) (s = = =) (3h = =) (3h = =) (5h = = = -) (5h = = - -)) (setf omn1 '((q c5gs4f4 e f5c5gs4 e gs5f5c5 s c6gs5f5) (e c6eb5 c5eb4 e eb4c4 eb5c5) (q b4g4d4 e g4d4b3 s d4b3g3 b3g3d3 q g3d3b2))) (rnd-rest 0.5 omn1 :seed 11) (setf omn2 '((e cs4 mf cs4 cs4 d4) (s d4 mf cs4 ds4 d4 d4 e4 d4 d4) (e f4 mf ds4 d4 fs4) (e ds4 mf d4 fs4 ds4) (e d4 mf s g4 e ds4 s d4 e g4) (s ds4 mf d4 g4 ds4 d4 g4 ds4 d4) (e g4 mf s ds4 d4 e g4 s ds4 d4) (q g4 mf ds4))) (rnd-rest '(0.0 0.2 0.3 0.4 0.5 0.7 0.9 1.0) omn2 :seed 34) Happy coding. AM and Stephane Boussuge 1 1 Quote Link to comment Share on other sites More sharing options...
Stephane Boussuge Posted September 1, 2023 Share Posted September 1, 2023 Wonderful function, I love it ! opmo 1 Quote Link to comment Share on other sites More sharing options...
rcadiz Posted September 1, 2023 Author Share Posted September 1, 2023 9 hours ago, Stephane Boussuge said: I think this error is normal in that case because you are using it on a single list. In that case you have to use (rnd-rest 1 mat2 :omn t) , don't put the 1 into parenthesis. this is normal Opusmodus syntax. Or if you want to keep you 1 in parenthesis do: (setf mat2 '((w. f3 p arp q g3 ff stacc+marc w. a3 p arp q c4 ff stacc+marc))) (rnd-rest '(1) mat2 :omn t) It is normal if you don't use correct syntax you get error. S. Of course, now I understand what I was doing wrong. Thanks a lot for your help! Rodrigo 33 minutes ago, Stephane Boussuge said: Wonderful function, I love it ! Indeed, great function! Thanks so much! Rodrigo Quote Link to comment Share on other sites More sharing options...
Stephane Boussuge Posted September 3, 2023 Share Posted September 3, 2023 I've made a little string trio score to test this fun new function. Here it is attached to this post. Enjoy ! S. Mouvement de Trio pour cordes (etude fn rnd-rest).mp3 String Trio.opmo AM and opmo 1 1 Quote Link to comment Share on other sites More sharing options...
david Posted September 5, 2023 Share Posted September 5, 2023 thank you Stéphane, it sounds good! Stephane Boussuge 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.