Jump to content

Opusmodus 2.2.26529


opmo

Recommended Posts

New Function:

 

search-for-pattern

 

This function searches for a recurring pattern in a sequence.

The result is a bar number in which the pattern has been found and a count number of the recurrence in the bar.

The pitch and interval element returns a variant recurrence if found.

 

(setf rh '((-s) (e f4e5 pp -s db5)
           (-s) (-s eb4 pp c4d5 -)
           (-s) (-s c4d5 pp eb4 -)
           (-s) (e db5 pp -s f4e5)
           (-s) (s gb4f5 p a5 -)
           (s d4ab4db5 p bb4 -) (-s a5 p gb4f5)
           (-s) (s b5 f gb4g5 -)
           (s a3bb4 f ab4 -) (s c4d5 f> eb4 -)
           (s db5 f> f4e5 -) (-s)
           (s gb4f5 p a5 d4ab4db5 bb4 -) (-s)
           (-s a5 pp gb4f5) (-s)
           (-t b2 f e3 bb3 - d5 c4eb4) (-s)
           (s db3 f - s. g5 -t) (s gb4f5 p)
           (-t a3 mp ab3 mf -s. t db5f5 f c4 -) (s e3e4 p)
           (-t s. d2 f -s ab5 mf) (-s)
           (t gb4a4 p g3 mp - b2 f e3 bb3 e3 a3 eb4 - g5 mf f4ab4 mp) (-s)
           (s f2 f - s. c6 -t) (s b2bb3 p)
           (-s t db5 mp -s. t gb5bb5 f4 f -) (t a3 f ab2 - ab2 a3)
           (-t f4 f gb5bb5 mf) (-t a3 mp d4ab4 c4 p bb5db6 mf)
           (-t b2 f3 b2 -) (t bb5db6 c5 f d4ab4 a3 p)
           (-s) (t b4eb5 p bb3 -)
           (t d4 p db3 - db3 d4) (-t bb3 p b4eb5)
           (-s) (-s eb5 p bb3b4 -) (-s)
           (e d4db5 p -s c5) (-s)
           (e c5 p -s d4db5) (-s)
           (-s bb3b4 p eb5 -) (-s)
           (-s ab3g4 p e4 mf) (-s c4gb4b4 f5)
           (-s db5 mp bb3a4) (-s)
           (-s eb4d5 p gb4) (-s e4 p f3g4)
           (-s b3 p a2bb3) (-s c5db6 pp ab5)
           (-s) (-s e5eb6 p g5 c4f4b4 p> gb4)
           (-s) (-e) (e d5ab5db6 pp)))

 

 

(search-for-pattern '(eb4 c4d5) rh
                    :element :pitch
                    :name "Webern, Variationen für Klavier Op.27, I, rh")
.....................................................
Score: Webern, Variationen für Klavier Op.27, I, rh
Pitches: (eb4 c4d5)
Prime:
  bar: 4  count: 1
Retrograde:
  bar: 6   count: 1
  bar: 16  count: 1
Inversion: none
Retrograde-inversion: none
.....................................................

 

 

(search-for-pattern '(eb4 c4 d5) rh
                    :melodize t
                    :element :pitch
                    :name "Webern, Variationen für Klavier Op.27, I, rh")
.....................................................
Score: Webern, Variationen für Klavier Op.27, I, rh
Pitches: (eb4 c4 d5)
Prime:
  bar: 4  count: 1
Retrograde:
  bar: 23  count: 1
Inversion: none
Retrograde-inversion: none
.....................................................

 

 

(search-for-pattern '(-8 11) rh
                    :element :interval
                    :melodize t
                    :name "Webern, Variationen für Klavier Op.27, I, rh")
.....................................................
Score: Webern, Variationen für Klavier Op.27, I, rh
Intervals: (-8 11)
Prime:
  bar: 8   count: 1
  bar: 17  count: 1
Retrograde:
  bar: 58  count: 1
  bar: 63  count: 1
Inversion: none
Retrograde-inversion: none
.....................................................

 

 

(search-for-pattern '(t t t t) rh
                    :element :length
                    :name "Webern, Variationen für Klavier Op.27, I, rh")
