Jump to content

Recommended Posts

Dear All,


I´m doing some melodic permutations and I have a question about replace-map:

Here are four elements permutations, generated by:

(permute '(1 2 3 4))
(setf permut4 '((1 2 3 4) (1 2 4 3) (1 3 2 4) (1 3 4 2) (1 4 2 3)
                (1 4 3 2) (2 1 3 4) (2 1 4 3) (2 3 1 4) (2 3 4 1)
                (2 4 1 3) (2 4 3 1) (3 1 2 4) (3 1 4 2) (3 2 1 4)
                (3 2 4 1) (3 4 1 2) (3 4 2 1) (4 1 2 3) (4 1 3 2)
                (4 2 1 3) (4 2 3 1) (4 3 1 2) (4 3 2 1)))

Here are the pitch material to be permutated:

(setf permutcontent '((1 cs4) (2 d4) (3 e4) (4 g4)))

I used the REPLACE MAP FUNCTION, like this:

(replace-map permutcontent permut4)



((c4 d4 e4 g4) (c4 d4 g4 e4) (c4 e4 d4 g4) (c4 e4 g4 d4) (c4 g4 d4 e4)
 (c4 g4 e4 d4) (d4 c4 e4 g4) (d4 c4 g4 e4) (d4 e4 c4 g4) (d4 e4 g4 c4)
 (d4 g4 c4 e4) (d4 g4 e4 c4) (e4 c4 d4 g4) (e4 c4 g4 d4) (e4 d4 c4 g4)
 (e4 d4 g4 c4) (e4 g4 c4 d4) (e4 g4 d4 c4) (g4 c4 d4 e4) (g4 c4 e4 d4)
 (g4 d4 c4 e4) (g4 d4 e4 c4) (g4 e4 c4 d4) (g4 e4 d4 c4))



What if I want to replace one item (like a pitch) for a list of melodic pitches ?

How to proceed ?


For example:

Instead of substitute a C4 for the number 1, I want to substitute a list of notes, like (cs4 ds4)

(setf permutcontent '((1 cs4 ds4) (2 d4) (3 e4) (4 g4)))


When I set this, a get only the cs4 permeated...





I got it !


All the material must have the same number of elements, like

(setf permutcontent '((1 (c4 cs4)) (2 (b4 ds4)) (3 (c5 f4)) (4 (cs5 ds4))))


Resulting in:

((c4 cs4) (b4 ds4) (c5 f4) (cs5 ds4))
((c4 cs4) (b4 ds4) (cs5 ds4) (c5 f4))
((c4 cs4) (c5 f4) (b4 ds4) (cs5 ds4))
((c4 cs4) (c5 f4) (cs5 ds4) (b4 ds4))
((c4 cs4) (cs5 ds4) (b4 ds4) (c5 f4))
((c4 cs4) (cs5 ds4) (c5 f4) (b4 ds4))
((b4 ds4) (c4 cs4) (c5 f4) (cs5 ds4))
((b4 ds4) (c4 cs4) (cs5 ds4) (c5 f4))
((b4 ds4) (c5 f4) (c4 cs4) (cs5 ds4))
((b4 ds4) (c5 f4) (cs5 ds4) (c4 cs4))
((b4 ds4) (cs5 ds4) (c4 cs4) (c5 f4))
((b4 ds4) (cs5 ds4) (c5 f4) (c4 cs4))
((c5 f4) (c4 cs4) (b4 ds4) (cs5 ds4))
((c5 f4) (c4 cs4) (cs5 ds4) (b4 ds4))
((c5 f4) (b4 ds4) (c4 cs4) (cs5 ds4))
((c5 f4) (b4 ds4) (cs5 ds4) (c4 cs4))
((c5 f4) (cs5 ds4) (c4 cs4) (b4 ds4))
((c5 f4) (cs5 ds4) (b4 ds4) (c4 cs4))
((cs5 ds4) (c4 cs4) (b4 ds4) (c5 f4))
((cs5 ds4) (c4 cs4) (c5 f4) (b4 ds4))
((cs5 ds4) (b4 ds4) (c4 cs4) (c5 f4))
((cs5 ds4) (b4 ds4) (c5 f4) (c4 cs4))
((cs5 ds4) (c5 f4) (c4 cs4) (b4 ds4))
((cs5 ds4) (c5 f4) (b4 ds4) (c4 cs4)))


But would be nice to MIX different number of elements...

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.

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.

  • Similar Topics

    • By PatrickMimran
      I would like to know what the more efficient way , when creating a lot of  custom function to be included in the Extension folder:
      to group all the function in the same file
      or to distribute them over several files .  Or one function by file or it doesn't matter 
      Thank you   Patrick
    • By NagyMusic
      I understand that the first argument value in the ambitus-chord function represents the outer-interval size measured by an integer or a list of integers. What does the second value in the size argument list affect when processing two [or more] chords, as illustrated in the example below? Is the second value affecting the second chord in the first list or both chords in the second list? Thank you!
      (ambitus-chord '(14 6) '((eb4c6 c4fs4 b4) (c4b4 b3eb5b3)))  
    • By NagyMusic
      After a short break, I'm slowly coming back to Opusmodus, mainly by working through functions examples. Looking at the gen-ambitus-series
      function example below, would someone be willing to explain why the ambitus function is not producing all diatonic pitches included in list_? I understand that I may want to use harmonic-path or similar instead, but I just wanted to ask for the learning experience. I feel like I might be missing something so I welcome the feedback!
      (setf range_ (gen-ambitus-series '(-10 30) (vector-smooth 0.2 (gen-white-noise 6 :seed 23)) (vector-smooth 0.2 (gen-white-noise 8 :seed 24)))) (integer-to-pitch range_) (setf list_ '((c4 d4 e4 f4 g4 a4 b4 c5) (c4 d4 e4 f4 g4 a4 b4 c5) (c4 d4 e4 f4 g4 a4 b4 c5) (c4 d4 e4 f4 g4 a4 b4 c5) (c4 d4 e4 f4 g4 a4 b4 c5) (c4 d4 e4 f4 g4 a4 b4 c5) (c4 d4 e4 f4 g4 a4 b4 c5) (c4 d4 e4 f4 g4 a4 b4 c5) )) (ambitus range_ list_) Perhaps a different example may illustrate my question better. Below we have a series of transformation of the given harmonic sequence. The pitches (pitch classes) of the harmonic sequence are retained with each individual ambitus transformation, but not when gen-ambitus-series is used (see below). Thanks!
      (setf omn '((h e4f5 p c5a4) (h b3d3 gs4eb2fs3) (h bb2g5cs5 gs4d4eb2) (w bb2 mp) (h g3f4cs5 p c5) (h fs5a5b3 e4b3) (h bb2) (w e2eb4) (h c5cs6 a5) (h f4g3 gs4d3) (h fs5 bb2fs5g3) (h d3e5eb4 gs4) (h a2c6 f2) (h b0 cs6c5) (h gs4d3))) (ambitus '(-6 12) omn) (setf range (gen-ambitus-series '(-30 42) (vector-smooth 0.2 (gen-white-noise 15 :seed 23)) (vector-smooth 0.2 (gen-white-noise 15 :seed 24)))) (ambitus range omn)  
  • Create New...