-
Posts
808 -
Joined
-
Last visited
Content Type
Forums
Events
Store
Video Gallery
Posts posted by AM
-
-
here is a small pure LISP-function - even older function - that I need for a project. Kind of a "shift-hysteresis", a randomized change from X to Y to ..., also possible with several value. It is best to try it out with the graph views. have fun!
andré
;;; SUB (defun weighted-t/nil (on-weight) (let ((off-weight (- 1 on-weight))) (weighted-random (list (list 't on-weight) (list 'nil off-weight))))) (defun weighted-random (list) (loop for item in list with rand-num = (random (loop for x in list sum (second x))) for add = (second item) then (+ add (second item)) when (< rand-num add) return (first item))) ;;; MAIN (defun gen-hysteresis (&key number-of-values (value-list '((0 1) (4 0) (0 1) (4 7))) (start-weight 0.1) (sensitivity 0.02) (static 1.0)) (loop repeat number-of-values with weight = start-weight with cnt1 = 0 with cnt-v = 0 when (equal (weighted-t/nil weight) 'nil) collect (first (nth cnt-v value-list)) else collect (second (nth cnt-v value-list)) and do (incf cnt1) when (= cnt1 3) do (setq weight (+ weight sensitivity) cnt1 0) when (> weight static) do (incf cnt-v) and do (setq weight start-weight) when (= cnt-v (length value-list)) do (setq cnt-v 0)))
test it:
(pitch-list-plot (gen-hysteresis :number-of-values 300 :start-weight 0.1 :sensitivity 0.05 :value-list '((gs3 a4)) :static 2.0) :join-points t :style :fill) (pitch-list-plot (gen-hysteresis :number-of-values 500 :start-weight 0.1 :sensitivity 0.05 :value-list '((gs3 a4) (e5 ds4) (cs4 gs3)) :static 1.5) :join-points t :style :fill) (list-plot (gen-hysteresis :number-of-values 500 :start-weight 0.1 :sensitivity 0.1 :value-list '((1 2) (2 6) (4 3) (3 5)) :static 2.0) :join-points t :style :fill)
- opmo, jesele and Stephane Boussuge
- 2
- 1
-
i know this problem, really annoying
-
In my experience, LISP is not really suitable for interaction in real time. You can work with loops/evaluations, but this is very cumbersome (for example, you always have to wait to read new values / exchange information between the agents). The coordination of parallel processes in timing is also too inaccurate. If you work with parallel processes, there is no common (overall) time/timing that is precise enough. I did this in several projects (for live score generation) from OM via OSC to Max/MSP - it worked but is very, very complex and tedious. It is more worthwhile to build this in Max/MSP from scratch. Max/MSP is more suitable for this. With every "click/bang") you can change ongoing processes immediately, which is not possible in LISP. The languages are built differently from scratch.
If you do not want to deal with complex systems in realtime - quasi "still images" of dynamic systems, game theory or interaction - then this can also be done in LISP. Then it is basically a question of counterpoint.
Depending on the work/focus, I switch from one programming environment to the other.
But perhaps i'm wrong or not well enough informed...
does anyone know solutions for real time interaction in LISP?
Greetings
André
------------
This may also be more suitable for this, many work with it
-
another sketch: now with a "global tendency" from scales/arpeggia to chords (and also with some structural projection - less random, more systematic). next: modify the FENDER-part (by code), so that it will be playable
- Stephane Boussuge and opmo
- 2
-
-
Opusmodus / A musical reflection tool
At the beginning it should be noted that this is not a piece of music! I often try out new material in Opusmodus, test ideas, almost improvise with it. It is a good tool for me to check my idea, to reflect it, to change rules/ideas. A musical reflection tool.
Basic idea:
I would like to build a texture (based on a Pitchfield/Chord), which is structured by scales/arpeggia, should be played by a fender rhodes and two sine players. Each gesture should have a new pace (1/20 1/12 etc.) and a new dynamic, so that this texture has homogeneity on the side (through the chord), but is very precise articualted inside. The fender rhodes should and must be playable (= done by limiting the scales), sines can be "free" ...Result:
What I get with this few code is a sketch, now I can refine my rules and conditions (chord/tempi/rests) in OPUSMODUS. Likewise, I can now experiment (if this works now) in Ableton Live on the timbres, which surely will have i kind of a feedback on my CODING in OMN. A kind of circular working process... a
At the end:
I will write it down by hand (sibelius) to be able to articulate even more precisely (like i want it) than the code.
For the stage:
Coordiniaton will be done by click-track or https://polytempo.zhdk.ch
Have fun!
Greetings
André
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; a function that generates a chains of 1/20 or 1/12 or 1/8 .. dependening on the lengths of the sub-pitch-seqences ;; ORD or REVERS (so that the "starttime" changes) by probp ;; no immediate reps (defun gen-rhythms (apitchlist) (loop for i in apitchlist for j in (rnd-sample 100 '(1/20 1/28 1/12 1/8) :norep t) collect (if (probp 0.5) (length-rational-quantize (gen-repeat (length i) j) :round (rnd-pick '(1/4 2/4))) (reverse (length-rational-quantize (gen-repeat (length i) j) :round (rnd-pick '(1/4 2/4))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; THE CHORD/INTERVAL (setf intervals '(7 6 3 4 6 4 3 6 7)) ;; intervals for pitches (setf n 20) ;; span for CYCLE (interval-rotation) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; LINES for FENDER RHODES (should be playable by humans) (setf lines1 '(loop for chord in (loop for i in (gen-rotate :left intervals :type 'list) collect (rnd-sample 5 (interval-to-pitch i :start 'b0))) ;; interval-rotation (all possibiliies), interval to pitch append (loop repeat n ;; n = how many cycles per pitch-constellation collect (progn (setf direction (setf direction (prob-pick '((0 0.7) (1 0.3))))) ;; preset by probp for SCALE or DOWN (filter-repeat 1 (if (= direction 0) ;; take 3 or 5 pitches from momentary pitch-constellation / if probp then UP (sort-asc (rnd-sample (rnd-pick '(3 5)) (rnd-sample-seq 5 ;; max in SPAN 5 pitches (for fender rhodes) (ambitus-filter (ambitus-instrument 'piano) chord)) :norep t)) (sort-desc (rnd-sample (rnd-pick '(3 5)) (rnd-sample-seq 5 ;; max in SPAN 5 pitches (for fender rhodes) (ambitus-filter (ambitus-instrument 'piano) chord)) :norep t)))))))) ;; LINES for SINE PLAYER (setf lines2 '(loop for chord in (loop for i in (gen-rotate :left intervals :type 'list) collect (interval-to-pitch i :start 'b0)) ;; interval-rotation (all possibiliies), interval to pitch append (loop repeat n ;; n = how many cycles per interval-constellation collect (progn (setf direction (setf direction (prob-pick '((0 0.7) (1 0.3))))) ;; preset by probp for SCALE or DOWN (filter-repeat 1 (if (= direction 0) ;; take 3 or 5 pitches from momentary pitch-constellation / if probp then DOWN (sort-asc (rnd-sample (rnd-pick '(3 5 7)) (ambitus-filter (ambitus-instrument 'piano) chord) :norep t)) (sort-desc (rnd-sample (rnd-pick '(3 5 7)) (ambitus-filter (ambitus-instrument 'piano) chord))))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GEN FENDER PART (progn (setf fdr_1 (eval lines1)) (setf rhy1 (gen-rhythms fdr_1)) ;; gen rhy based on the pitch-seqs (setf fdr_1 (make-omn :length rhy1 :pitch fdr_1)) ;; rewrite/replace dynamics (setf fdr_1 (loop for i in fdr_1 ;;every gesture should have their own dynamics norep !! for velo in (pick-norepeat 100 '(ppp p mf fff)) collect (omn-replace :velocity velo i)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GEN SINE PARTS (progn (setf snr_1 (eval lines2)) (setf rhy2 (gen-rhythms snr_1)) ;; gen rhy based on the pitch-seqs (setf snr_1 (make-omn :length rhy2 :pitch snr_1)) ;; rewrite/replace dynamics (setf snr_1 (loop for i in snr_1 ;; every gesture should have their own dynamics norep !! for velo in (rnd-sample (length rhy2) '(ppp p mf fff) :norep t) collect (omn-replace :velocity velo i)))) (progn (setf snl_1 (eval lines2)) (setf rhy3 (gen-rhythms snl_1)) ;; gen rhy based on the pitch-seqs (setf snl_1 (make-omn :length rhy3 :pitch snl_1)) ;; rewrite/replace dynamics (setf snl_1 (loop for i in snl_1 ;; every gesture should have their own dynamics norep !! for velo in (rnd-sample (length rhy3) '(ppp p mf fff) :norep t) collect (omn-replace :velocity velo i)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; PUT IN AN 3/4 (setf snl (omn-to-time-signature snl_1 '(3 4))) (setf snr (omn-to-time-signature snr_1 '(3 4))) (setf fdr (omn-to-time-signature fdr_1 '(3 4))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (def-score sketch (:title "sketch" :key-signature 'atonal :time-signature '(3 4) :tempo '(132) :layout (list (grand-layout 'fdr) (bass-layout 'snl) (bass-layout 'snr))) (snl :omn snl :channel 1 :port 9 ) (snr :omn snr :channel 1 :port 8) (fdr :omn fdr :channel 1 :port 5)) ;(live-coding-midi (compile-score 'sketch)) ;(omn-list-plot (list fdr_1 snr_1 snl_1) :style :fill :point-radius 1)
-
or
(rest '(1 2 3 4 5)) => (2 3 4 5)
or (extended)
(car
(cdr
(cadr
(cddr
(nthcdr
....
CLHS: Accessor CAR, CDR, CAAR, CADR, CDAR...
CLHS.LISP.SE- Stephane Boussuge and opmo
- 2
-
in make-omn -> no "time-signature", only for "def-score"...
(make-omn :length extended-length :pitch pitch-loop :velocity velocity) => ((e b3cs4e4g4 ff -e - e b3cs4ds4a4 p< q ds4gs4a4d5 mp< eb3f3g3 f<) (e b3cs4ds4a4 ff> -e - e ds4gs4a4d5 pp> q d3g3gs3d4 ff> d4e4f4b4 f>) (e b4d5ds5f5g5 mf> -e - e ds3g3gs3d4 pp< q b3c4g4 p< d3g3gs3d4 mp<) (e b3cs4ds4a4 mf< -e - e ds4gs4a4d5 f> q eb3f3g3 mp< ff))
-
-
Dear community Where is the error? I try this setup and want to send the program changes, but it doesn't work. What is wrong? I don't see it thanks for some help - andréthe setup...
(progn (add-program-attributes '(ads) '(ord) '(msp) '(st) '(bartok) '(wk) '(lt) '(gett) '(pizz) '(lbup) '(lbdown) '(lb1) '(lb2) '(lb3) '(lb4) '(kdecke) '(kzarge) '(harm1) '(harm2) '(harm3) '(harm4) '(harm5)) (add-text-attributes '(ads "ads") '(ord "ord") '(msp "msp") '(st "st") '(wk "wk") '(lt "lt") '(bartok "bartok") '(gett "gett") '(pizz "pizz") '(lbup "lbup") '(lbdown "lbdown") '(lb1 "lb1") '(lb2 "lb2") '(lb3 "lb3") '(lb4 "lb4") '(kdecke "kdecke") '(kzarge "kzarge") '(harm1 "harm1") '(harm2 "harm2") '(harm3 "harm3") '(harm4 "harm4") '(harm5 "harm5"))) (def-sound-set cb-prog :programs (:group contrabass ord 0 msp 1 st 2 wk 3 lt 4 gett 6 ads 7 pizz 10 lbup 11 lbdown 12 bartok 13 lb1 20 lb2 21 lb3 22 lb4 23 kdecke 29 kzarge 30 harm1 41 harm2 42 harm3 43 harm4 44 harm5 45)))
test for score... i do not recieve program changes, why?;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; some test... (setf kb '(q e4 pp lt q q q) epl1 '(q e4 pp pizz q q q) epl2 '(q e4 pp msp q q q) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (def-score test (:title "test" :key-signature 'atonal :time-signature '(4 4) :tempo '(120) :layout (list (contrabass-layout 'kb) (contrabass-layout 'epl1) (contrabass-layout 'epl2))) (kb :omn kb :channel 1 :port 15 :sound 'cb-prog) (epl1 :omn epl1 :channel 1 :port 0 :sound 'cb-prog) (epl2 :omn epl2 :channel 1 :port 12 :sound 'cb-prog))
-
I think it is very worthwhile not to simply use complex functions, but to learn the basics/language of LISP. And then or in addition to that, try to program functions (in LISP/OM) yourself, to find ways of formalizing your ideas and needs.
currently I am doing the same in/with MaxMSP
- Stephane Boussuge, jesele and david
- 3
-
a little snippet of my work - including some sorting algorithms / hidden data / brownian bridges.
played by Nenad Markovic (Ensemble Phoenix) - live recording.
https://opusmodus.com/forums/topic/1039-sorting-algorithms/#comment-3314
https://opusmodus.com/forums/topic/2958-brownian-bridge/#comment-10267
- opmo, Stephane Boussuge and jon
- 1
- 2
-
a quick idea: if you would do it with rnd-walk and use it as positions in a pitchfield, you have a some global control over all parameters.
pitchfields are - in my opinion - useful, because you have some nice vertical control. you don't have this if you simply have the random walk out of the pitches directly.
(progn ;; do a rnd-walk with tendency (setf walk (gen-walk 24 :step '(1 2 3) :backward 0.3 :forward 0.7)) ;; transform it to positions in a pitchfield and "reset list" if min-val < 0 (setf positions (cumulative-sums walk)) (setf positions (if (< (find-min positions) 0) (x+b positions (abs (find-min positions))) positions)) ;; define a pitchfield (or chord) (setf pitchfield (append (expand-tonality '(b3 messiaen-mode6)) (expand-tonality '(b4 messiaen-mode5)) (expand-tonality '(b5 messiaen-mode4)) (expand-tonality '(b6 messiaen-mode3)))) ;; reading pitchfield by positions (position-filter (cumulative-sums walk) pitchfield))
-
Just a little gimmic: Sort-Algorithm (plus filter-repeat) controls the frequencies of COMB Filters in Max/MSP when playing some EMF-noise. One single sort process...
- opmo and Stephane Boussuge
- 2
-
kind of ... "position-insert" with OVERWRITE
(defun position-insert-seq (&key alist insert item) (let ((pos (car (position-item item alist)))) (position-replace (gen-integer pos (+ pos (1- (length insert)))) insert alist))) (setf alist '(0 0 0 0 0 0 1 0 2 0 0 0 3 5 7)) (setf insert '(a b c d)) (position-insert-seq :alist '(0 0 0 0 0 0 1 0 2 0 0 0 3 5 7) :insert '(a b c d) :item 2) => (0 0 0 0 0 0 1 0 a b c d 3 5 7)
- erka and Stephane Boussuge
- 2
-
dear david
this could be helpful for you... some basic-syntax-tutorials
have fun!
andré
well explainend
- Stephane Boussuge and opmo
- 2
-
(defun prob-mutation (alist blist &key (factor 1) (prob-list nil)) (loop for a in alist for b in blist for x in (if (null prob-list) (cumulative-sums (gen-repeat (length alist) (float (/ factor (length alist))))) prob-list) when (probp x) collect b else collect a)) ;;; with linear prob-incf (prob-mutation (gen-repeat 100 1) (gen-repeat 100 2)) => (1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 2 1 1 1 1 2 2 1 2 2 2 1 1 1 1 1 2 1 1 1 1 1 2 2 1 1 2 2 1 1 2 2 2 2 1 1 2 2 2 1 1 2 1 1 1 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2) ;;; with an external prob-list 0 to 1.0 to 0 (setf half-sine (filter-first 100 (gen-sine 200 1 1.0))) (prob-mutation (gen-repeat 100 1) (gen-repeat 100 2) :prob-list half-sine) => (1 1 1 1 1 1 1 1 1 2 2 1 1 2 2 1 2 1 2 1 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 1 1 2 2 2 2 2 2 2 1 1 2 1 2 1 2 1 1 2 1 1 2 1 1 1 2 1 1) ;;; with an external prob-list 0 to 0.3 to 0 (setf half-sine (filter-first 100 (gen-sine 200 1 0.3))) (prob-mutation (gen-repeat 100 1) (gen-repeat 100 2) :prob-list half-sine) => (1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 1 2 1 2 1 1 2 1 2 1 2 1 1 1 2 1 1 1 2 1 1 2 1 1 2 1 1 1 2 1 1 1 1 2 1 2 1 2 1 1 1 1 1 2 1 1 2 2 1 2 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1)
- Stephane Boussuge and erka
- 1
- 1
-
very nice, like a SIEVE!!
if it would be like:
(rnd-rest '(8 7 6 5 4 3 2 1) omn-seq)
you could manage the event-density in time...
or...
(rnd-rest '(0.1 0.2 0.23 0.4 0.7 0.6 0.3 0.43 0.91) omn-seq)
...perhaps also with (gen-envelope-tendency) (or something like that
just a spontanious idea
- opmo and Stephane Boussuge
- 2
-
just a snippet... how i/you can use OPMO for some other things (TIME LAPS test mode, just to see if my code is working correctly).
i like the openness of the system.
- opmo and Stephane Boussuge
- 2
-
-
Practical Common Lisp
GIGAMONKEYS.COM- opmo and Stephane Boussuge
- 2
-
funny but of course it is far far away from bach or a choral harmonization
I think there are various difficulties, on the one hand whether chatGPT finds enough information on the net about the harmonization of chorales and probably far too little about OPUSMODUS and LISP.
chatGPT doesn't really manage to program usefully in LISP (e.g. I tested sorting algorithms), but chatGPT explained to me extensively how the resulting code works, but it was always full of errorr/bugs. never worked, not fixable either. there is simply still a large amount of data missing for the system.
But of course I'm not a specialist, I just tried it (chatGPT) out in an amateurish way
-
-
was it not like...?
(rnd-sample-seq 2 '(1 2 3 4 5))
=> (1 2)
=> (3 4)
(rnd-sample-seq 3 '(1 2 3 4 5))
=> (2 3 4)
=> (3 4 5)
Gametheory in OM performance and composition
in Support & Troubleshooting
Posted
dear @Jorgalad
I have made the solution with OSC. Data in OM (in loops) send to MAX via OSC for the e-players/samplers and polytempo network (live scoring); but that is simply too complex and too prone to errors (latency/data loss); that's just too many elements in it. For my things it would be better to work with MAX (or supercollider) only. So I am now learning MAX. What exactly do you want to do?
greetings
andré