Jump to content
Sign in to follow this  
o_e

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

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

Hi,

by default in MAKE-OMN function, the span is attributed to length, i.e. the length drive the number of elements in the output lists.

if you want to change that, for example for pitch driving, you can do:

(make-omn
 :length rhy
 :pitch pitches
 :span :pitch)
 

Share this post


Link to post
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

Share this post


Link to post
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)?

Share this post


Link to post
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

Share this post


Link to post
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 - -))

Share this post


Link to post
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?

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

This helped me a lot, thank you very much!!

ole

Share this post


Link to post
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.

Sign in to follow this  

  • Similar Topics

    • By Jorvd
      I'm guessing this is a simple one but it has me stuck for almost an hour now.
      I have two different velocity vectors:
      (setf dynamic-rh (vector-to-velocity 0.55 0.62 (gen-white-noise 10 :seed 122) :type :midi)) (setf dynamic-lh (vector-to-velocity 0.33 0.41 (gen-white-noise 10 :seed 67) :type :midi)) Which I want to combine/merge and plot, I've tried all sorts of stuff like this:
       
      (velocity-list-plot '(dynamic-lh dynamics-rh) :point-radius 2) (velocity-list-plot '((dynamic-lh) (dynamics-rh)) :point-radius 2) (velocity-list-plot (list(dynamic-lh dynamics-rh)) :point-radius 2) It's probably quite obvious, but I couldn't write Lisp to save my life..
      Thank you in advance!
    • By terekita
      Hello, newbie question:
       
      I'd like to take an omn list and simply repeat each measure 3 times. If I start with the following code:
      (setf r-transitions1 '((e (e 1)(-e 3)) (-e (e 3)(-e 1)))) (setf marked (gen-markov-from-transitions r-transitions1 :size 120)) ;;conform to timesignature in omn format (setf r1 (length-span (gen-repeat 20 '8/8) marked :omn t)) ;;define the time signatures (setf timesigs (get-time-signature r1)) ;;stream of pitches (setf pitches '(c4 eb4 f4 g4 bb4 c5 eb5)) (setf pitches (chord-interval-add '(12) pitches)) ;;by spanning r1 onto pitches, pitches will repeat as needed (setf pitches (span r1 pitches)) (setf rh (make-omn :length r1 :pitch pitches)) and then try something like:
      (setf rrh (gen-repeat 3 rh)) ;or (setf rrh (gen-repeat '(3) rh)) neither gives me what I'm looking for.
      However, I notice that if I evaluate
       
      (setf rrh (gen-repeat 3 (list (first rh)))) then I get the correct result for the first measure.
       
      Therefore, doing something like this gets me what I was looking for:
       
      (setf rrh (gen-divide 8 (flatten (mapcar #'(lambda (n) (gen-repeat 3 (list n))) rh))))  
      But surely there's a better/simpler way to repeat bars in omn format.
       
      If anyone has insights, I'd be most appreciative.
       
      thanks, Michael
       
       
       
       
    • By BrianCope
      Hello All
       
      Can anyone help me develop a function which superimposes a rhythm onto a constant list of pitches?
       
      For example, how would I go about superimposing a rhythm like (1/2 1/16 7/16 1/8 3/8 3/16 5/16 1/4 1/4 5/16 3/16 3/8)
       
      on to list of pitches like (infinity-series 100 '(g4 gs4))
      => (g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 fs4 a4 g4 gs4 a4 fs4 e4 b4 g4 gs4 fs4 a4 gs4 g4 f4 bb4 a4 fs4 e4 b4 fs4 a4 g4 gs4 e4 b4 a4 fs4 b4 e4 d4 cs5 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 f4 bb4 gs4 g4)
       
      So that the melody would be:
      => (g4 gs4 fs4 a4 gs4 g4 f4 bb4 fs4 a4 g4 gs4 a4 fs4 e4 b4 gs4 g4 f4 bb4 g4 gs4 fs4 a4 f4 bb4 gs4 g4 bb4 f4 eb4 c5 fs4 a4 g4 gs4 a4 fs4 e4 b4 g4 gs4 fs4 a4 gs4 g4 f4 bb4
            1/2                                        1/16 7/16                              1/8       3/8                             3/16          5/16                      1/4                  1/4                5/16                      3/16           
      => (1/2 g4 1/16 fs4 7/16 a4 1/8 gs4 3/8 f4 3/16 f4 5/16 g4 1/4 fs4 1/4 a4 5/16 g4 3/16 g4)                 
       
      I want to set each pitch to a constant value, for e.g 1/16 then superimpose the rhythm so that rather than span the rhythm to the pitches, the rhythm swallows the pitches leaving a resultant melody. I hope this makes sense.
       
      Any help gratefully received.
       
      Best wishes
       
      Brian
       
       
×
×
  • Create New...