Jump to content

Opusmodus 1.2.20797


Recommended Posts

New:

rnd-number (n low high &key prob norep seed)

 

[Function]

 

Arguments and Values:

 

n                an integer. Amount of numbers to generate.

low              an integer. Lower limit.

high             an integer. Upper limit.

prob             a floating point value between 0.1 and 0.9. The default is 0.5.

norep            T (no consecutive repeat) or NIL. The default is NIL.

seed             an integer. Ensures the same result each time the code is evaluated.

                                         The default is NIL.

 

Description:

 

This function generates a series of numbers in a given range. Such numbers can be used to create pitch or interval sequences.

 

(rnd-number 10 -5 5 :seed 89)

=> (-3 5 2 -2 -1 2 5 -4 4 3)

 

Example with probability value 0.8 - higher numbers are more likely:

 

(rnd-number 10 -5 5 :prob 0.8 :seed 89)

=> (2 4 2 3 2 -4 3 -5 1 0)

 

Such numbers can be used to create pitch or interval sequences.

 

(integer-to-pitch (rnd-number 10 -5 5 :seed 89))

=> (a3 f4 d4 bb3 b3 d4 f4 gs3 e4 eb4)

 

Examples:

 

Get 10 random integers with values between -5 and 5:

 

(rnd-number 10 -5 5)

=> (4 -5 -1 0 -1 1 1 5 0 -3)

 

Get 10 random integers with values between -5 and 5 without consecutive repeat:

 

(rnd-number 10 -5 5 :norep t)

=> (4 1 0 -1 0 1 4 -2 2 -2)

 

Get 10 random integers based on a given :seed value:

 

(rnd-number 10 -5 5 :seed 192)

=> (0 0 -5 -2 -3 -3 -5 1 -4 -5)

 

Get 10 random integers based on a given :seed value without consecutive repeat:

 

(rnd-number 10 -5 5 :seed 192 :norep t)

=> (0 -5 -2 -3 -5 1 -4 -5 1 -1)

 

---------------------------------------------------------

 

New :norep option in RND-SAMPLE:

 

(rnd-sample '(1 2 2 3 2 1) '((c4 d4) (e4 g4) (a4)) :norep t :seed 34)

=> ((d4) (e4 g4) (a4 a4) (c4 d4 c4) (g4 e4) (a4))

 

(rnd-sample 5 '((q c4 p d4 ff) (s a4 stacc) (s e4 app q c5 d5 pp))

            :norep t)

 

=> (((app s e4 ff) q c5 d5 pp) (s a4 ff stacc) (q c4 p d4 ff)

    (s a4 ff stacc) ((app s e4 ff) q c5 d5 pp))

 

and minor bug fixes.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy