commit | author | age
|
71cec5
|
1 |
;====================================== |
MS |
2 |
;OM-Lead, 2022-2023 |
|
3 |
; |
|
4 |
;Library for Rule-based Voice-Leading |
|
5 |
;Author: Lorenz Lehmann |
|
6 |
;Supervision: Marlon Schumacher |
|
7 |
;====================================== |
|
8 |
|
|
9 |
(in-package :om) |
|
10 |
|
|
11 |
(defmethod! rhythmic-progress (harmon-progress randomize measure tempo legato &key raster0 raster1 raster2 raster3) |
|
12 |
|
|
13 |
:doc "Gives the possibility of rhythmic and melodic movement between the chords" |
|
14 |
:indoc '("chord-list from harmon-progress" "t: permutates randomly the rhythmic-order " "measure" "tempo" "legato" "(voice-number (smallest rhythmic value, should be a fraction & stepsize, an intervall in midicents))" "(voice-number (smallest rhythmic value, should be a fraction & stepsize, an intervall in midicents))" "(voice-number (smallest rhythmic value, should be a fraction & stepsize, an intervall in midicents))" "(voice-number (smallest rhythmic value, should be a fraction & stepsize, an intervall in midicents))") |
|
15 |
:icon 030719971 |
|
16 |
:numouts 1 |
|
17 |
|
|
18 |
;xxxxxxxxxxxxxxxxxxxxxxxx |
|
19 |
|
|
20 |
;xxxxxxxxxxxxxxxxxxxxxxxx |
|
21 |
(reverse (remove nil (list |
|
22 |
|
|
23 |
(cond |
|
24 |
|
|
25 |
((and (not (eq raster0 'nil)) |
|
26 |
(or (eq (car (nth (car raster0) (mat-trans harmon-progress))) 'nil) |
|
27 |
(eq (cadr (nth (car raster0) (mat-trans harmon-progress))) 'nil) |
|
28 |
(eq (car (nth (car raster0) (mat-trans harmon-progress))) (cadr (nth (car raster0) (mat-trans harmon-progress)))))) |
|
29 |
|
|
30 |
(let ((pitch-list (nth (car raster0) (mat-trans harmon-progress)))) |
|
31 |
(let ((note (car pitch-list))) |
|
32 |
|
|
33 |
(make-instance 'voice |
|
34 |
:tree (list '? (if (eq note nil) (list (list (append measure) '(-1))) (list (list (append measure) '(1))))) |
|
35 |
:tempo tempo |
|
36 |
:legato legato |
|
37 |
:chords (list note))) |
|
38 |
|
|
39 |
)) |
|
40 |
|
|
41 |
((and (not (eq raster0 'nil)) |
|
42 |
|
|
43 |
(let |
|
44 |
((pulsation (cadr (cadr raster0))) |
|
45 |
(pitch-list (nth (car raster0) (mat-trans harmon-progress)))) |
|
46 |
(let |
|
47 |
((interval (- (cadr pitch-list) (car pitch-list)))) |
|
48 |
(let |
|
49 |
((delta (if (> 0 interval) (* -1 interval) interval)) |
|
50 |
(stepsize (caadr raster0))) |
|
51 |
(> |
|
52 |
(* (car (multiple-value-list (floor delta stepsize))) pulsation) |
|
53 |
(/ (car measure) (cadr measure))))))) |
|
54 |
|
|
55 |
(let |
|
56 |
((pulsation (cadr (cadr raster0))) |
|
57 |
(pitch-list (nth (car raster0) (mat-trans harmon-progress)))) |
|
58 |
(let |
|
59 |
((interval (- (cadr pitch-list) (car pitch-list)))) |
|
60 |
(let |
|
61 |
((delta (if (> 0 interval) (* -1 interval) interval)) |
|
62 |
(stepsize (caadr raster0))) |
|
63 |
(let |
|
64 |
((step (if (> 0 interval) (* -1 stepsize) stepsize))) |
|
65 |
(let |
|
66 |
((chord-list (dx->x (car pitch-list) |
|
67 |
(make-list (car (multiple-value-list (floor delta stepsize))) :initial-element step)))) |
|
68 |
(let ((final-chords |
|
69 |
(append (list (car pitch-list)) (nthcdr (/ (- (* (length chord-list) pulsation) (/ (car measure) (cadr measure))) pulsation) (butlast chord-list))))) |
|
70 |
|
|
71 |
(make-instance 'voice |
|
72 |
:tree (list '? (list (list (append measure) (make-list (car measure) :initial-element 1)))) |
|
73 |
:tempo tempo |
|
74 |
:legato legato |
|
75 |
:chords final-chords |
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
)))))))) |
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
(raster0 |
|
87 |
(let |
|
88 |
( |
|
89 |
(pitch-list (nth (car raster0) (mat-trans harmon-progress))) |
|
90 |
(pulsation (cadr (cadr raster0))) |
|
91 |
(stepsize (caadr raster0)) |
|
92 |
) |
|
93 |
|
|
94 |
(let ((interval (- (cadr pitch-list) (car pitch-list)))) |
|
95 |
(let ((delta (if (> 0 interval) (* -1 interval) interval))) |
|
96 |
|
|
97 |
|
|
98 |
(let |
|
99 |
((chord-list |
|
100 |
(let ((step (if (< (car pitch-list) (cadr pitch-list)) stepsize (* -1 stepsize)))) |
|
101 |
(butlast (dx->x (car pitch-list) (remove nil (append (make-list (car (multiple-value-list |
|
102 |
|
|
103 |
(floor delta stepsize))) :initial-element step) |
|
104 |
(if (= 0 (cadr (multiple-value-list (floor delta stepsize)))) |
|
105 |
(list nil) |
|
106 |
(if (< step 0) |
|
107 |
(list (* -1 (cadr (multiple-value-list (floor delta stepsize))))) |
|
108 |
(list (cadr (multiple-value-list (floor delta stepsize))))) |
|
109 |
)))))))) |
|
110 |
|
|
111 |
(let |
|
112 |
|
|
113 |
((rhythm-list (if (values randomize) |
|
114 |
(permut-random (append |
|
115 |
(list (- 1 (* (- (length chord-list) 1) pulsation))) |
|
116 |
(make-list (- (length chord-list) 1) :initial-element pulsation))) |
|
117 |
(append |
|
118 |
(list (- 1 (* (- (length chord-list) 1) pulsation))) |
|
119 |
(make-list (- (length chord-list) 1) :initial-element pulsation)) |
|
120 |
)) |
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
) |
|
125 |
|
|
126 |
(make-instance 'voice |
|
127 |
:tree (mktree rhythm-list measure) |
|
128 |
:tempo tempo |
|
129 |
:legato legato |
|
130 |
:chords chord-list) |
|
131 |
|
|
132 |
)))))) |
|
133 |
(t nil)) |
|
134 |
|
|
135 |
;;;raster1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
136 |
|
|
137 |
(cond |
|
138 |
|
|
139 |
((and (not (eq raster1 'nil)) |
|
140 |
(or (eq (car (nth (car raster1) (mat-trans harmon-progress))) 'nil) |
|
141 |
(eq (cadr (nth (car raster1) (mat-trans harmon-progress))) 'nil) |
|
142 |
(eq (car (nth (car raster1) (mat-trans harmon-progress))) (cadr (nth (car raster1) (mat-trans harmon-progress)))))) |
|
143 |
|
|
144 |
(let ((pitch-list (nth (car raster1) (mat-trans harmon-progress)))) |
|
145 |
(let ((note (car pitch-list))) |
|
146 |
|
|
147 |
(make-instance 'voice |
|
148 |
:tree (list '? (if (eq note nil) (list (list (append measure) '(-1))) (list (list (append measure) '(1))))) |
|
149 |
:tempo tempo |
|
150 |
:legato legato |
|
151 |
:chords (list note))) |
|
152 |
|
|
153 |
)) |
|
154 |
|
|
155 |
((and (not (eq raster1 'nil)) |
|
156 |
|
|
157 |
(let |
|
158 |
((pulsation (cadr (cadr raster1))) |
|
159 |
(pitch-list (nth (car raster1) (mat-trans harmon-progress)))) |
|
160 |
(let |
|
161 |
((interval (- (cadr pitch-list) (car pitch-list)))) |
|
162 |
(let |
|
163 |
((delta (if (> 0 interval) (* -1 interval) interval)) |
|
164 |
(stepsize (caadr raster1))) |
|
165 |
(> |
|
166 |
(* (car (multiple-value-list (floor delta stepsize))) pulsation) |
|
167 |
(/ (car measure) (cadr measure))))))) |
|
168 |
|
|
169 |
(let |
|
170 |
((pulsation (cadr (cadr raster1))) |
|
171 |
(pitch-list (nth (car raster1) (mat-trans harmon-progress)))) |
|
172 |
(let |
|
173 |
((interval (- (cadr pitch-list) (car pitch-list)))) |
|
174 |
(let |
|
175 |
((delta (if (> 0 interval) (* -1 interval) interval)) |
|
176 |
(stepsize (caadr raster1))) |
|
177 |
(let |
|
178 |
((step (if (> 0 interval) (* -1 stepsize) stepsize))) |
|
179 |
(let |
|
180 |
((chord-list (dx->x (car pitch-list) |
|
181 |
(make-list (car (multiple-value-list (floor delta stepsize))) :initial-element step)))) |
|
182 |
(let ((final-chords |
|
183 |
(append (list (car pitch-list)) (nthcdr (/ (- (* (length chord-list) pulsation) (/ (car measure) (cadr measure))) pulsation) (butlast chord-list))))) |
|
184 |
|
|
185 |
(make-instance 'voice |
|
186 |
:tree (list '? (list (list (append measure) (make-list (car measure) :initial-element 1)))) |
|
187 |
:tempo tempo |
|
188 |
:legato legato |
|
189 |
:chords final-chords |
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
)))))))) |
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
|
200 |
(raster1 |
|
201 |
(let |
|
202 |
( |
|
203 |
(pitch-list (nth (car raster1) (mat-trans harmon-progress))) |
|
204 |
(pulsation (cadr (cadr raster1))) |
|
205 |
(stepsize (caadr raster1)) |
|
206 |
) |
|
207 |
|
|
208 |
(let ((interval (- (cadr pitch-list) (car pitch-list)))) |
|
209 |
(let ((delta (if (> 0 interval) (* -1 interval) interval))) |
|
210 |
|
|
211 |
|
|
212 |
(let |
|
213 |
((chord-list |
|
214 |
(let ((step (if (< (car pitch-list) (cadr pitch-list)) stepsize (* -1 stepsize)))) |
|
215 |
(butlast (dx->x (car pitch-list) (remove nil (append (make-list (car (multiple-value-list |
|
216 |
|
|
217 |
(floor delta stepsize))) :initial-element step) |
|
218 |
(if (= 0 (cadr (multiple-value-list (floor delta stepsize)))) |
|
219 |
(list nil) |
|
220 |
(if (< step 0) |
|
221 |
(list (* -1 (cadr (multiple-value-list (floor delta stepsize))))) |
|
222 |
(list (cadr (multiple-value-list (floor delta stepsize))))) |
|
223 |
)))))))) |
|
224 |
|
|
225 |
(let |
|
226 |
|
|
227 |
((rhythm-list (if (values randomize) |
|
228 |
(permut-random (append |
|
229 |
(list (- 1 (* (- (length chord-list) 1) pulsation))) |
|
230 |
(make-list (- (length chord-list) 1) :initial-element pulsation))) |
|
231 |
(append |
|
232 |
(list (- 1 (* (- (length chord-list) 1) pulsation))) |
|
233 |
(make-list (- (length chord-list) 1) :initial-element pulsation)) |
|
234 |
)) |
|
235 |
|
|
236 |
|
|
237 |
|
|
238 |
) |
|
239 |
|
|
240 |
(make-instance 'voice |
|
241 |
:tree (mktree rhythm-list measure) |
|
242 |
:tempo tempo |
|
243 |
:legato legato |
|
244 |
:chords chord-list) |
|
245 |
|
|
246 |
)))))) |
|
247 |
(t nil)) |
|
248 |
|
|
249 |
;;;raster2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
250 |
|
|
251 |
(cond |
|
252 |
|
|
253 |
((and (not (eq raster2 'nil)) |
|
254 |
(or (eq (car (nth (car raster2) (mat-trans harmon-progress))) 'nil) |
|
255 |
(eq (cadr (nth (car raster2) (mat-trans harmon-progress))) 'nil) |
|
256 |
(eq (car (nth (car raster2) (mat-trans harmon-progress))) (cadr (nth (car raster2) (mat-trans harmon-progress)))))) |
|
257 |
|
|
258 |
(let ((pitch-list (nth (car raster2) (mat-trans harmon-progress)))) |
|
259 |
(let ((note (car pitch-list))) |
|
260 |
|
|
261 |
(make-instance 'voice |
|
262 |
:tree (list '? (if (eq note nil) (list (list (append measure) '(-1))) (list (list (append measure) '(1))))) |
|
263 |
:tempo tempo |
|
264 |
:legato legato |
|
265 |
:chords (list note))) |
|
266 |
|
|
267 |
)) |
|
268 |
|
|
269 |
((and (not (eq raster2 'nil)) |
|
270 |
|
|
271 |
(let |
|
272 |
((pulsation (cadr (cadr raster2))) |
|
273 |
(pitch-list (nth (car raster2) (mat-trans harmon-progress)))) |
|
274 |
(let |
|
275 |
((interval (- (cadr pitch-list) (car pitch-list)))) |
|
276 |
(let |
|
277 |
((delta (if (> 0 interval) (* -1 interval) interval)) |
|
278 |
(stepsize (caadr raster2))) |
|
279 |
(> |
|
280 |
(* (car (multiple-value-list (floor delta stepsize))) pulsation) |
|
281 |
(/ (car measure) (cadr measure))))))) |
|
282 |
|
|
283 |
(let |
|
284 |
((pulsation (cadr (cadr raster2))) |
|
285 |
(pitch-list (nth (car raster2) (mat-trans harmon-progress)))) |
|
286 |
(let |
|
287 |
((interval (- (cadr pitch-list) (car pitch-list)))) |
|
288 |
(let |
|
289 |
((delta (if (> 0 interval) (* -1 interval) interval)) |
|
290 |
(stepsize (caadr raster2))) |
|
291 |
(let |
|
292 |
((step (if (> 0 interval) (* -1 stepsize) stepsize))) |
|
293 |
(let |
|
294 |
((chord-list (dx->x (car pitch-list) |
|
295 |
(make-list (car (multiple-value-list (floor delta stepsize))) :initial-element step)))) |
|
296 |
(let ((final-chords |
|
297 |
(append (list (car pitch-list)) (nthcdr (/ (- (* (length chord-list) pulsation) (/ (car measure) (cadr measure))) pulsation) (butlast chord-list))))) |
|
298 |
|
|
299 |
(make-instance 'voice |
|
300 |
:tree (list '? (list (list (append measure) (make-list (car measure) :initial-element 1)))) |
|
301 |
:tempo tempo |
|
302 |
:legato legato |
|
303 |
:chords final-chords |
|
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
|
309 |
)))))))) |
|
310 |
|
|
311 |
|
|
312 |
|
|
313 |
|
|
314 |
(raster2 |
|
315 |
(let |
|
316 |
( |
|
317 |
(pitch-list (nth (car raster2) (mat-trans harmon-progress))) |
|
318 |
(pulsation (cadr (cadr raster2))) |
|
319 |
(stepsize (caadr raster2)) |
|
320 |
) |
|
321 |
|
|
322 |
(let ((interval (- (cadr pitch-list) (car pitch-list)))) |
|
323 |
(let ((delta (if (> 0 interval) (* -1 interval) interval))) |
|
324 |
|
|
325 |
|
|
326 |
(let |
|
327 |
((chord-list |
|
328 |
(let ((step (if (< (car pitch-list) (cadr pitch-list)) stepsize (* -1 stepsize)))) |
|
329 |
(butlast (dx->x (car pitch-list) (remove nil (append (make-list (car (multiple-value-list |
|
330 |
|
|
331 |
(floor delta stepsize))) :initial-element step) |
|
332 |
(if (= 0 (cadr (multiple-value-list (floor delta stepsize)))) |
|
333 |
(list nil) |
|
334 |
(if (< step 0) |
|
335 |
(list (* -1 (cadr (multiple-value-list (floor delta stepsize))))) |
|
336 |
(list (cadr (multiple-value-list (floor delta stepsize))))) |
|
337 |
)))))))) |
|
338 |
|
|
339 |
(let |
|
340 |
|
|
341 |
((rhythm-list (if (values randomize) |
|
342 |
(permut-random (append |
|
343 |
(list (- 1 (* (- (length chord-list) 1) pulsation))) |
|
344 |
(make-list (- (length chord-list) 1) :initial-element pulsation))) |
|
345 |
(append |
|
346 |
(list (- 1 (* (- (length chord-list) 1) pulsation))) |
|
347 |
(make-list (- (length chord-list) 1) :initial-element pulsation)) |
|
348 |
)) |
|
349 |
|
|
350 |
|
|
351 |
|
|
352 |
) |
|
353 |
|
|
354 |
(make-instance 'voice |
|
355 |
:tree (mktree rhythm-list measure) |
|
356 |
:tempo tempo |
|
357 |
:legato legato |
|
358 |
:chords chord-list) |
|
359 |
|
|
360 |
)))))) |
|
361 |
(t nil)) |
|
362 |
|
|
363 |
;;;raster3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
364 |
|
|
365 |
(cond |
|
366 |
|
|
367 |
((and (not (eq raster3 'nil)) |
|
368 |
(or (eq (car (nth (car raster3) (mat-trans harmon-progress))) 'nil) |
|
369 |
(eq (cadr (nth (car raster3) (mat-trans harmon-progress))) 'nil) |
|
370 |
(eq (car (nth (car raster3) (mat-trans harmon-progress))) (cadr (nth (car raster3) (mat-trans harmon-progress)))))) |
|
371 |
|
|
372 |
(let ((pitch-list (nth (car raster3) (mat-trans harmon-progress)))) |
|
373 |
(let ((note (car pitch-list))) |
|
374 |
|
|
375 |
(make-instance 'voice |
|
376 |
:tree (list '? (if (eq note nil) (list (list (append measure) '(-1))) (list (list (append measure) '(1))))) |
|
377 |
:tempo tempo |
|
378 |
:legato legato |
|
379 |
:chords (list note))) |
|
380 |
|
|
381 |
)) |
|
382 |
|
|
383 |
((and (not (eq raster3 'nil)) |
|
384 |
|
|
385 |
(let |
|
386 |
((pulsation (cadr (cadr raster3))) |
|
387 |
(pitch-list (nth (car raster3) (mat-trans harmon-progress)))) |
|
388 |
(let |
|
389 |
((interval (- (cadr pitch-list) (car pitch-list)))) |
|
390 |
(let |
|
391 |
((delta (if (> 0 interval) (* -1 interval) interval)) |
|
392 |
(stepsize (caadr raster3))) |
|
393 |
(> |
|
394 |
(* (car (multiple-value-list (floor delta stepsize))) pulsation) |
|
395 |
(/ (car measure) (cadr measure))))))) |
|
396 |
|
|
397 |
(let |
|
398 |
((pulsation (cadr (cadr raster3))) |
|
399 |
(pitch-list (nth (car raster3) (mat-trans harmon-progress)))) |
|
400 |
(let |
|
401 |
((interval (- (cadr pitch-list) (car pitch-list)))) |
|
402 |
(let |
|
403 |
((delta (if (> 0 interval) (* -1 interval) interval)) |
|
404 |
(stepsize (caadr raster3))) |
|
405 |
(let |
|
406 |
((step (if (> 0 interval) (* -1 stepsize) stepsize))) |
|
407 |
(let |
|
408 |
((chord-list (dx->x (car pitch-list) |
|
409 |
(make-list (car (multiple-value-list (floor delta stepsize))) :initial-element step)))) |
|
410 |
(let ((final-chords |
|
411 |
(append (list (car pitch-list)) (nthcdr (/ (- (* (length chord-list) pulsation) (/ (car measure) (cadr measure))) pulsation) (butlast chord-list))))) |
|
412 |
|
|
413 |
(make-instance 'voice |
|
414 |
:tree (list '? (list (list (append measure) (make-list (car measure) :initial-element 1)))) |
|
415 |
:tempo tempo |
|
416 |
:legato legato |
|
417 |
:chords final-chords |
|
418 |
|
|
419 |
|
|
420 |
|
|
421 |
|
|
422 |
|
|
423 |
)))))))) |
|
424 |
|
|
425 |
|
|
426 |
|
|
427 |
|
|
428 |
(raster3 |
|
429 |
(let |
|
430 |
( |
|
431 |
(pitch-list (nth (car raster3) (mat-trans harmon-progress))) |
|
432 |
(pulsation (cadr (cadr raster3))) |
|
433 |
(stepsize (caadr raster3)) |
|
434 |
) |
|
435 |
|
|
436 |
(let ((interval (- (cadr pitch-list) (car pitch-list)))) |
|
437 |
(let ((delta (if (> 0 interval) (* -1 interval) interval))) |
|
438 |
|
|
439 |
|
|
440 |
(let |
|
441 |
((chord-list |
|
442 |
(let ((step (if (< (car pitch-list) (cadr pitch-list)) stepsize (* -1 stepsize)))) |
|
443 |
(butlast (dx->x (car pitch-list) (remove nil (append (make-list (car (multiple-value-list |
|
444 |
|
|
445 |
(floor delta stepsize))) :initial-element step) |
|
446 |
(if (= 0 (cadr (multiple-value-list (floor delta stepsize)))) |
|
447 |
(list nil) |
|
448 |
(if (< step 0) |
|
449 |
(list (* -1 (cadr (multiple-value-list (floor delta stepsize))))) |
|
450 |
(list (cadr (multiple-value-list (floor delta stepsize))))) |
|
451 |
)))))))) |
|
452 |
|
|
453 |
(let |
|
454 |
|
|
455 |
((rhythm-list (if (values randomize) |
|
456 |
(permut-random (append |
|
457 |
(list (- 1 (* (- (length chord-list) 1) pulsation))) |
|
458 |
(make-list (- (length chord-list) 1) :initial-element pulsation))) |
|
459 |
(append |
|
460 |
(list (- 1 (* (- (length chord-list) 1) pulsation))) |
|
461 |
(make-list (- (length chord-list) 1) :initial-element pulsation)) |
|
462 |
)) |
|
463 |
|
|
464 |
|
|
465 |
|
|
466 |
) |
|
467 |
|
|
468 |
(make-instance 'voice |
|
469 |
:tree (mktree rhythm-list measure) |
|
470 |
:tempo tempo |
|
471 |
:legato legato |
|
472 |
:chords chord-list) |
|
473 |
|
|
474 |
)))))) |
|
475 |
(t nil)) |
|
476 |
|
|
477 |
;;;end;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
478 |
)))) |
|
479 |
;;;end;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
480 |
|