# Rhythmic Resultants

## Recommended Posts

I am searching for a function in Opusmodus, witch makes it possible to add the attacks of two (more) rhythms, does anybody have a solution for this?

Short example:

(setf pr (primes-to 7))

(setf r1 (gen-length pr '4))
(setf r2 (gen-retrograde (gen-length pr '4)))

; function like::
; (gen-resultants r1 r2) (see Score example)

best

Stefan ##### Share on other sites

is  this a solution? ...or some ideas to it...

greetings

andré

```;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun gen-resultant (r1 r2 &key (rhy 1/4))
(gen-length (difference (remove-duplicates
(sort-asc (flatten (append (cons 0 (gen-accumulate r1))
(cons 0 (gen-accumulate r2))))))) rhy))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; example.... correct?
(gen-resultant  (primes-to 7) (reverse (primes-to 7)))

;;; another example
(gen-resultant '(9) '(3 1 4))
(gen-resultant '(9) '(3 1 4) :rhy 1/16)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;```

n-version...

```;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; for several layers

(defun gen-resultant* (r &key (rhy 1/4))
(gen-length (difference (remove-duplicates
(sort-asc (flatten (loop for i in r
append (cons 0 (gen-accumulate i)))))))
rhy))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; correct?

(gen-resultant* '((16)
(9)
(3 1 4)
(7)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;```

a version with length-input - but test it, correct...?

```;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; for several layers / with direct rhythm-input

(defun gen-resultant** (r)
(difference (remove-duplicates
(sort-asc (flatten (loop for i in r
append (cons 0 (gen-accumulate i))))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; correct?

(gen-resultant** '((2/4 1/4 3/4) (1/16 3/16 2/12 1/12) (3/4 3/20 2/20)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;```

##### Share on other sites

Hi André,

thank you very much for your help, your codes are working very good and it is exactly what I was looking for...

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; example.... correct?
;; Yes
;(gen-resultant  (primes-to 19) (reverse (primes-to 19)))

;; =================
;;;exactly what I was looking for, thanks alot!!!
(progn
(defun gen-resultant (r1 r2 &key (rhy 1/4))
(gen-length (difference (remove-duplicates
(sort-asc (flatten (append (cons 0 (gen-accumulate r1))
(cons 0 (gen-accumulate r2))))))) rhy))
(setf r1a (primes-to 19))
(setf r2a (reverse (primes-to 19)))
;; Resultant from r1a r2a
(setf rr (gen-resultant r1a r2a :rhy 1/16))

(setf r1b (gen-length r1a '16))
(setf r2b (gen-length r2a '16))

(ps 'gm
:rhy (list  r1b)
:rhy (list  r2b)
:rhy (list rr)
:time-signature '(4 4 1)
)

....as long as there are no rests involved, rests are interpreted as attacks:

(progn
(defun gen-resultant* (r &key (rhy 1/4))
(gen-length (difference (remove-duplicates
(sort-asc (flatten (loop for i in r
append (cons 0 (gen-accumulate i)))))))
rhy))

(setf r1c (gen-length '(16) '4))
(setf r2c (gen-length '(9) '4))
(setf r3c (gen-length '((3 1 4)) '4))
(setf r4c (gen-length '(7) '4))

;; Resultant from r1c r2c r3c r4c
(setf rrc (gen-resultant* '((16)
(9)
(3 1 4)
(7))))

(ps 'gm
:rhy (list  r1c)
:rhy (list  r2c)
:rhy (list  r3c)
:rhy (list  r4c)
:rhy (list rrc)
:time-signature '(4 4 1)
)
)

... or:

(progn
(defun gen-resultant** (r)
(difference (remove-duplicates
(sort-asc (flatten (loop for i in r
append (cons 0 (gen-accumulate i))))))))
(setf rha '(2/4 1/4 3/4))
(setf rhb '(1/16 3/16 2/12 1/12))
(setf rhc '(3/4 3/20 2/20))

(setf rr2 (gen-resultant** (list rha rhb rhc)))

(ps 'gm
:rhy (list  rha)
:rhy (list  rhb)
:rhy (list  rhc)
:rhy (list rr2)
:time-signature '(4 4 1)
)
)

Thank you very much!

best

Stefan

##### Share on other sites

you're welcome....

##### Share on other sites

Thank you ! Very nice !

In relation of counting the rests as items attacks, I suggested this to Janusz (probably in the next update).

Best !

Julio

best wishes

Stefan

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account. ×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• Lessons