Jump to content

sync of lists


Recommended Posts

Hi,

Do the lists for pitches and lengths have to be of the same sublists (do the sublists have to have the same length)?

e.g.:
(setf pitches '((c4 d4 e4) (f4 g4 a4 b4)))
(setf pitches2 '((c4 d4) (e4 f4) (g4 a4) (b4)))
(setf rhy '((1/4 1/4 -1/4) (1/4 1/4 -1/4) (1/4 1/4 -1/4) (1/4)))

(make-omn
 :length rhy
 :pitch pitches)

 

this does not work, with 'pitches2' it works fine..

so I have to be aware that my sublists are 'in sync' 
and use 'flatten' if my sublists are different..?
 
ole
Link to comment
Share on other sites

Can you please take a look at my code, when I copy the results of 'tonhoehen' and 'sechzentel' into  seperate setf's than the result is as it should be, I'am stuck..

Thanks for help,

ole

Code:

(setf primzahlen-ab-drei (cdr (primes 8)))
(setf pausen (gen-repeat (length primzahlen-ab-drei) '(-3)))
(setf values (flatten (gen-mix primzahlen-ab-drei pausen)))

;(setf laenge (apply '+ primzahlen-ab-drei)) => 75

(defun make-pattern (n)
  (cond ((equal n 0) nil)
        ((minusp n) (list '-1/16 '-1/16 '-1/16))
        (t (cons '1/16 (make-pattern (- n 1))))))

(setf sechzentel (flatten (mapcar #'make-pattern values)))
(setf hin-u-zurueck-rhy (assemble-seq sechzentel (nreverse (butlast sechzentel))))
(setf modulationen '(3 5 3 4 3 6 2 7 4 2 3 4 6 4 6 5 4 2 2))

;(apply '+ modulationen) => 75
 
(defun make-pitch (n)
  (cond ((equal n 0) nil)
        (t (cons 'c4d4 (make-pitch (- n 1))))))

(setf modu2 (mapcar #'make-pitch modulationen))
(setf tonhoehen (flatten (pitch-transpose modulationen modu2)))
(setf hin-u-zurueck-toene (assemble-seq tonhoehen (nreverse tonhoehen)))
 
(make-omn
 :length tonhoehen
 :pitch sechzentel)
 
result of 'tonhoehen' and 'sechzentel' copies in setf's - works fine:
(setf pitches
      (flatten
       '((eb4f4 eb4f4 eb4f4) (f4g4 f4g4 f4g4 f4g4 f4g4)
         (eb4f4 eb4f4 eb4f4) (e4fs4 e4fs4 e4fs4 e4fs4)
         (eb4f4 eb4f4 eb4f4) (fs4gs4 fs4gs4 fs4gs4 fs4gs4 fs4gs4 fs4gs4)
         (d4e4 d4e4) (g4a4 g4a4 g4a4 g4a4 g4a4 g4a4 g4a4)
         (e4fs4 e4fs4 e4fs4 e4fs4) (d4e4 d4e4)
         (eb4f4 eb4f4 eb4f4) (e4fs4 e4fs4 e4fs4 e4fs4)
         (fs4gs4 fs4gs4 fs4gs4 fs4gs4 fs4gs4 fs4gs4)
         (e4fs4 e4fs4 e4fs4 e4fs4)
         (fs4gs4 fs4gs4 fs4gs4 fs4gs4 fs4gs4 fs4gs4)
         (f4g4 f4g4 f4g4 f4g4 f4g4) (e4fs4 e4fs4 e4fs4 e4fs4)
         (d4e4 d4e4) (d4e4 d4e4))))

(setf rhy
      (flatten
       '((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/16 -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/16 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/16 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/16 -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/16 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/16 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/16 1/16 1/16)
         (-1/16 -1/16 -1/16))))

(make-omn
 :length rhy
 :pitch pitches)
Link to comment
Share on other sites

The NREVERSE was the problem. You should use REVERSE or PITCH-RETROGRADE.

(setf primzahlen-ab-drei (cdr (primes 8)))
(setf pausen (gen-repeat (length primzahlen-ab-drei) '(-3)))
(setf values (flatten (gen-mix primzahlen-ab-drei pausen)))

(defun make-pattern (n)
  (cond ((equal n 0) nil)
        ((minusp n) (list -1/16 -1/16 -1/16))
        (t (cons 1/16 (make-pattern (- n 1))))))

(setf sechzentel (flatten (mapcar #'make-pattern values)))
(setf hin-u-zurueck-rhy (assemble-seq sechzentel (reverse (butlast sechzentel))))
(setf modulationen '(3 5 3 4 3 6 2 7 4 2 3 4 6 4 6 5 4 2 2))

(defun make-pitch (n)
  (cond ((equal n 0) nil)
        (t (cons 'c4d4 (make-pitch (- n 1))))))

(setf modu2 (mapcar #'make-pitch modulationen))
(setf tonhoehen (flatten (pitch-transpose modulationen modu2)))
(setf hin-u-zurueck-toene (assemble-seq tonhoehen (reverse tonhoehen)))

(make-omn
 :length hin-u-zurueck-rhy
 :pitch hin-u-zurueck-toene
 :span :pitch
)
Edited by opmo
Link to comment
Share on other sites

Thanks for the help!!

I did type 'reverse' in the searchfield on the right and only 'nreverse' shows up. So I used it. Maybe it is good if 'reverse' and 'gen-retrograde' are also listed if one types the keyword 'reverse'..?

And the rightclick/Notation OMN result (of 'make-omn') looks  strange (see pict) while the result of def-score gives a correct notation, the abilily of 'Notation OMN' is limited I assume..(no problem, just good to know)?

Link to comment
Share on other sites

This is correct, your list is 93/16 long.

I suggest to learn and start work with bars (lists) - this is not a limitation of OMN, it is more about how you use or not use Opusmodus.

Use music terminology when searching and look for solution in System Library.

Check the scores from Nigel and Stephane - open in composer panel and examine the steps and the functions.

Edited by opmo
Link to comment
Share on other sites

To retrieve my honor :-) - I did flatten the lists for pitches and lengths on purpose- I need some trials to get that the syncing of the lists in 'make-omn' goes between (sub-)list and (sub-)list. I was thinking that the 'bracket bounderies' of the non focused (not spanned) sublists would be ignored. Now that I've learned that (thanks to your kind and quick answers)  I will change my constructions accordingly.

My apologizes for getting on your nerves (also in advance :-))

thanks!

ole

Example:

(setf pitches '((c4 d4 e4 f4) (g4 a4 b4 c5)))
(setf rhy '((1/4 1/4 -1/4) (1/4 1/4 -1/4) (1/4 1/4 -1/4) (1/4 1/4 -1/4)))
;            c   d          e   f          g   a          b   c
(make-omn
 :length rhy
 :pitch pitches
 :span :length)
 
=> ((q c4 d4 - e4 f4) (q g4 a4 - b4 c5))             ; :span :pitch
=> ((q c4 d4 -) (q g4 a4 -) (q c4 d4 -) (q g4 a4 -)) ; :span :length
 
what I was expecting was:
((q c4 d4 - e4 f4) (q - g4 a4 -) (q b4 c5 - -))
Link to comment
Share on other sites

to answer my own post: I just have to flatten one of the lists (in my case the pitchlist).. Ever so easy.

Sorry for the noise!!

ole

 

edit: that is true for my material, but the material and the retrograde of the material delivers a strange result. What is wrong about my retrograde construction? Please take a look at my code, thanks

(setf pitches
      '(eb4f4 eb4f4 eb4f4 f4g4 f4g4 f4g4 f4g4 f4g4 eb4f4
              eb4f4 eb4f4 e4fs4 e4fs4 e4fs4 e4fs4 eb4f4
              eb4f4 eb4f4 fs4gs4 fs4gs4 fs4gs4 fs4gs4
              fs4gs4 fs4gs4 d4e4 d4e4 g4a4 g4a4 g4a4 g4a4
              g4a4 g4a4 g4a4 e4fs4 e4fs4 e4fs4 e4fs4 d4e4
              d4e4 eb4f4 eb4f4 eb4f4 e4fs4 e4fs4 e4fs4
              e4fs4 fs4gs4 fs4gs4 fs4gs4 fs4gs4 fs4gs4
              fs4gs4 e4fs4 e4fs4 e4fs4 e4fs4 fs4gs4 fs4gs4
              fs4gs4 fs4gs4 fs4gs4 fs4gs4 f4g4 f4g4 f4g4
              f4g4 f4g4 e4fs4 e4fs4 e4fs4 e4fs4 d4e4 d4e4
              d4e4 d4e4))
 
(setf rhy
      '((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/16 -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/16 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/16 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/16 -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/16 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/16 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/16 1/16 1/16)
        (-1/16 -1/16 -1/16)))
 
(make-omn
 :length rhy
 :pitch pitches
 :span :length)
 
first 3 bars:
((s eb4f4 eb4f4 eb4f4) (-s - -) (s f4g4 f4g4 f4g4 f4g4 f4g4))


fine

(setf back-and-forth-p (assemble-seq pitches (reverse pitches)))
(setf back-and-forth-rh (assemble-seq rhy (reverse (butlast rhy))))

(make-omn
 :length back-and-forth-rh
 :pitch back-and-forth-p
 :span :length)


first 3 bars:

((s eb4f4 eb4f4 eb4f4) (-s - -) (s d4e4 d4e4 d4e4 d4e4 e4fs4))


why?

Link to comment
Share on other sites

Yes the output is correct.

The expression you have created outputs two pitch lists:

(setf back-and-forth-p (assemble-seq pitches (reverse pitches)))

 

The 2 pitch lists are span one by one to the length lists in a loop.

1st length list takes the 4 pitches from the 1st list.

2nd length list are rests.

3rd length list takes the pitches from the 2nd pitch list.

4th length list are rests.

5th length list takes the pitches from the 1st pitch list and so on.

Good start to understand how we process lists in Opusmodus is study the SPAN function documentation.

The are many ways how to sync the lists.

In your case you could FLATTEN the pitch lists to one list:

(setf back-and-forth-p (flatten (assemble-seq pitches (reverse pitches))))

 

or you could do that directly in the function MAKE-OMN with additional keyword flat:

(make-omn
 :length back-and-forth-rh
 :pitch back-and-forth-p
 :flat t)

 

The :span :length is not need it here - the default is :span :length

Example with SPAN:

(span back-and-forth-rh
      back-and-forth-p :flat t)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy