Jump to content

Transpose whole list


Recommended Posts

Hi,

I'm a beginner, can anyone help me?

I'm trying to figure out how to transpose the whole list.

currently i have transposition individually to each measure in a pitch sequence

 

(setf theme-tr  (pitch-transpose 
            '(0 5 -2 3 8 1 6 -1 4 9 2 7)
            (gen-repeat
             12    
             '((e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5)

                (e d5 e5 f5 s d5 db5 e c5 d5 e5 s c5 b4)

                (e bb4 c5 d5 s b4 bb4 e a4 bb4 c5 s a4 ab4)

                (e g4 a4 bb4 s g4 gb4 e f4 g4 a4 -e)))))

Link to comment
Share on other sites

Each sublist with is own transposition value:

 

(setf theme-tn (pitch-transpose 
                '(0 5 -2 3)
                '((e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5)
                  (e d5 e5 f5 s d5 db5 e c5 d5 e5 s c5 b4)
                  (e bb4 c5 d5 s b4 bb4 e a4 bb4 c5 s a4 ab4)
                  (e g4 a4 bb4 s g4 gb4 e f4 g4 a4 -e))))

 

One transposition value for the entire sequence:

 

(setf theme-tr1 (pitch-transpose 
                6
                '((e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5)
                  (e d5 e5 f5 s d5 db5 e c5 d5 e5 s c5 b4)
                  (e bb4 c5 d5 s b4 bb4 e a4 bb4 c5 s a4 ab4)
                  (e g4 a4 bb4 s g4 gb4 e f4 g4 a4 -e))))

 

Link to comment
Share on other sites

that I know how to do 😉

not easy to express in english for me

 

I want to transpose the whole sequence with this transposition

(pitch-transpose 
            '(0 5 -2 3 8 1 6 -1 4 9 2 7)

entire sequence 0

entire sequence 5

entire sequence -2

etc

Link to comment
Share on other sites

It this what you are looking for:

 

(setf mat '((e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5)
            (e d5 e5 f5 s d5 db5 e c5 d5 e5 s c5 b4)
            (e bb4 c5 d5 s b4 bb4 e a4 bb4 c5 s a4 ab4)
            (e g4 a4 bb4 s g4 gb4 e f4 g4 a4 -e)))
      
(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      collect (pitch-transpose i mat))

 

Link to comment
Share on other sites

(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i mat))

Would also keep the 4/4. (append instead of collect)

 

"Loop" is important in lisp.  Google gives you a lot of examples.

 

I like the book "Common LISP" by David S. Touretzky to  better my LISP or refresh what I forget. Or the site 

COMMON-LISP.NET

With a lot of online resources.

Link to comment
Share on other sites

Thanks Rolf, for this hint!
I am more of those who still play and compose (tonal music) 😉
I admit I have a little trouble finding what I'm looking for in the OM universe... even though I'm sure you can do anything with this software!
Sometimes I come to the forum to find some information... but in general, we only find very advanced concepts and quite far from what I'm looking for... so from time to time, I dare to ask a question;-)
I went to listen to your music on your site... well done, there's a lot of music!

Link to comment
Share on other sites

I can recommend reading the "Book1". You will get a lot of good ideas. Especially for the more organized and tonal music.

 

Please keep asking questions and post ideas. That is what the forum is for. I think there is not enough traffic here.

Any question is valid because people use Opusmodus for different things and in different depth. Some every day for complete compositions, some just to create snippets for MIDI etc. Some do it since years ,some started yesterday. Some use only Opusmodus, some a lot of other tools. Some mostly compose, some play there instrument most of the time.

When answering you seldom know where the asking person comes from. So you sometime miss the idea.

 

Thank you for the "well done".

I have been on your site before. Excellent.

You are a real composer and musician.

I have no training in any of both. So I don't compare.

I like to play with my guitar more in a way of a dervish dance. Have a groove and fly over it.

Opusmodus, MAX/MSP, VCV-rack and DAWs I use mostly generative to be surprised by the results. More of an adventure. I seldom know what will come out at the end.

Most of my playing around I don't keep because having fun was good enough and I can do something else another day. 

The surprising thing is that when I come back to some of the recordings  and I forgot how I did it , I can appreciate it more. 

On the consuming side I am mostly into Mahler, Schubert, Atterberg, Stenhammar String Quartets, Mendelssohn String Quartets, Lachenmann, Rihm and always looking for new stuff. Lately more on the tonal side. I had listend to the whole "Donaueschinger Musiktage" CD collection (all recordings ever done there) for a long time. A lot of stuff and when it became repetitive I came back to the old masters and found my romantic side again.

And for sure I listen to a lot of Jazz, Rock and Electronic. As long as I can feel that the people doing it are having a good time.

 

 

Link to comment
Share on other sites

Ok, I'll order the book1!
What is sorely lacking on the forum are the basic notions (for having fun as you say) and writing very simple things.
My question above is very simple and yet I haven't found an answer on the forum and even less in the software... I find that strange. Is transposing a musical phrase in all keys a routine? !

Good thing you and Janusz responded!

 

Regarding being a true composer and musician, thank you for your recognition.
Sometimes I ask myself the question (if I am a composer) when I come to the forum...

 

Thanks again for your encouragement, I'm going to post more questions on the forum, even if I feel like I'm being ridiculous in face of so many complex things.

Link to comment
Share on other sites

I would also highly recommend taking some time to study Common Lisp, particularly its powerful features for list manipulation. Understanding how to effectively handle lists will not only enhance your coding skills but also allow you to take full advantage of what the language has to offer.

Link to comment
Share on other sites

This book has a very good entry gradient: "Common LISP" by David S. Touretzky

I red some books before that but most took me too far and covert things I didn't care about. This one covers the basic things with good examples.

It was the last book on LISP I bought and it was the most fun.

 

It will take you as most 2 weeks to get the main things. You won't need all for Opusmodus. Mostly list manipulation.

I agree with Janusz. A lot in Opusmodus will make more sense.

In short time things won't look complex at all.

 

There are much, much more things to learn in music (not even talking about learning an instrument) then in LISP.

The theory of LISP is as easy as it can get. I explained it to my wife on a walk through the park and she doesn't need it but got the basics and liked it. Well, there is the next step to apply it.

To our advantage we have the Opusmodus environment to try things and experiment and get good error messages.

 

Maybe we could have a special place in the forum for LISP questions . So the more fluent LISPers can help out the not so fluent.

 

 

 

 

Link to comment
Share on other sites

this book is not translated  French, which means that it will be very complicated for me, I will try to find an equivalent in French.

I'm surprised to hear you say, it's easy!;-)

 

I would say "Maybe we could have a special place in the forum for musique basic"

 

I'm so happy to meet you!!!

Link to comment
Share on other sites

I have just remembered that the book can be read online for free. 

 

Link:

COMMON LISP: A Gentle Introduction to Symbolic Computation

 

I bought the book because I like books.

 

What I meant was an extra category like "function examples" , but named "General LISP" or so .

Yes, one for "General Music Theory" or "Music basics" would be a good one, too.

Opusmodus is where both meet.

 

Yes, the LISP you need for Opusmodus I am certain I can show you in a day, so you can use it.

So when you happen to be in Munich sometime I would enjoy doing this and have some glasses of wine 🙂 

 

Link to comment
Share on other sites

Another way of solving your original request only using Opusmodus-functions could be:

(setf mat '((e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5)
            (e d5 e5 f5 s d5 db5 e c5 d5 e5 s c5 b4)
            (e bb4 c5 d5 s b4 bb4 e a4 bb4 c5 s a4 ab4)
            (e g4 a4 bb4 s g4 gb4 e f4 g4 a4 -e)))
      

(setf theme-tr (assemble-seq 
(pitch-transpose 0 mat)
(pitch-transpose 5 mat)
(pitch-transpose -2 mat)
(pitch-transpose 3 mat)
(pitch-transpose 8 mat)
(pitch-transpose 1 mat)
(pitch-transpose 6 mat)
(pitch-transpose -1 mat)
(pitch-transpose 4 mat)
(pitch-transpose 9 mat)
(pitch-transpose 2 mat)
(pitch-transpose 7 mat))

;;;;;;   or more flexible

(setf t0 (pitch-transpose 0 mat))
(setf t5 (pitch-transpose 5 mat))
(setf t-2 (pitch-transpose -2 mat))
(setf t8 (pitch-transpose 8 mat))
(setf t1 (pitch-transpose 1 mat))
(setf t6 (pitch-transpose 6 mat))
(setf t-1 (pitch-transpose -1 mat))
(setf t9 (pitch-transpose 9 mat))
(setf t2 (pitch-transpose 2 mat))
(setf t7 (pitch-transpose 7 mat))

(setf theme-tr (assemble-seq t0 t5 t-2 t8 t1 t6 t-1 t9 t2 t7))

 

This is also easy editable and expandable and you can do more with it:

(setf theme-tr2 (assemble-seq (rnd-order '(t0 t5 t-2 t8 t1 t6 t-1 t9 t2 t7))))

(setf theme-tr3 (assemble-seq (rnd-order '(t0 t5 t-2 t8 t1 t6 t-1 t9 t2 t7) :seed 2023) ))

(setf theme-tr4 (assemble-seq (reverse '(t0 t5 t-2 t8 t1 t6 t-1 t9 t2 t7) ) ))

(setf theme-tr5 (assemble-seq (rnd-sample 24 '(t0 t5 t-2 t8 t1 t6 t-1 t9 t2 t7) ) ))

 

 

Link to comment
Share on other sites

I find these different ways longer than your first proposal...I note all these possibilities in addition!

thank you so much!!

you are not musicians you say?!;-)
here are the basics of daily work of the jazzman on major scale...you can do the same thing with harmonic, melodic minor scales etc!

it's a fabulous exercise for developing rhythm and harmony at the same time.


finally i found someone to talk to on this forum;-)...without blushing...for a simple and above all useful request.

Link to comment
Share on other sites

Rolf,
To continue with useful questions 

another idea that I haven't found
How can I use in my example rnd-order bar by bar ?

the difficulty here:
This means you have to divide bars in two.
4/4 to 2/4

and
rnd-order will modify degree by degree
then

assemble the parts together to obtain  metric 4/4

(setf mat '((e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5)
            (e d5 e5 f5 s d5 db5 e c5 d5 e5 s c5 b4)
            (e bb4 c5 d5 s b4 bb4 e a4 bb4 c5 s a4 ab4)
            (e g4 a4 bb4 s g4 gb4 e f4 g4 a4 -e)))
      
(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i mat))

thank you in advance for your help

Link to comment
Share on other sites

I think the first example is what you are looking for. But I also tried some other possibilities.

If I got it wrong let me know.

 

(setf mat '((e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5)
            (e d5 e5 f5 s d5 db5 e c5 d5 e5 s c5 b4)
            (e bb4 c5 d5 s b4 bb4 e a4 bb4 c5 s a4 ab4)
            (e g4 a4 bb4 s g4 gb4 e f4 g4 a4 -e)))
      
 (loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i mat))

;;rnd-order events in each bar then transpose the new material
(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect (rnd-order bar :seed 20))))

;;rnd-order only :type (here :pitch, could also be :length etc) in each bar
(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect (rnd-order bar :type :pitch :seed 20))))

;;rnd-order everything with :type :all in each bar
(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect (rnd-order bar :type :pitch :seed 20))))

;; divide each bar in two and switch the two halfs in the bar
(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect 
                             (list (second (gen-divide 5  bar)) (first (gen-divide 5  bar))))))

;; divide each bar in two and only rnd-order the first half 
(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect 
                             (list (rnd-order (first (gen-divide 5 bar)) :seed 20) (second (gen-divide 5 bar))))))

;; divide each bar in two and  rnd-order :type :all of the second half and switch
(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect 
                             (list (rnd-order (second (gen-divide 5 bar)) :type :all :seed 21) (first (gen-divide 5 bar))))))

 

 

Link to comment
Share on other sites

(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect (rnd-order bar :seed 20))))

image.png.49eed264f3ef650aa482e0feebc6aaed.png

this one doesn't work because it changes the rhythm

this one doesn't work either because it uses an integer bar in rnd-order

(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect (rnd-order bar :type :pitch :seed 20))))

image.png.5686ba8a005672893f2fd6030dd86c65.png

for this one same

(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect (rnd-order bar :type :pitch :seed 20))))

this one same. it's a retrograde of the bar with rnd-order

(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect 
                             (list (second (gen-divide 5  bar)) (first (gen-divide 5  bar))))))

Bingo!!! it's the good one!

I would never have found it alone...I will try to understand

(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect 
                             (list (rnd-order (first (gen-divide 5 bar)) :seed 20) (second (gen-divide 5 bar))))))

this one is a bit like the last one!

 

(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect 
                             (list (rnd-order (second (gen-divide 5 bar)) :type :all :seed 21) (first (gen-divide 5 bar))))))

Link to comment
Share on other sites

What do you mean with "uses an integer bar in rnd-order" ?

>>>

this one doesn't work either because it uses an integer bar in rnd-order

(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect (rnd-order bar :type :pitch :seed 20))))

>>>

"bar" will be some like this '(e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5) and not an integer.

 

From your question I would not have guessed that this is what you want.

(loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7)
      append (pitch-transpose i 
                     (loop for bar in mat collect 
                             (list (rnd-order (first (gen-divide 5 bar)) :seed 20) (second (gen-divide 5 bar))))))

 

I was curious for myself how I would divide a bar and work only on half of it because you mentioned "divide".  But this does not rnd-order bar by bar , but half of a bar only.

But good that it helped.

 

 

 

 

Link to comment
Share on other sites

That’s great Rolf, 

 

what is difficult for me is to express my musical thoughts through algorithms.

To make it short, in my example I pass all modes of the major scale...F major here.
Each beginning of degrees expresses a bass 
which means degrees and chords on half measures.

here are the chords used in my example

F - Edim - D- - C - Bb - A- - G- - F

exemple1
(setf mat '((e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5)
             (e d5 e5 f5 s d5 db5 e c5 d5 e5 s c5 b4)
             (e bb4 c5 d5 s b4 bb4 e a4 bb4 c5 s a4 ab4)
             (e g4 a4 bb4 s g4 gb4 e f4 g4 a4 -e)))

 

exemple2 corrected by hand to obtain random mode by half bar

(setf mat '((e f5 g5 a5 s gb5 f5) (e e5 f5 g5 s e5 eb5)
             (e d5 e5 f5 s d5 db5)(e c5 d5 e5 s c5 b4)
             (e bb4 c5 d5 s b4 bb4)(e a4 bb4 c5 s a4 ab4)
             (e g4 a4 bb4 s g4 gb4)(e f4 g4 a4 -e)))

 

thank you very much for your interest in my case 😉

 

I started the book that you recommended to me...I'm very excited;-(((

I think I'll come to Munich for a drink with you so you can explain it to me ;-)))

 

 

Link to comment
Share on other sites

 

'(e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5) is a omn-list. 

e f5 is an omn-event with mf as a default velocity. 

You can express an omn-list as events by calling 

(single-events '(e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5))

=>((e f5 mf) (e g5 mf) (e a5 mf) (s gb5 mf) (s f5 mf) (e e5 mf) (e f5 mf) (e g5 mf) (s e5 mf) (s eb5 mf))

gen-divide is described in the function-document as :

GEN-DIVIDE can be used to divide a sequence into sublists of a given size.

When gen-divide sees an omn-list it counts events and then divides the event-list in given size. 

The 5 is the number of events. Only in your example it is 5, because each bar has 10 events.

It is not really dividing into 2/4 . It just splits the list in 5 events each.

Try (gen-divide 2 '(e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5)) or (gen-divide 3 ...)

 

 

 

 

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