.....................................................
Score: Webern, Variationen für Klavier Op.27, I, rh
Lengths: (1/32 1/32 1/32 1/32)
Found:
  bar: 31  count: 1
  bar: 38  count: 1
  bar: 40  count: 1
.....................................................

 

 

(search-for-pattern '(mp p mf) rh
                    :element :velocity
                    :name "Webern, Variationen für Klavier Op.27, I, rh")
.....................................................
Score: Webern, Variationen für Klavier Op.27, I, rh
Velocities: (mp p mf)
Found:
  bar: 38  count: 1
.....................................................

 

 

(search-for-pattern '(stacc) rh
                    :element :attribute
                    :name "Webern, Variationen für Klavier Op.27, I, rh")
.....................................................
Score: Webern, Variationen für Klavier Op.27, I, rh
Attributes: (stacc)
Found: none
.....................................................

 

Search for pattern in none omn-form sequence:

 

(search-for-pattern '(1 2 3) '((1 2 3 1 2 3) (4 1 2 3 4 5 6)))
.....................................................
Score: nil
Values: (1 2 3)
Found:
  list: 1  count: 2
  list: 2  count: 1
.....................................................

 

 

series-analysis

 

This function searches for recurring series in a sequence.

The result is a size and count number of high recurring series and longest recurring series found in a sequence.

 

Searching for pitches:

 

(series-analysis rh
                 :element :pitch
                 :name "Webern, Variationen für Klavier Op.27, I, rh")
.....................................................
Score: Webern, Variationen für Klavier Op.27, I, rh
High recurrence series:
  found: (gb4 f5) size: 2 count: 5
Longest recurrence series:
  found: (c4 d5 eb4 db5 f4 e5 gb4 f5 a5 d4 ab4 db5 bb4 a5 gb4 f5) size: 16 count: 2
.....................................................

 

Searching for intervals:

 

(series-analysis rh
                 :element :interval
                 :name "Webern, Variationen für Klavier Op.27, I, rh")
.....................................................
Score: Webern, Variationen für Klavier Op.27, I, rh
High recurrence series:
  found: (5 6) size: 2 count: 6
Longest recurrence series:
  found: (14 -11 10 -8 11 -10 11 4 -19 6 5 -3 11 -15 11) size: 15 count: 2
.....................................................

 

Searching for lengths:

 

(series-analysis rh
                 :element :length
                 :name "Webern, Variationen für Klavier Op.27, I, rh")
.....................................................
Score: Webern, Variationen für Klavier Op.27, I, rh
High recurrence series:
  found: (1/16 -1/16) size: 2 count: 29
Longest recurrence series:
  found: (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) size: 21 count: 2
.....................................................

 

Searching for velocities:

 

(series-analysis rh
                 :element :velocity
                 :name "Webern, Variationen für Klavier Op.27, I, rh")
.....................................................
Score: Webern, Variationen für Klavier Op.27, I, rh
High recurrence series:
  series: (p p) size: 2 count: 18
Longest recurrence series:
  found: (mp f f f f f f mf mp) size: 9 count: 2
  found: (p p p p p p p p p) size: 9 count: 2
.....................................................

 

Searching for values:

 

(setf population (gen-population 16 3 7))
(setf pitches (vector-to-pitch 'piano population))

(series-analysis pitches)
.....................................................
Score: nil
High recurrence series:
  found: (a0 c8) size: 2 count: 6
Longest recurrence series:
  found: (a0 c8 a0) size: 3 count: 2
  found: (a0 c8 b7) size: 3 count: 2
.....................................................

 

 

(series-analysis (modus pitches))
.....................................................
Score: nil
High recurrence series:
  found: (9 0) size: 2 count: 7
Longest recurrence series:
  found: (0 7 9 5 0) size: 5 count: 2
.....................................................

 

 

remove-series

 

The function REMOVE-SERIES removes a number of successive items from a list.

 

(remove-series 3 '(c4 cs4 fs4 f4 b4 c4))
=> (f4 b4 c4)

(remove-series 3 '(c4 cs4 fs4 f4 b4 c4) :from-end t)
=> (c4 cs4 fs4)

 

Best wishes, stay safe,

Janusz

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy