Search the Community
Showing results for tags 'function'.
-
I'd like to know why I can't seem to process this list of chords using the pitch-variation function. Thank you! (setf chords '((h a2a3c4 c4a3a3) (h d4f3g2 f4g3d4) (h e4c4a3 c3a3e4) (h d3a3f4 w f4d4a3) (h e2e3g3 g3e4e4) (h a3f4e4 f2e3a3) (h e4g3b3 b3e3g2) (h a2d3fs2 w fs2a2e2) (h a2e3c4 c4a3e4) (h e4g3b3 b3e3g2) (h f2e3a3 a3f4e4) (h e4e4g3 w g3e3e2) (h d3a3f4 f4d4a3) (h e4c4a3 c3a3e4) (h b2a3d4 d4b3a3) (h a3a3c4 w c4a3a2))) (pitch-variation 0 1 7 chords :type '? :seed 23)
-
The documentation on the interval-expansion-series function states that a count list argument refers to a number of intervals to process. Would someone be willing to explain what number of intervals and in what way? I understand that this function also has built-in randomness, resulting in a different output each time. In the example below, does the count list '(1 2 3) mean that only one interval is expanded the first time, then two intervals the second time, etc.? Or does it imply that only the first three intervals from the interval source list will be expanded? (interval-expansion-series 10 '(1 -1 2 -2) '(1 2 3) '(-6 -5 3 4) :max-interval 6) Thank you!
-
I wonder if anyone has a suggestion on producing this list (with sublists) in Opusmodus, in which the first number decreases in value, the second number stays the same, and the third number increases in value? Thank you! ( (7) (3) (6) (3) (1) (5) (3) (2) (4) (3) (3) (3) (3) (4) (2) (3) (5) (1) (3) (6) (3) (7) )
-
I try to put a seed as an option in this function with a default value of nil or no seed , how may i add it as optional Thanks Patrick (defun patkaos ( seed lambda long ) (let ((res (cons seed nil)) (xn seed)) (dotimes (n long res) (setf res (cons (setf xn (* lambda xn (- 1 xn))) res))) (reverse res)))
-
Hello i try to write a function who could directly apply to an omn list of that form : (set melo1 '(s bb5 f c6 mf bb5 f q mf s c6) (s c6 g5 g5 mp q c5 s bb5 f) (h. g5 f e. mp bb4 ff bb5 mf g5 f) ) How may i proceed to access independently pitch , length , velocity or articulation without having to disassemble it . Is there an existing helping function already made on which i could assign a new custom written function . Thanks Patrick
-
Hello i tried to have a function who could move one atom or a list anyplace in another list , but now i would like to have the options to move this atom or list with or without parenthesis , see option a option b option a2 option b2 . I have no idea how i can implement several result options in a function , could you please explain me how to do that Thank you Patrick her are the functions i'd use as helping functions (defun list-diff (L1 L2) (cond ((null L1) nil) ((null (member (first L1) L2)) (cons (first L1) (list-diff (rest L1) L2))) (t (list-diff (rest L1) L2)) ) ) (defun hasSublistp (lst) (cond ((null lst) nil) ((listp (first lst)) t) (t (hasSublistp (rest lst))))) This is the final one (defun consxp (rang item lis ) (setq oldlist lis) (setq newlist ( nthcdr rang oldlist )) (setq litem (list item)) (cond ( ( and ( listp item ) (hassublistp oldlist )) ; OPTION A (append (list-diff oldlist newlist ) (list item) (nthcdr rang oldlist ))) ; OPTION B (append (list-diff oldlist newlist ) item (nthcdr rang oldlist ))) (( and ( atom item ) (hassublistp oldlist )) ; OPTION A2 (append (list-diff oldlist newlist ) (cons (list item) (nthcdr rang oldlist )))) ; OPTION B2 (append (list-diff oldlist newlist ) (cons item (nthcdr rang oldlist )))) (( listp item ) (append (list-diff oldlist newlist ) item (nthcdr rang oldlist ))) (( atom item ) (append (list-diff oldlist newlist ) (cons item (nthcdr rang oldlist )))))) ; ( consxp 2 '( a d a) '(a (d) c )) option a ) for example
-
here is a little function, to use or optimize... greetings andré ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; a little lisp-function that's switches by a "hysteresis" from one value to the other ;;;;;;;;;;;;;;;;;;;;;;; ;;;; could be used for any-value ;;;; :start-weight -> tendency at the beginning ;;;; :sensitivity -> change-step of tendency when switch/match ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; subfunctions (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))) (defun weighted-t/nil (on-weight) (let ((off-weight (- 1 on-weight))) (weighted-random (list (list 't on-weight) (list 'nil off-weight))))) (weighted-t/nil 0.5) ;;;; mainfunction (defun binary-hysteresis-1.0 (&key number-of-values (values '(0 1)) (start-weight 0.1) (sensitivity 0.02)) (loop repeat number-of-values with weight = start-weight with cnt = 0 when (equal (weighted-t/nil weight) 'nil) collect (first values) else collect (second values) and do (incf cnt) when (= cnt 3) do (setq weight (+ weight sensitivity) cnt 0))) ;;;; example with 0/1 (length-list-plot (binary-hysteresis-1.0 :number-of-values 200 :values '(0 1) :start-weight 0.1 :sensitivity 0.07)) ;;;; example with two pitches (make-omn :pitch (binary-hysteresis-1.0 :number-of-values 200 :values '(c4 c5) :start-weight 0.05 :sensitivity 0.1) :length (gen-repeat 200 '(1/32)))
-
;;;;small function -> create symmetrical lists (palindrom) with markov (for generating half-seq) (setf transition '((1 (4 1) (5 1) (-6 2)) (2 (5 2) (4 1)) (3 (4 1)) (4 (5 1) (2 1)) (5 (1 3) (-6 2) (4 1)) (-6 (4 1) (3 2)) (7 (1 1) (-6 1)))) ;;;FUNCTION (defun gen-sym-markov (&key seq-length transition-matrix) (let ((vals 0)) ;falls seq-length = liste, werden positive werte gezählt und neu ;seq-length (= angepasst, formatunabhängig) (if (listp seq-length) (setq seq-length (car (last (loop for i in seq-length with cnt = 0 when (> i 0) collect (incf cnt)))))) ;entscheindung grad/ungrad (if (evenp seq-length) (progn (setq vals (gen-markov-from-transitions transition-matrix :size (/ seq-length 2) :start (rnd-pick (flatten (filter-first 1 transition-matrix))))) (append vals (reverse vals))) (progn (setq vals (gen-markov-from-transitions transition-matrix :size (/ (- seq-length 1) 2) :start (rnd-pick (flatten (filter-first 1 transition-matrix))))) (append vals (list (rnd-pick (flatten (filter-first 1 transition-matrix)))) (reverse vals)))))) ;;;;EXAMPLE (gen-sym-markov :seq-length 8 :transition-matrix transition)
-
Hi, here's a simple example of my use of BINARY-RHYTHM function inspired by the Janusz's doc examples for generating a full movement of a chamber symphonie. The BINARY-RHYTHM function use FIBONACCI stuff and variant optional keyword: (init-seed 839201883) (setf fib1 (fibonacci 4 64)) (setf fib2 (fibonacci 21 81)) (setf fib3 (fibonacci 14 74)) (setf fib4 (fibonacci 32 92)) (setf fib5 (fibonacci 1 61)) (setf rhstruct (rnd-sample 8 '(4 8 16 32 64))) (setf bval '(h h q q e e s s s e s e q e h q h h)) (setf len1 (binary-rhythm rhstruct fib1 bval :type 2 :variant '?)) (setf len2 (binary-rhythm rhstruct fib2 bval :type 2 :variant '?)) (setf len3 (binary-rhythm rhstruct fib3 bval :type 2 :variant '?)) (setf len4 (binary-rhythm rhstruct fib4 bval :type 2 :rotate 18)) (setf len5 (binary-rhythm rhstruct fib5 bval :type 2 :variant '?)) SB.
-
- function
- orchestral
-
(and 1 more)
Tagged with:
-
I would like to understand why if i express this function that way it works fine (gen-filter-change (vector-to-pitch '(g4 g5) (gen-white-noise 64 :seed 246)) (vector-to-length 's 1 5 (gen-white-noise 32 :seed 456)) (vector-to-velocity 'mp 'ff (gen-white-noise 122 ))) and if i do that (gen-filter-change '(gs4 e4 e4 d4 e4 gs4 d4 c4 fs4 gs4 e4 e4 c4 e4 gs4 d4 gs4 fs4 fs4 d4) '(1/16 1/2 1/4 1/4) '(s e s s e) '(mf mf mp ff mf mf mp mf ff mf mf f f mf mf mp ff mf f mp ff ff f mp ff f f mp mf mp f ff f mf mf mf ff mf mp f ff f mf mp f f mf ff f f mf f mp mf f ff f mp mf mf f ff f mf mp f mf mf mf mf mf mf f mf mf f f ff mf f mf f mp f mf f mp f mf mf f mp mp mf mf mf mf f ff f mf mp mp mf mf mf f mp f f f f f f f mf f mf mp mp f mp))It doesn't work , why can't we enter velocities manually? Thanks
-
Version 1.0.15605 is out with a new function added: GEN-CHORD2, ready for download. gen-chord2 count chord-size pitches &key ambitus-chord offset transpose rnd-octaves ambitus seed [Function] Arguments and Values: count an integer or list of integers (number of chords). chord-size an integer or list of integers (size of chords). pitches list or lists of pitches. offset an integer or list of integers. ambitus-chord an integer or list of integers. transpose an integer or list of integers. rnd-octaves NIL or T. The default is NIL. ambitus instrument name or an integer or pitch list (low high). The default is 'piano. seed NIL or number. The default is NIL. Description: The function GEN-CHORD2 enables the composer to generate chords from a list of pitches. The count value sets the number of chords to be generated. The size of the chord is determined by the chord-size parameters. Keywords like :transpose, :ambitus-chord, :rnd-octaves, :ambitus and :offset are further parameters used within the function. (setf row (rnd-row :type :pitch :seed 245)) => (c4 cs4 e4 eb4 b4 fs4 gs4 a4 bb4 d4 f4 g4) (gen-chord2 4 '(3 3 3 3) row) => (c4cs4e4 eb4b4fs4 gs4a4bb4 d4f4g4) (gen-chord2 4 '(2 2 3 4) row :offset '(2 2 -1 1)) => (e4eb4 b4fs4 eb4b4fs4 b4fs4gs4a4) (gen-chord2 4 '(2 2 3 4) row :offset '(2 0 -1 0)) => (e4eb4 e4eb4 cs4e4eb4 cs4e4eb4b4) (gen-chord2 4 '(4 3) row) => (b4fs4gs4a4 a4bb4d4 g4c4cs4e4 e4eb4b4) (gen-chord2 '(12 6) '(3 4) '((c4 cs4 d4 ds4 e4 f4) (fs4 g4 gs4 a4 as4 b4))) => ((eb4e4f4 cs4d4eb4e4 e4f4c4 d4eb4e4f4 f4c4cs4 eb4e4f4c4 c4cs4d4 e4f4c4cs4 cs4d4eb4 f4c4cs4d4 d4eb4e4 c4cs4d4eb4) (a4bb4b4 g4gs4a4bb4 bb4b4fs4 gs4a4bb4b4 b4fs4g4 a4bb4b4fs4) Examples: If :offset is NIL (the default) then the chord-size value determines the offset value. (gen-chord2 4 '(4 3) row :offset '(2 3 -2)) => (e4eb4b4fs4 fs4gs4a4 eb4b4fs4gs4 fs4gs4a4) (gen-chord2 4 '(4 3) row :offset '(2 3 -2) :transpose '(0 6 1 13)) => (e4eb4b4fs4 c5d5eb5 e4c5g4a4 g5a5bb5) (gen-chord2 4 '(4 3) row :offset '(2 3 -2) :transpose '(0 6 1 13) :rnd-octaves t) => (e2eb2b1fs2 c2d2eb2 e2c2g2a1 g6a6bb6)