Jump to content

Clauses, String Quartet and VSL


Recommended Posts

An example with DEF-CASE and Vienna Symphonic Library sound sets.

Initialise random seed to all the other functions which may also use random seed.

(init-seed 98)

 

Global value 20 assign to a variable LEN.

(setf len '20)
 
Complex length generator using cartesian sets - combinatory possibilities.
(setf v1-gcl (gen-length-cartesian
              2 3 'm 'n (rnd-sample len '(q q h))
              (rnd-sample len '(2 3))
              (rnd-sample len (primes 5 3))
              (rnd-sample len '(1 2 3 4 5))))

(setf v2-gcl (gen-length-cartesian
              2 3 'd '? (rnd-sample len '(q q h))
              (rnd-sample len '(2 3))
              (rnd-sample len (primes 5 3))
              (rnd-sample len '(1 2 3 4 5))))

(setf va-gcl (gen-length-cartesian
              2 3 'd '? (rnd-sample len '(q q h))
              (rnd-sample len '(2 3))
              (rnd-sample len (primes 5 3))
              (rnd-sample len '(1 2 3 4 5))))

(setf vc-gcl (gen-length-cartesian
              2 3 'd '? (rnd-sample len '(q q h))
              (rnd-sample len '(2 3))
              (rnd-sample len (primes 5 3))
              (rnd-sample len '(1 2 3 4 5))))
 
Aligning all lists by adding rests to the end of the lists.
(setf str-la (length-align
              (list v1-gcl v2-gcl va-gcl vc-gcl)
              :type 'r :position 'e))
 
Rearranging lists to produce unison moments.
(setf str-unison (gen-unison str-la :unison '(1 2 3 1)))
 
Assigning VN variables to the str-unison lists - VN0, VN1, etc...
(assign-vars 'vn str-unison)
 
The initial interval list.
(setq intervals
      '((2) 6 (0 -6) (-1 -6) 0 (-1 10) -13 (3 6)
        (-1 6) 9 0 0 6 0 (-6 -13) -8 -11 0 (0 11)
        (-3 6) -14 (0 14) -6 (3 6) (-6 6) (-2 -13)
        20 (9 -6) 11 (-6 2) (-2 -6) -13 9 10 6 0
        (-13 6) -9 16 (-10 -11) -8 (2 -6) -2 35 0
        (-6 2) (-8 -2) -8 (2 -6) (10 6) 0 (-20 13)
        (-9 -10) (11 -11) (8 6) (0 -2) (2 -6) -1
        (5 6) 4 (10 -6) -23 11 6 (-2 2) 6 6 4 (-6 2)
        4 -14 6 (-13 6) (2 2) 11 -6 (6 -13) 8))
 
Interval list of 200 fragments with length of 3, 4 or 5 values.
(setf mat (flatten-sublist (gen-fragment 200 '(3 4 5) intervals :lists t)))
 
Interval to pitch with start pitch 'a5.
(setf str-pitch (flatten (interval-map 'a5 mat)))
 
Distribution of a single pitch stream to a series of voices, consecutively.
(setf str-cd (consecutive-distribute str-pitch vn0 vn1 vn2 vn3))
 
Assigning PITCH variables to the str-cd lists - PITCH0, PITCH1, etc...
(assign-vars 'pitch str-cd)
 
Align the number of pitches to match the number of length.
(setf v1-span (span vn0 pitch0))
(setf v2-span (span vn1 pitch1))
(setf va-span (span vn2 pitch2))
(setf vc-span (span vn3 pitch3))
 
Variant process of common variant forms on lists of pitches.
(setf v1-pv (pitch-variant v1-span :variant '?))
(setf v2-pv (pitch-variant v2-span :variant '?))
(setf va-pv (pitch-variant va-span :variant '?))
(setf vc-pv (pitch-variant vc-span :variant '?))
 
Setting the instrument AMBITUS (range).
(setf v1-p (ambitus '(g3 g6) v1-pv))
(setf v2-p (ambitus '(g3 g6) v2-pv))
(setf va-p (ambitus '(c3 g6) va-pv))
(setf vc-p (ambitus '(c2 c5) vc-pv))
 
Finding unique lengths.
;(setf len-unique (length-note-unique vn0 vn1 vn2 vn3))
;=> (1/20 1/16 1/12 1/10 1/8 3/20 1/6 1/5 1/4 3/10 1/2)
 
Defining a function ART name and list of clauses.
(def-case art
  (1/20 'leg)
  (1/16 'leg)
  (1/12 (rnd-pick '(stacc pizz snap)))
  (1/10 'leg)
  (1/8 (rnd-pick '(stacc pizz snap)))
  (3/20 (rnd-pick '(stacc pizz snap)))
  (1/6 'non-vib)
  (1/5 'tasto)
  (1/4 (rnd-pick '(tasto ponte)))
  (3/10 (rnd-pick '(tasto ponte)))
  (1/3 'tasto+trem)
  (1/2 'tasto)
  (otherwise (rnd-pick '(ord tasto))))
 
Processing ART clauses.
(setf v1-art (mapcar 'art vn0))
(setf v2-art (mapcar 'art vn1))
(setf va-art (mapcar 'art vn2))
(setf vc-art (mapcar 'art vn3))
 
Defining a function name DYN and list of clauses.
(def-case dyn
  (1/20 'mf)
  (1/16 'mf)
  (1/12 (rnd-pick '(p mp mf)))
  (1/10 (rnd-pick '(p mp mf)))
  (1/8 (rnd-pick '(pp p mp)))
  (3/20 (rnd-pick '(pp p mp)))
  (1/6 (rnd-pick '(pp p mp)))
  (1/5 (rnd-pick '(ppp pp p)))
  (1/4 (rnd-pick '(ppp pp p)))
  (3/10 (rnd-pick '(pppp ppp pp)))
  (1/3 (rnd-pick '(pppp ppp)))
  (1/2 'pppp)
  (otherwise (rnd-pick '(pp p))))
 
Processing DYN clauses.
(setf v1-v (mapcar 'dyn vn0))
(setf v2-v (mapcar 'dyn vn1))
(setf va-v (mapcar 'dyn vn2))
(setf vc-v (mapcar 'dyn vn3))
 
Assemble the separate parameters to OMN script.
(setf v1-omn (make-omn
              :length vn0
              :pitch v1-p
              :velocity v1-v
              :articulation v1-art))

(setf v2-omn (make-omn
              :length vn1
              :pitch v2-p
              :velocity v2-v
              :articulation v2-art))

(setf va-omn (make-omn
              :length vn2
              :pitch va-p
              :velocity va-v
              :articulation va-art))

(setf vc-omn (make-omn
              :length vn3
              :pitch vc-p
              :velocity vc-v
              :articulation vc-art))
 
Converting material to pauses.
(setf pause1 (gen-pause v1-omn))
(setf pause2 (gen-pause v2-omn))
(setf pause3 (gen-pause va-omn))
(setf pause4 (gen-pause vc-omn))
(setf pause (gen-repeat 6 '((-q))))
 
Rearranging the bars and assembling a final instrument.
(setf v1-seq (assemble-subseq
              '((v1-omn :start 5 :end 5)
                (pause :start 1 :end 2)
                (v1-omn :start 2 :end 2)
                (v1-omn :start 3 :end 3)
                (pause :start 1 :end 1)
                (v1-omn :start 7 :end 9)
                (v1-omn :start 6 :end 7)
                (v1-omn :start 8 :end 8))))

(setf v2-seq (assemble-subseq
              '((v2-omn :start 5 :end 5)
                (pause :start 1 :end 2)
                (v2-omn :start 2 :end 2)
                (v2-omn :start 3 :end 3)
                (pause :start 1 :end 1)
                (v2-omn :start 7 :end 9)
                (v2-omn :start 4 :end 5)
                (v2-omn :start 8 :end 8))))

(setf va-seq (assemble-subseq
              '((va-omn :start 5 :end 5)
                (pause :start 1 :end 2)
                (va-omn :start 2 :end 2)
                (va-omn :start 3 :end 3)
                (pause :start 1 :end 1)
                (va-omn :start 18 :end 20)
                (va-omn :start 4 :end 5)
                (va-omn :start 8 :end 8))))

(setf vc-seq (assemble-subseq
              '((vc-omn :start 7 :end 7)
                (pause :start 1 :end 2)
                (vc-omn :start 2 :end 2)
                (vc-omn :start 3 :end 3)
                (vc-omn :start 10 :end 10)
                (pause4 :start 7 :end 9) 
                (vc-omn :start 5 :end 6)
                (vc-omn :start 8 :end 8))))
 
Test if two tone chords are playable.
(setf v1 (instrument-clause :violin v1-seq))
(setf v2 (instrument-clause :violin v2-seq))
(setf va (instrument-clause :viola va-seq))
(setf vc (instrument-clause :cello vc-seq))
 
Generating a tempo list changes.
(setf tempo (gen-tempo '(30 40 72)'(1 2) vc))
 
Defining the score.
(def-score clauses
           (:composer "OPMO"
            :copyright "Opusmodus"
            :key-signature 'atonal
            :time-signature (get-time-signature vc)
            :tempo tempo
            :layout (string-quartet-layout 'violin1 'violin2 'viola 'cello))
  (violin1 :omn v1 :port 0 :channel 1 :sound 'vsl-violin-solo :pan 32)
  (violin2 :omn v2 :channel 2 :sound 'vsl-violin-solo :pan 50)
  (viola :omn va :channel 3 :sound 'vsl-viola-solo :pan 75)
  (cello :omn vc :channel 4 :sound 'vsl-cello-solo :pan 95))

 

The score in OMN script reads as follows:

Violin 1
v1
=> ((q d4 pp tasto e4 p ponte g3fs4 tasto b4bb5 tasto h e5bb5 pppp tasto)
    (-q) (-q) (-5q - 5qqq a4bb5 p ord f6 ord -5q - 3q f6e6 mp snap - - -h.)
    (q d4 pp tasto -e - -q gs3 p tasto 5w c4fs4 pp tasto -5h - -)
    (-q) (-e fs4 p ord 5h c4 pizz -5q - - e gs3 mp -s -)
    (5h g5a5 mp leg f6fs6 leg fs6c6 leg gs5 mf leg e4 mp leg e cs4 pp pizz
        eb4cs4 p snap gs3 mp stacc a3 p snap f5b5 pp stacc f4 mp stacc
        c4 p pizz cs4g4 mp snap)
    (q gs3d4 pp ponte e eb4a3 mp stacc -s - -w)
    (q f4g3 ppp ponte -e - q d4 p ord -e - 5hhh eb4 tasto -5h -)
    (-e fs4 p ord 5h c4 pizz -5q - - e gs3 mp -s -)
    (5h g5a5 mp leg f6fs6 leg fs6c6 leg gs5 mf leg e4 mp leg e cs4 pp pizz
        eb4cs4 p snap gs3 mp stacc a3 p snap f5b5 pp stacc f4 mp stacc
        c4 p pizz cs4g4 mp snap))
 
Violin 2
v2
=> ((q bb5 pp ponte b3 tasto p ponte c4bb4 ponte h d4 pppp tasto)
    (-q) (-q) (q gs3 pp tasto gs3 tasto cs4 ponte c4bb4 tasto h d4e4 pppp tasto)
    (q e4 p ponte -e - -q a3gs4 ord 5w fs4gs3 pp ord -5h - -) (-q)
    (-e g4 p tasto 5h a3eb4 mp snap -5q - - e gs4 mf -s -)
    (5h c4bb4 mp leg a3 leg cs4 leg d4 leg d4 leg e a3 snap cs4 pizz
        cs4eb4 pizz e4 pp snap f5 mp pizz f6 pizz bb5 stacc bb5 stacc)
    (q bb3a4 pp ponte e fs4 stacc -s - -w)
    (e gs5fs5 pp stacc fs5gs4 pizz 5q a4 mf leg a4 leg cs4d4 leg cs4 leg gs3 -h)
    (q bb5 pp ponte b3 tasto p ponte c4bb4 ponte h d4 pppp tasto)
    (5h c4bb4 mp leg a3 leg cs4 leg d4 leg d4 leg e a3 snap cs4 pizz
        cs4eb4 pizz e4 pp snap f5 mp pizz f6 pizz bb5 stacc bb5 stacc))

 

Viola

va
=> ((q b4 ppp ponte bb4 p tasto cs3g3 pp tasto bb3e3 tasto h eb3d4 pppp tasto) (-q) (-q)
    (q eb5 ppp tasto g3 pp ponte fs3c4 p tasto e3eb4 pp tasto h b4 pppp tasto)
    (5qqq f3b3 pp pizz -5q - - - - 5h d3 p ord -3q - d3 ord -h.)
    (-q) (-e a3eb3 p tasto 5qqq fs3c4 pizz -5q - -q)
    (-e e3bb3 pp tasto bb3 snap - q fs3c4 p snap -)
    (e f3 p pizz - - cs3c4 tasto q fs3gs3 pp ord -h.)
    (e d3 pp pizz f3b3 pizz 5q bb3gs3 mf leg a4gs5 leg f4 leg d5gs5 leg bb4 -h)
    (q b4 ppp ponte bb4 p tasto cs3g3 pp tasto bb3e3 tasto h eb3d4 pppp tasto)
    (5h e3 mp leg d3 p leg eb3 leg gs3 mp leg gs3d3 leg e a3 pp snap
        e3 mp pizz f3e4 pp pizz a4b4 mp pizz f5g5 stacc b5 pizz
        d6 pp stacc bb5 snap))

 

Violoncello

vc
=> ((3q cs4b4 mp pizz a3eb4 p pizz gs4fs3 mf stacc q d4c4 pp ponte c4 tasto)
    (-q) (-q) (-5q - 5qqq c3 p tasto f3 pp ord -5q - 3q bb4e4 mp snap - - -h.)
    (q bb2 p tasto gs2d2 pp tasto h cs2 pppp tasto e fs2c3 mp pizz
       cs4 p stacc d2 pp stacc d2 snap)
    (-e cs3b2 pp tasto g2 mp snap - q fs2 pp pizz -) (-h.) (-w.) (-w.)
    (q b4 ppp ponte e4 p ponte f2 pp tasto eb2 ppp tasto h d2 pppp tasto)
    (5h d4c4 leg fs4c4 leg eb4 leg p leg cs4 mf leg bb3a2 leg a3 p leg
        g3cs3 mp leg d3e2 p leg cs2 leg h c2 pppp tasto)
    (5h cs2g2 leg a2eb2 leg fs2 p leg g2 leg gs2 mp leg e gs2a3 p stacc
        f3 snap pp pizz b4 p stacc g4 pp snap bb4e4 p stacc b4 pp snap bb4a4 snap))
Link to comment
Share on other sites

Very interesting. Thank you for this beautiful and intriguing score Janusz.

I like particularly the assembly technique of the piece and the use of :start and :end in:

(setf v1-seq (assemble-subseq
              '((v1-omn :start 5 :end 5)
                (pause :start 1 :end 2)
                ...)))
 
also instrument clauses is a very interesting concept.
 
SB
Link to comment
Share on other sites

When evaluating any of the  v1-gcl  v2-gcl  etc ... 

 (rnd-sample len (primes 5 3))

 

I get this error message:

> Error: Too many arguments in call to #<Compiled-function primes #x3000010BC1BF>:
>        2 arguments provided, at most 1 accepted. 
> While executing: primes, in process Listener-1(9).
> Type cmd-. to abort, cmd-\ for a list of available restarts.
> Type :? for other options.

 

something wrong?

Link to comment
Share on other sites

I like it. And thanks for your score. This gives me the opportunity to discover new functions. But as I am only at the stage of discovering Opusmodus I sometimes fraught with misunderstandings about certain features. 

So on the first, GEN-CARTESIAN
(setf v1-gcl
      (gen-length-cartesian 
       2 3 'm' n (rnd-sample len (QQH))
       ;(2 3) is low and hight? 'm maximum? 
       
       (rnd-sample len (2 3))
       ;Does this correspond to length -value? 
       
       (rnd-sample len (primes))
       ;Is that it gives the value of tuples to size or is it the values of group-count? 
       
       (rnd-sample len (1 2 3 4 5))
       ;Again, is that this tuple-value?
       ))

 

Sorry for these basic questions but I find Opusmodus and I like to understand the process of a function to be able to use it knowingly.

I tried to change the values to see "combinatory possibilities" but I freezes, I block the calculation in the assessment. Do you have one or more examples of possible combinations? 
 
PS: again, the rendering with native instruments and articulations in Notion 5 after XML export score is excellent.
Link to comment
Share on other sites

The GEN-LENGTH-CARTESIAN is a complex function and needs an understanding of the CARTESIAN set.
The CARTESIAN function will return all the combinatory possibilities drawn from two or more sets.

If you use too many sets then the combinatory possibilities could go on for ever and the program could stop being responsive.
The critical part is the number of sets and not the length of the set.

Two sets of any length will compute a result very quickly.
In Lisp we can test any function run time with TEST macro.

(test (cartesian '((a b c d) (1 2 3 4))))

 

The result of the test is:

(cartesian '((a b c d) (1 2 3 4)))
took 11 microseconds (0.000011 seconds) to run.
During that period, and with 8 available CPU cores,
     11 microseconds (0.000011 seconds) were spent in user mode
      4 microseconds (0.000004 seconds) were spent in system mode
 1,760 bytes of memory allocated.

 

Example with 2 sets each with 12 numbers.
As we can see it took 22 microseconds to run the function.

(time (cartesian '((0 1 2 3 4 5 6 7 8 9 10 11) (0 1 2 3 4 5 6 7 8 9 10 11))))

 

The result of the test is:

(cartesian '((0 1 2 3 4 5 6 7 8 9 10 11) (0 1 2 3 4 5 6 7 8 9 10 11)))
took 22 microseconds (0.000022 seconds) to run.
During that period, and with 8 available CPU cores,
     21 microseconds (0.000021 seconds) were spent in user mode
      8 microseconds (0.000008 seconds) were spent in system mode
 9,568 bytes of memory allocated.
 1 minor page faults, 0 major page faults, 0 swaps.

 

Here an example with 4 sets of 12 it took 1,926 microseconds (0.001926 seconds) to run.

With 12 sets of 12 the run time would take for 'ever'.

(cartesian '((0 1 2 3 4 5 6 7 8 9 10 11) (0 1 2 3 4 5 6 7 8 9 10 11)
             (0 1 2 3 4 5 6 7 8 9 10 11) (0 1 2 3 4 5 6 7 8 9 10 11)))
took 1,926 microseconds (0.001926 seconds) to run.
       970 microseconds (0.000970 seconds, 50.36%) of which was spent in GC.
During that period, and with 8 available CPU cores,
     2,893 microseconds (0.002893 seconds) were spent in user mode
       304 microseconds (0.000304 seconds) were spent in system mode
 1,089,920 bytes of memory allocated.

 

Arguments and Values:

(gen-length-cartesian
 1                                     ; min divide value
 3                                     ; max divide value
 'm                                    ; argument for group division or maximum count (no division)
 'n                                    ; rest position
 (rnd-sample 20 '(q q h) :seed 12)     ; the root length value of the list.
 (rnd-sample 20 '(2 3) :seed 12)       ; number of tuplets groups in the list (numbers of the root length)
 (rnd-sample 20 (primes 5 3) :seed 12) ; this is the length (count) of each if the list.
 (rnd-sample 20 '(1 2 3 4 5) :seed 12) ; tuplets value (division).

 

Same as above:

(gen-length-cartesian 1 3 'm 'n
 '(h q h q q q h h q q q h q h q q h h h q)
 '(3 3 3 2 2 2 3 3 2 2 2 3 2 3 2 3 3 3 3 2)
 '(13 7 13 5 3 5 13 11 7 5 5 11 5 13 5 7 13 11 13 7)
 '(5 3 5 2 1 2 5 4 3 2 2 4 2 5 2 3 5 4 5 3))

 

More GEN-LENGTH-CARTESIAN examples:

(gen-length-cartesian 1 1 'd 'n 'q '(2 3) '(13 4) '(1 2 3 4))
=> ((1/16 1/16 1/16 1/16 1/4 1/16 1/16 1/16 1/16 1/16 1/16 1/16 1/16)
    (1/4 1/8 1/8 1/4))
(gen-length-cartesian
 1 2 'd 'n 'q '(2 3) '(13 4) '(1 2 3 4))
=> ((1/6 1/12 1/12 1/6 1/16 1/16 1/8 1/6 1/12) (1/4 1/4 1/8 1/8))
(gen-length-cartesian
 1 1 'd 'n 'q '(2 3) '(7 5) '(1 2 3 4))
=> ((1/12 1/12 1/12 1/16 1/16 1/16 1/16) (1/4 1/4 1/12 1/12 1/12))
(gen-length-cartesian
 1 3 'd 'n 'q '(2 3) '(7 5) '(1 2 3 4))
=> ((1/6 1/12 1/8 1/16 1/16) (1/8 1/8 1/4 1/8 1/8))

Low, High and Maximum:

(gen-length-cartesian 1 3 'm 'n '(h) '(3) '(13) '(1 2 3 4 5))
 
The root length value is 'h 1/2.
There are 3 groups of lengths, each 1/2 in value - (* 3 1/2) = 3/2
The length count is 13.
The tuplets values are (1 2 3 4 5).
 
Result:
=> ((1/10 1/10 1/10 1/10 1/10 1/6 1/6 1/6 1/10 1/10 1/10 1/10 1/10))
 
The length span of the list is 3/2 with three groups of tuplets; 2 quintuplets and 1 of triplet.
The low and high multiplier is not used here, as the divide argument 'm (maximum) dose not permit any divisions.
 
Same example as above but this time with the division 'd argument:
(gen-length-cartesian 1 3 'd 'n '(h) '(3) '(13) '(1 2 3 4 5))
=> ((1/5 3/10 1/5 3/10 1/6 1/3))

 

In this example we may end up with longer run time.

(gen-length-cartesian 1 1 'm 'n '(h) '(7) '(11) '(1 2 3 4 5))
=> ((1/2 1/2 1/4 1/4 1/2 1/2 1/4 1/4 1/6 1/6 1/6))

 

The important part here is to balance the length span (group sum length-value),
the size (list length) and finally the tuplet-value.

If GEN-LENGTH-CARTESIAN is difficult to use please check the GEN-TUPLET function.
This function is part of the GEN-LENGTH-CARTESIAN function and will allow you to get the same result without the worry about the CARTESIAN sets.

Link to comment
Share on other sites

Hi Janusz, 
Many thanks for your explanations. This is really clear with your examples.
On the test with CARTESIAN, unfortunately, my Imac is much slower than your Mac. It is a Imac 21 i7 8 Go 2,8 GHZ and 4 coeurs.
On the test:
(cartesian '((0 1 2 3 4 5 6 7 8 9 10 11)
             (0 1 2 3 4 5 6 7 8 9 10 11)
             (0 1 2 3 4 5 6 7 8 9 10 11)
             (0 1 2 3 4 5 6 7 8 9 10 11)))

 

The calcul of time is a order of 47 secondes (what is your tool/utilitaire for the accurate of calcul ?)  

Otherwise, thanks for the differents exemples with GEN-LENGTH-CARTESIAN,  I understand better and it confirms what I had explored this fonction. It also gives me an explanation of the vert, very long time to process some changes that I had made with the cartesian test. 
I'm going to test now. 
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