Mapping

m-delta-time

voice-number length-list delta-time

1
2
3
4
5
6
7
8
9
10
11
12
13
14
(setq length1 '(-1/4 1/8 1/8 -1/20 1/20 2/20 -1/20 1/12 -2/12))
(setq delta1 '(1/2 3/4 1/2 3/4 5/4))
 
(m-delta-time 1 length1 delta1)
--> (-1/4 1/2 5/4)
 
(m-delta-time 2 length1 delta1)
--> (-3/8 3/4 -7/8)
 
(m-delta-time 3 length1 delta1)
--> (-11/20 1/2 -19/20)
 
(m-delta-time 4 length1 delta1)
--> (-3/5 3/4 -13/20)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(setq length2 '(-480 240 240 -96 96 192 -96 160 -320))
(setq delta2 '(1440 960 960 1200 960))
 
(m-delta-time 1 length2 delta2)
--> (-480 1440 -480)
 
(setq len1 (m-delta-time 1 length1 delta1))
--> (-1/4 1/2 5/4)
 
(setq len2 (m-delta-time 2 length1 delta1))
--> (-3/8 3/4 -7/8)
 
(setq len3 (m-delta-time 3 length1 delta1))
--> (-11/20 1/2 -19/20)
 
(setq len4 (m-delta-time 4 length1 delta1))
--> (-3/5 3/4 -13/20)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(setq length
      (qlength
       '((28-01[-5] 20-2[-3] 4-0 12-1[-2]
          4-1 28-01[-5] 20-2[-5]1[-2])
         (20-[-2][11][-2]1[-4]1[-8]1[-3][17]))))
 
(setq positive (l-count :note :content length))
 
(setq delta-sel
      (cfunction
       (gen-noise-white
        (apply '+ positive) 1.0 0.444555) '(1/2 3/4 5/4)))
 
(setq delta (symbol-divide positive nil nil delta-sel))
 
(setq v1 (m-delta-time 1 length delta))
--> ((-1/28 5/4 1/2 -9/140 3/4) (-1/10 5/4 -1/10 1/2 -19/20))
 
(setq v2 (m-delta-time 2 length delta))
--> ((-1/4 5/4 1/2 -3/5) (-3/4 3/4 -3/20 5/4))
 
(setq va (m-delta-time 3 length delta))
--> ((-3/4 5/4 -3/5) (-1/1 3/4 -23/20))
 
(setq vc (m-delta-time 4 length delta))
--> ((-1/1 1/2 -11/10) (-29/10))

m-consecutive-distribute

symbols &rest length-lists

Use this function for ‘orchestrating’ the items in a symbol list sequentially to players in an ensemble. In the example below a list of is processed against lists of variables containing note-lengths belonging to an ensemble of players.

1
2
3
4
5
6
7
8
9
(setq sym '(a b c d e f g h i j k l))
 
(setq l1 '(1/8 -1/8  2/8 -1/8 5/8))
(setq l2 '(1/8  1/8 -1/8  2/8 1/8))
(setq l3 '(-2/8  1/8 -5/8  1/8))
(setq l4 '(-1/8  3/8  1/8  1/8))
 
(setq mcd (m-consecutive-distribute sym l1 l2 l3 l4))
--> ((a e i) (b c g j) (f l) (d h k))

The output produces a consecutive list of symbol lists which must then be extracted using car or its MRAC option 1~, 2~ etc.

1
2
3
4
5
6
7
8
9
10
11
(setq violin1 (1~ mcd))
--> (a e i)
 
(setq violin2 (2~ mcd))
--> (b c g j)
 
(setq viola (3~ mcd))
--> (f l)
 
(setq cello (4~ mcd))
--> (d h k)

m-consecutive-collect

symbols lengths

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(setq
 s1 '(a b c)
 s2 '(d e f g)
 s3 '(h i)
 s4 '(j k l)
)
 
(setq
 l1 '(1/8 -1/8  2/8 -1/8 5/8)
 l2 '(1/8  1/8 -1/8  2/8 1/8)
 l3 '(-2/8  1/8 -5/8  1/8)
 l4 '(-1/8  3/8  1/8  1/8)
 )
 
(m-consecutive-collect
 (list s1 s2 s3 s4)
 (list l1 l2 l3 l4))
 
--> (a d e j b h f k c g l i)

m-substitute

seed type otherwise new elem list

type – :repeat :rnd

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 (m-substitute
  0.32
  :repeat
  '(harm harmfx)
  '((spicc trem) (pizz stacc) (vln-nv vln-leg)
    (spicc trem) (pizz stacc) (legato-pp))
  '(1/8 1/16 1/4)
  '(1/16 1/16 1/16 1/2 1/16 1/16 1/4))
 
--> (pizz pizz pizz harm pizz pizz vln-leg)
 
(m-substitute
 0.32
 :rnd
 '(harm harmfx)
 '((spicc trem) (pizz stacc) (vln-nv vln-leg)
   (spicc trem) (pizz stacc) (legato-pp))
 '(1/8 1/16 1/4)
 '(1/16 1/16 1/16 1/2 1/16 1/16 1/4))
 
--> (stacc pizz stacc harm pizz pizz vln-nv)
 
(m-substitute
 0.32
 :repeat
 '(harm harmfx)
 '((spicc trem) (pizz stacc)
   (vln-nv vln-leg) (spicc trem) (pizz stacc) (legato-pp))
 '(1/8 1/16)
 '((1/8 1/16 1/16 1/2 1/16 3/16 1/4)
   (1/16 1/16 1/16 1/16 1/16 1/16 1/4)))
 
--> ((spicc pizz pizz harmfx pizz harm harmfx)
     (pizz pizz pizz pizz pizz pizz harmfx))
 
(m-substitute
 0.32
 :rnd
 '(harm harmfx)
 '((spicc trem) (pizz stacc) (vln-nv vln-leg) (spicc trem)
   (pizz stacc) (legato-pp))
 '(1/8 1/16)
 '((1/8 1/16 1/16 1/2 1/16 3/16 1/4)
   (1/16 1/16 1/16 1/16 1/16 1/16 1/4)))
 
--> ((trem pizz pizz harmfx pizz harm harmfx)
     (stacc stacc pizz stacc stacc pizz harmfx))

m-if

otherwise if-item and-item than-item if-pattern and-pattern

Mircotonal example

1
2
3
4
5
(m-if 0 '(90 50 30) '(1/2 1/4 1/8) '(-2040 2040 1020)
      '(90  40  50  30  40  50  90  20  30  50)
      '(1/2 1/4 1/4 1/4 1/2 1/8 1/4 1/2 1/8 1/4))
 
--> (-2040 0 2040 0 0 0 0 0 1020 2040)

m-percent

seed integer percent list

Velocity example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(setq velocity
      (m-percent 0.45
                 '(13 3  19 5  5 2  17 5 17 14)
                 '(p5 p4 p3 p2 p mp mf f f2 f3) 89))
 
--> (p3 f2 p3 f f3 f3 f3 f2 p2 p4 p3 f3 f3 f3 f3 f2 f2 p3 f p3
        mf f2 f p3 mf f2 p3 f2 p2 p4 mf f p3 mf p3 mf f2 mf f3
        f2 p3 p5 p3 mf p5 p p3 p5 p5 p2 p5 f3 mf p5 p5 f3 f2 mf
        p3 mf f2 p3 f2 mf f2 p p3 p5 p5 p p3 f3 mf p5 p5 p3 mp
        p5 f2 mf f3 f2 mp mf mf p2 p p4)
 
(c-dynamic-to-velocity 0.23 velocity)
 
--> (21 85 29 72 92 91 90 86 34 13 20 93 93 90 93 80 83 21 76
        27 60 82 79 29 68 80 25 86 38 18 61 78 21 67 29 69 89
        68 90 86 24 3 22 68 2 48 21 7 8 33 4 93 60 4 3 90 80
        63 22 60 81 24 83 62 89 48 20 7 1 41 25 90 66 2 7 20
        56 3 81 64 94 83 52 69 69 30 41 14)

m-mix

group list

This function is able to mix any number of element patterns in a list or ‘interleave’ group their elements sequentially.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(setq s1 '(a b c d e f g h i j k l))
(setq s2 '(ag bh ci dl ek fl))
(setq s3 '(an bn cn dn en fn gn))
 
(setq m1 '(3 2 3 3 1))
(setq m2 '(1 2 3))
(setq m3 '(1 1 1 3 1))
 
(setq symbol
      (m-mix
       (list m1 m2 m3)
       (list s1 s2 s3)))
 
--> (a b c ag an d e bh ci bn f g h dl
       ek fl cn i j k dn en fn l gn)

m-select

template &rest pattern

0-based

1
2
3
4
5
6
7
8
9
10
11
12
(m-select '(0 1 1 0 0)
          '(a a a a a)
          '(b b b b b))
 
--> (a b b a a)
 
(m-select '(0 1 2 1 0 0)
          '(a a a a a)
          '(b b b b b)
          '(e f g h))
 
--> (a b g b a a)

m-sequence

sequence position lists

1
2
3
4
5
6
7
8
9
(m-sequence '(1 2 3 4 3)
            '(2 1 2 1 9)
            (list
             '(11 12 13 14 15 16 17 18 19)
             '(21 22 23 24 25 26 27 28 29)
             '(31 32 33 34 35 36 37 38 39)
             '(41 42 43 44 45 46 47 48 49)))
 
--> (12 21 32 41 39)

Sequence example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(setq
 sequence
 ;   1  2  3  4  5  6  7  8  9 10
 
 '(1  1  1  1  8  8  8  8  4  4
   4  4  2  2  2  2  8  8  8  8
   11 11 11 11 11 12 12 12  6  6
   6 10 10 10  2  2  3  3  4  5
   6  7  8  9 10 11 12 12 12  8
   8  6  6  5  5  8  8  8  8 11
   11 11 11 12 12  4  4  4  4  6
   6  6  6  8  8  9  9 12 12 12)
 
 position
 ;  1  2  3  4  5  6  7  8  9  10
 
 '(1  2  3  4  1  2  3  4  9  11
   12 11 13 14 14 15 16 17 17 18
   19 23  6 34 53 23  4  4 30 32
   34 36 50 53 11 40 41 43 45 46
   66 59 50 73 43 65 80 60 54 50
   62 43 62 40 56 73 79 78 73 51
   62 48 40 44 73 65 47 49 80 74
   62 74 65 53 64 59 67 65 74 76)
 )
 
; Length
 
(setq
 l-vn1-2
 (m-sequence sequence position
             (list
              l-vn1-2.1
              l-vn1-2.2
              l-vn1-2.3
              l-vn1-2.4
              l-vn1-2.5
              l-vn1-2.6
              l-vn1-2.7
              l-vn1-2.8
              l-vn1-2.9
              l-vn1-2.10
              l-vn1-2.11
              l-vn1-2.12))
 )

m-count

integer items

1
2
3
4
5
(m-count 5 '(a b c d e f g h))
--> (a b c d e)
 
(m-count 20 '(a b c d e f g h))
--> (a b c d e f g h a b c d e f g h a b c d)

m-sum

type fn-name

number (integer-output)

The function m-sum monitors the output of a conversion function producing a list of integers. It monitors this initial integer-output against a user-defined number which represents the sum of numbers required by the composer in the final output of integers.

1
2
3
4
5
6
(setq sum
      (m-sum 56
             (cfunction
              (gen-noise-white 100 1.0 .39) '(1 2 3 5 7))))
 
--> (3 1 2 3 1 5 7 5 3 2 7 7 5 5)

The function apply demonstrates how the integer-ouput is monitored.

Test

1
2
(apply '+ sum)
--> 56

m-unison

unisons-list item-lists

The function m-unison has been developed to enable unison passages to coordinated between parts in a complex sequence of zone-lengths, symbol-lists and note-length-lists.

In the example below notice that map-unison acts upon lists of symbols and of note-lengths organising these item-lists into ordering that reflects the template encompassed within the unisons-list.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(setq
 v1-s '((a) (b) (c) (d))
 v2-s '((e) (f) (g) (h))
 va-s '((i) (j) (k) (l))
 vc-s '((m) (n) (o) (p))
 )
 
(setq
 v1-l (qlength '((16-31) (16-22) (16-31) (16-4)))
 v2-l (qlength '((20-14) (20-23) (20-32) (20-41)))
 va-l (qlength '((8-11) (8-10) (8-01) (8-11)))
 vc-l (qlength '((4-1) (4-0) (4-1) (4-1)))
 )
 
(setq
 s1 '(1 2 3 4)
 s2 '(1 3 1 2)
 s3 '(2 4 1 1)
 s4 '(1 1 2 2)
 )
 
(setq
 symbol (list v1-s v2-s va-s vc-s)
 length (list v1-l v2-l va-l vc-l)
 select (list s1 s2 s3 s4)
 )
 
(m-unison select symbol)
--> (((a) (f) (k) (p)) ((a) (j) (c) (h))
     ((e) (n) (c) (d)) ((a) (b) (g) (h)))
 
(m-unison select length)
--> (((3/16 1/16) (1/10 3/20) (-1/8 1/8) (1/4))
     ((3/16 1/16) (1/8 -1/8) (3/16 1/16) (1/5 1/20))
     ((1/20 1/5) (-1/4) (3/16 1/16) (1/4))
     ((3/16 1/16) (1/8 1/8) (3/20 1/10) (1/5 1/20)))

m-to-length

type length-lists symbol-list)

type: symbol nil or ’swallow

This function maps a list or lists of note-lengths against a list of symbols. If the list of symbols is longer than the note-length list the symbol output is trimmed accordingly. If the lists of symbols is shorter than the note-length list the symbol output will repeats itself.

The swallow type enables you to process symbol-patterns to match length-patterns that contain minus values without altering symbol-pattern length or changing symbol / length correspondence.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
(setq sym1 '(a b))
(setq len1 '(-1/20 1/10 1/20 1/20 3/20 -1/20 -1/20))
 
(m-to-length '= len1 sym1)
--> (= a b a b = =)
 
(m-to-length nil len1 sym1)
--> (a b a b)
 
(setq sym2 '(a b c d e f g))
 
(m-to-length '= len1 sym2)
--> (= a b c d = =)
 
(m-to-length 'swallow len1)
--> (= b c d e = =)
 
(setq len2 '((1/8 -1/8 1/8 1/8) (-1/4) (3/32 1/32 -1/8) (-1/4)))
 
(m-to-length nil len1 sym2)
--> (a b c d)
 
(m-to-length '= len2 sym1)
--> ((a = b a) (=) (b a =) (=))
 
(m-to-length 'swallow len2 sym1)
--> ((a = a b) (=) (b a =) (=))
 
(m-to-length nil len2 sym1)
--> ((a b a) nil (b a) nil)
 
(setq tuning '((2048 -1024) (0 2048 0 -2048)))
 
(m-to-length 0 len2 tuning)
--> ((2048 0 -1024 2048) (0) (2048 -1024 0) (0))
 
(m-to-length nil len2 sym2)
--> ((a b c) nil (d e) nil)
 
(setq sym3 '((a b) (c d) (e f)))
 
(m-to-length nil len2 sym3)
--> ((a b a) nil (e f))
 
(m-to-length 'swallow
             '((1/8 -1/8 1/8 1/8) (-1/4) (3/32 1/32 -1/8) (-1/4))
             '(a b c d e f g))
--> ((a = c d) (=) (f g =) (=))

m-to-pattern

rest-symbol symbol-template pattern

rest-symbol: symbol nil

velocity to symbols

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(setq vel1 '(p2 p4 p3 p4 p3 p2))
(setq vel2 '((p2 p4 p3) (p4 p3 p2)))
(setq sym1 '(a b c))
(setq sym2 '(a b = c d = = e f g))
(setq sym3 '((a = b) (c d =) (e = = f)))
 
(m-to-pattern nil sym1 vel1)
--> (p2 p4 p3)
 
(m-to-pattern '= sym2 vel1)
--> (p2 p4 = p4 p3 = = p4 p3 p4)
 
(m-to-pattern '= sym3 vel1)
--> ((p2 = p3) (p4 p3 =) (p2 = = p4))
 
(m-to-pattern '0 sym3 vel2)
--> ((p2 0 p3) (p4 p3 0) (p2 0 0 p2))
 
(m-to-pattern nil sym1 vel1)
--> (p2 p4 p3)
 
(m-to-pattern nil sym2 vel1)
--> (p2 p4 p4 p3 p4 p3 p4)
 
(m-to-pattern nil sym3 pat1)
--> ((p2 p3) (p4 p3) (p2 p4))
 
(m-to-pattern nil sym3 vel2)
--> ((p2 p3) (p4 p3) (p2 p2))

m-to-symbol

symbol length

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(setq len1 '(-1/20 1/10 1/20 1/20 3/20 -1/20 -1/20))
(setq sym1 '(a b c))
 
(m-to-symbol sym1 len1)
--> (1/20 1/10 1/20)
 
(setq sym2 '(a b = c d = = e f g))
 
(m-to-symbol sym2 len1)
--> (1/20 1/10 -1/20 1/20 3/20 -1/20 -1/20 1/20 1/10 1/20)
 
(setq sym3 '((a = b) (c d =) (e = = f)))
 
(m-to-symbol sym3 len1)
--> ((1/20 -1/10 1/20) (1/20 3/20 -1/20) (1/20 -1/20 -1/10 1/20))
 
(setq len2 '((1/8 -1/8 1/8 1/8) (-1/4) (3/32 1/32 -1/8) (-1/4)))
 
(m-to-symbol sym3 len2)
--> ((1/8 -1/8 1/8) (1/4 1/4 -1/4) (3/32 -1/32 -1/8 3/32))

m-to-tonality

range symbol-list tonality-list

range: instrument-name integer

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(m-to-tonality
 'violin '(-g a b c d e f g h i j k l m = n o p q r s t u v)
 (activate-tonality (major c 4)))
 
--> (c a c e f h j l m o q r t v = x y [ ] ^ \` \b \d \e)
 
(m-to-tonality
 'violin '(-g a b c ad e f g fh i j kg l m = n o p q r s t u v)
 (activate-tonality (messiaen1 c 4) (messiaen4 c 4)))
 
--> ((a a c e ag i k m ko q s um w y = [ ] _ \a \c \e \g \i \k)
     (c a b c af g h i hl m n oi r s = t u x y z [ ^ _ \`))
 
(m-to-tonality
 -5 11 '((-g a b c d e f g h i j k) (l m = n o p q r s t u v))
 (activate-tonality (major c 4) (harmonic-minor g 3)))
 
--> ((c a c e f h j l a c e f) (c d = g h j k a c d g h))
 
(m-to-tonality
 -5 11 '((-g a b c d e f g h i j k) (l m = n o p q r s t u v))
 (activate-tonality
  (major c 4)
  (harmonic-minor g 3)
  (messiaen1 c 4)
  (messiaen4 c 4)))
 
--> ((c a c e f h j l a c e f)
     (c d = g h j k a c d g h)
     (a a c e g i k a c e g i)
     (f g = h i l a b c f g h))
 
(m-to-tonality
 'piano '(-g a b c d e f g h i j k)
 (activate-tonality
  (major c 4)
  (harmonic-minor g 3)
  (messiaen1 c 4)
  (messiaen4 c 4)))
 
--> ((-k a c e f h j l m o q r)
     (-p -f -d -c a c d g h j k m)
     (-m a c e g i k m o q s u)
     (-k a b c f g h i l m n o))

m-to-zone

zone lengths

The function m-to-zone monitors the output of a conversion function producing a list of numbers. It monitors this initial numbers (lengths) against a user-defined zone or zones.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(m-to-zone
 '4/3 '(1/8 -1/8 2/8 -1/20 2/20 1/20 -1/20 1/4 2/1 1/2 -2/1))
 
--> (1/8 -1/8 1/4 -1/20 1/10 1/20 -1/20 1/4 1/3)
 
(setq
 len
 (cfunction 
  (gen-noise-white 100 1.0 0.765) '(-1/16 2/16 -3/16 5/16 7/16))
 )
 
(setq
 length-to-zone
 (m-to-zone '12/1 len)
 )
 
--> (2/16 5/16 2/16 2/16 7/16 7/16 5/16 -3/16 2/16 2/16 7/16
          7/16 5/16 -3/16 2/16 -3/16 -3/16 5/16 7/16 7/16 7/16
          5/16 7/16 7/16 7/16 5/16 7/16 7/16 7/16 7/16 7/16
          5/16 2/16 5/16 2/16 -3/16 -3/16 2/16 2/16 7/16 1/8)

Test

1
2
(get-ratio-sc (apply '+ (mapcar 'abs (get-ratio-cl length-to-zone))))
--> 12/1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(m-to-zone '(-1/1 1/1 1/1 1/8 -1/4)
           '(1/4 -1/4 1/16 1/4 5/8 3/8 5/8 -3/8))
 
--> ((-1/1) (1/4 -1/4 1/16 1/4 3/16) (3/8 5/8) (1/8) (-1/4))
 
(setq
 zone-list
 (pick-rnd 0.34 :content 32 '(1/1 1/1 1/1 -1/8 -1/4))
 )
 
--> (-1/4 -1/4 1/1 1/1 1/1 -1/8 1/1 1/1 1/1 -1/4 -1/4 -1/8 1/1
          1/1 1/1 1/1 -1/8 -1/4 -1/4 1/1 1/1 1/1 -1/4 -1/4 1/1
          1/1 -1/8 -1/4 1/1 1/1 1/1 -1/4)
 
(m-to-zone zone-list len)
 
--> ((-1/4) (-1/4) (2/16 5/16 -1/16 2/16 3/8)
     (7/16 5/16 2/16 -1/16 1/16) (7/16 7/16 1/8) (-1/8)
     (-3/16 2/16 -3/16 -3/16 5/16)
     (7/16 7/16 1/8) (5/16 7/16 1/4) (-1/4) (-1/4) (-1/8)
     (7/16 5/16 1/4) (7/16 7/16 1/8) (7/16 5/16 2/16 1/8)
     (2/16 -3/16 2/16 -1/16 2/16 3/8) (-1/8) (-1/4) (-1/4)
     (5/16 2/16 -1/16 -1/16 -1/16 2/16 1/4)
     (-3/16 2/16 -3/16 -3/16 5/16) (-3/16 2/16 5/16 -3/16 3/16)
     (-1/4) (-1/4) (-1/16 -1/16 2/16 -3/16 5/16 2/16 1/8)
     (7/16 5/16  2/16 1/8) (-1/8) (-1/4)
     (2/16 -3/16 5/16 -1/16 2/16 3/16)
     (-1/16 -1/16 -1/16 2/16 5/16 3/8)
     (5/16 2/16 -1/16 -1/16 -1/16 2/16 -1/16 2/16 1/16) (-1/4))