# brownian bridge

## Recommended Posts

i like the concept of "brownian bridge" to produce complex curves from a to b, but not completely randomized or controlled. in the video you see all the generations for one evaluation...

how it could sound - mapped on different tonalities

DE.WIKIPEDIA.ORG

for understanding in OPMO:

axiom: start end

(50 23)

gen1 => 1 step

(50 8 23)

gen2  => 3 steps

(50 15 8 -3 23)

gen3 => 7 steps

(50 40 15 13 8 -14 -3 29 23)

gen4 => 15 steps

(50 58 40 33 15 22 13 4 8 4 -14 -16 -3 17 29 17 23)

...and so on

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

some evaluations with same AXIOM:

```;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; BROWNIAN BRIDGE -> could be use as a rnd-process from A to B (integers or pitches)
;;; if you have a look to example with ":all-gen t", you will see the process with all generations, how it works

;;; or take a look to:
;;; https://de.wikipedia.org/wiki/Wiener-Prozess#/media/File:BrownscheBewegung.png
;;; https://de.wikipedia.org/wiki/Brownsche_Brücke
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; SUB

(defun pick (a b &key (span 5))
(let ((rnd1 (car (rnd-number 1 (+ a span) (- a span))))
(rnd2  (car (rnd-number 1 (+ b span) (- b span))))
(n))
(progn
(setf n (car (rnd-number 1 rnd1 rnd2)))
(if (or (= n a) (= n b))
(+ (rnd-pick '(1 -1)) n)
n))))

(pick 2 3)

;;; MAIN

;;; MAIN

(defun gen-brownian-bridge (n startend &key (all-gen nil) (output 'integer) (span 5))
(let ((seq))
(progn
(setf seq (append (list startend)
(loop repeat n
with liste = startend
do (setf liste (filter-repeat 1 (loop repeat (1- (length liste))
for cnt = 0 then (incf cnt)
append (append (list (nth cnt liste)
(pick (nth cnt liste)
(nth (1+ cnt) liste)
:span span)
(nth (1+ cnt) liste))))))
collect liste)))

(setf seq (if (equal all-gen t)
seq
(car (last seq))))
(if (equal output 'pitch)
(integer-to-pitch seq)
seq))))

;;; EXAMPLES

;; SPAN influence -> span 2
(loop repeat 20
do (list-plot (gen-brownian-bridge 5 '(1.2 5.4) :span 2 :all-gen t)
:zero-based t
:join-points t)

do (sleep 2))

;; SPAN influence -> span 10
(list-plot (gen-brownian-bridge 5 '(50 23) :span 20 :all-gen t)
:zero-based t
:join-points t)

;;; SPAN default (5)
(list-plot (gen-brownian-bridge 5 '(50 23) :all-gen t)
:zero-based t
:join-points t)

(list-plot (gen-brownian-bridge 5 '(50 23))
:zero-based t
:join-points t)

(gen-brownian-bridge 5 '(50 23) :all-gen t :output 'pitch)
(gen-brownian-bridge 5 '(50 23) :output 'pitch)```

##### Share on other sites

```(defun gen-brownian-bridge (n startend &key (all-gen nil) (output 'integer) (span 5))
(let ((seq)
(liste startend))
(progn
(setf seq (append (list startend)
(loop repeat n
do (setf liste (filter-repeat 1 (loop repeat (1- (length liste))
for cnt = 0 then (incf cnt)
append (append (list (nth cnt liste)
(pick (nth cnt liste)
(nth (1+ cnt) liste)
:span span)
(nth (1+ cnt) liste))))))
collect liste)))
(setf seq (if (equal all-gen t)
seq
(car (last seq))))
(if (equal output 'pitch)
(integer-to-pitch seq)
seq))))```

Small change otherwise you get:

`Warning: Local Variable Initialization clause (the binding of liste) follows iteration clause(s) but will only be evaluated once.`

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
• #### Browser

• Video Gallery

• Lessons