Hello,
I’m trying to create a randomized bpf through a lisp function. I’m able to make instances of bpf (list for second input of bpf-lib), but I only get default bpfs, even though i try to input the random x and y points.
I had no problems creating chord-seq’s or voice’s with parameters this way. Did I make a mistake, or is there something I’m missing about bpf? I’m still using OM 6.9.
Best,
Ruben
;______________________________________________________________________________________
(defun random-bpfs-lisp (y-minmax-list points-minmax-list number-of-bpfs)
(setf y-min (first y-minmax-list))
(setf y-max (second y-minmax-list))
(setf samples-min (first points-minmax-list))
(setf samples-max (second points-minmax-list))
; To get different randoms, you must place om-random inside a loop. Using repeat-n with random gives ‘once’-mode.
(setf bpfs-random-number-of-points (loop for index from 1 to number-of-bpfs
collect(om-random samples-min samples-max ) ))
;make-a-bpf
(setf make-a-bpf(loop for number-of-points in bpfs-random-number-of-points
;collect bpfs-random-number-of-points
;random-x2y-points-n -use loop to get a different number each time
do(setf these-y-points (loop for point from 1 to number-of-points
collect (om-random y-min y-max)))
do (setf interval-for-x-points (om/ 1000(length these-y-points)))
;The x-points
do (setf these-x-points (om-round(arithm-ser 0 1000 interval-for-x-points)10) )
;Limit y to min and max
do (setf tested-y-points (loop for this-y in these-y-points
collect (if (and(om>= this-y y-min)(om<= this-y y-max))
this-y
(if (om> this-y y-max) y-max y-min)
)))
;show as lists
; collect (list tested-y-points these-x-points)
collect(make-instance 'bpf
:x-points (flat these-x-points)
:y-points (flat tested-y-points)
:decimals '10
)
))
)
;______________________________________________________________________________________