User Extensions Source Code
Here you can share your functions source code
199 topics in this forum
-
;;little function to make a transition by FIBONACCI-seq ;;i have seen this idea in "slippery chicken" (by michael edwards), ;;so here is a - "not so smart" but working - basic-function. (defun transition-with-fibonacci (number-of-values value-a value-b) (let ((fib-length) (fib-seq) (all-seq)) (setq fib-length (loop for cnt = 1 then (incf cnt) collect (sum (fibonacci 2 cnt)) into bag when (> (car (last bag)) number-of-values) do (return (1- (length bag)))) fib-seq (fibonacci 2 fib-length) all-seq (append (reverse fib-seq) (loop repeat (- number-of-val…
-
- 0 replies
- 1.2k views
-
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;another little markov-game => markov with "global-tendency" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;a "neutral table with 4 values" (setq transitions '((1 (1 1) (2 1) (3 1) (4 1)) (2 (1 1) (2 1) (3 1) (4 1)) (3 (1 1) (2 1) (3 1) (4 1)) (3 (1 1) (2 1) (3 1) (4 1)) (4 (1 1) (2 1) (3 1) (4 1)))) ;;;subfunctions (defun filter-first-last (n sequence) (car (filter-last n sequence))) (defun substitute-transition-weight (transition-list value new-weight) (loop for j in transition-list …
- 3 replies
- 1.8k views
-
don't konw if something like this exists in ONE function... could be useful!! andré (defun count-repetitions (value-list) (let ((seq (append value-list (list 'nil)))) (loop repeat (1- (length seq)) with count = 1 for cnt1 = 0 then (incf cnt1) for cnt2 = 1 then (incf cnt2) when (equal (nth cnt1 seq) (nth cnt2 seq)) do (incf count) when (not (equal (nth cnt1 seq) (nth cnt2 seq))) collect count and do (setq count 1)))) (count-repetitions '(1 1 2 2 2 3 4 4 1)) (count-repetitions '(abc bc a a a a bc))
- 1 reply
- 1k views
-
;;; little markov-game: ;;; gen-markov => analyze the output => produce new rules => gen-markov ;;; make x-times the list-plot and you will see how the system most of the times ;;; comes to a "constant STATE" (defun self-analyzing/generating-markov (transitions size generations) (loop repeat generations with list = (gen-markov-from-transitions transitions :size size :start 1) append (setq list (gen-markov-from-transitions (gen-markov-transitions list) :size size :start (car (last list)))))) ;;; a "neutral table with 4 values" (setf transition-table '((1 (1 1…
-
- 0 replies
- 1.7k views
-
-
;;; little program to change markov-weight for a specific value ;;; to give markov a "rule-tendency" (setq transitions '((a (b 1) (c 3) (d 2) (e 1)) (b (a 2) (d 3)) (c (a 2) (e 1) (b 3)) (d (c 2) (b 1) (a 3)) (e (a 2) (b 2) (d 1)))) (defun substitute-transition-weight (transition-list value new-weight) (loop for j in transition-list collect (append (list (first j)) (loop repeat (1- (length j)) for cnt = 1 then (incf cnt) when (equal (first (nth cnt j)) value) collect (list (first (nth cnt j)) n…
-
- 0 replies
- 1.1k views
-
-
have fun! andré ;;; TWO SIEVE-generators ;;; simple and multiple (the simple-function is part of multiple) ;;;;;;;;;;;;;;;;;;;;;;;;; (defun gen-sieve (ambitus.omn intervals) (midi-to-pitch (loop with ambitus.midi = (pitch-to-midi ambitus.omn) with interval.cnt = -1 for pitch = (first ambitus.midi) then (setq pitch (+ (nth interval.cnt intervals) pitch)) when (<= pitch (second ambitus.midi)) collect pitch into bag else return bag do (incf interval.cnt) when (= interval.cnt (length intervals)) do (setq interval.cnt 0)))) (gen-sieve '(c4 g7) '(2 1)) ;;;;;;;;;;;;;;;;;;;;;;;;; (defun gen-multiple…
- 10 replies
- 2.6k views
-
if you want to pick a sample from approx.center (depends on odd/even) of a list... (defun pick-sample-from-center (list span) (let ((center (if (evenp (length list)) (/ (length list) 2) (/ (1+ (length list)) 2))) (span (if (> span (length list)) (length list) (append span)))) (loop repeat span with startpoint = (if (evenp span) (- center (/ span 2)) (- center (/ (1+ span) 2))) for i = startpoint then (incf startpoint) collect (nth i list)))) ;;;EXAMPLES: (pick-sample-from-center '(1 2 3 4 5 4 3 …
-
- 0 replies
- 1.3k views
-
-
kind of transposing.... in ONE function... (defun adjust-pitch-sequence (pitch-sequence pitch1 pitch2) (pitch-transpose (car (pitch-to-interval (list pitch1 pitch2))) pitch-sequence)) ;;;'b3 (and all around) will be transposed to 'a6 (adjust-pitch-sequence '(c3 b3 a4 g1) 'b3 'a6) => (bb5 a6 g7 f4) here a simple self-similarity-example - but it's not for what i coded it.. (setq seq '(c3 b3 a4 g2)) (loop for i in seq collect (adjust-pitch-sequence seq 'c3 i))
-
- 0 replies
- 1.4k views
-
-
i'm sure that it would also work with tonality-map, but i was interested to code a simple version for my own to understand all the things :-) ;;; i wanted to map every interval-sequence to every possible pitchfield... ;;; all the sequences are "centered" (i needed that for my project) ;;; with :base you could move up and down the center ;;; :pitchfield has to be a OMN-pitch-sequence ;;; FUNCTION (defun interval-projection-on-pitchfield (&key pitchfield intervals (base 0)) (let ((integers (pitch-to-integer (interval-to-pitch intervals))) (base-0-integers) (centering) (pos)) (setq base-0-integers (loop for i in integers …
- 7 replies
- 3k views
-
;; little function. don't know if something like this already exits ;; in OMN: i wanted to READ the swallowed pitches after ambitus-swallow ;; i hope it works fine... ;;function (defun read-ambitus-swallowed (min/max omn-sequence) (let ((up (ambitus-swallow (list (second min/max) 'g9) omn-sequence)) (down (ambitus-swallow (list 'c0 (first min/max)) omn-sequence))) (merge-voices up down))) ;;nonsense-sequence (setq omn-sequence '(e f4 t a0 q g0 d9 s. eb6 t. f3 cs9 t ab0 q c0)) ;;ord ambitus-swallow (ambitus-swallow '(a0 g8) omn-sequence) ;;the excluded pitches (read-ambitus-swallowed '(a0 g8) omn-sequence)
-
- 0 replies
- 1.4k views
-
-
i'm working on a program including "markov"... so i coded this small FUNCTION to SUBSTITUTE markov-rules-values (because in my "project" i'm generating a feedback on the markov-rules (after a pattern-match)). i know it could be coded a lot smarter but it works. have fun! andré ;;;;FUNCTION (defun substitute-transition-value (transition-list value-old value-new) (loop for j in transition-list collect (loop for i in j when (numberp i) append (substitute value-new value-old (list i)) when (listp i) collect (append (substitute value-new value-old (list (first i))) (list (second…
- 4 replies
- 1.8k views
-
hi all, i coded a little markov-program who changes the LEVEL-size if necessary to generate the number of values you want exactly. it would be nice if someone could check/test the IDEA, and if it's correct and makes sense :-) the markov starts on LEVEL 3 and tries to generate a number of output-levels with its TRANSITION-rules (level-3-rules), if it's possible (=generating the size) everything's fine. but if it's not possible, then the programm changes on LEVEL-2-rules ... if this is also not possible (to generate the size) then it changes to LEVEL 1... here is the code... ;;;FUNCTION (defun gen-multiple-markov (sequen…
-
- 0 replies
- 1.2k views
-
-
Hi, A few weeks ago, I wrote about the Optima Pattern Matching library. In today's post, I have given a simple example of using the library to post-process a score, after reading a MIDI file. Regards, Rangarajan
-
- 0 replies
- 1.3k views
-
-
As part of my research into other tools that can be used along with Opusmodus, in today's post I have given a basic introduction to the Optima Lisp library for pattern matching. I hope to continue the discussion in the next couple of posts as well. I think this library will be useful if we want to do any operations in Opusmodus involving pattern matching, for example, reading a score and looking for specific patterns in it. Regards, Rangarajan
- 4 replies
- 2k views
-
Hi, Picat is a Prolog-derived language with good support for Constraint Programming. In today's blog, I have shown how to implement a simple CP-based function in Picat for chord/non-chord tone generation, and more interestingly, how we can interact with Picat from Opusmodus to get the results of the computation. To me, this opens up new possibilities for expanding what you can do from Opusmodus! Regards, Rangarajan
-
- 3 replies
- 1.8k views
-
-
don't know if somthing like that exists... generates "stacc"-rhythms = splitting lengths for example 7/32 to 1/32 -6/32 (works with single values or lists) -> only "1 bug"... when i want to do this with 4/32 -> then lisp *reduces it" to 1/8, so it don't work for such rhythms...?!? any ideas? thanx a. ;;;FUNCTION (defun gen-stacc (n) (if (numberp n) (if (> (numerator n) 1) (list (/ 1 (denominator n)) (/ (* -1 (- (numerator n) 1)) (denominator n))) (list n)) (loop for i in n append (if (> (numerator i) 1) (list (/ 1 (denominator i)) (/ (* -1 (- (numerator i) 1)) (denominator i))) (list i))))) ;;;EX…
- 5 replies
- 1.9k views
-
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…
- 5 replies
- 1.9k views
-
;;; ------------------------------------------------------------------------------ ;;; GEN-PITCH-LINE ;;; Pitch generation function based on noise vectors conversion with a large choice of ;;; types of noises, compress ratio for the vector, filtering repetitions and ambitus. (defun gen-pitch-line (nb-pitch &key (compress 1) (ambitus '(c4 c6)) seed filter-repeat (type :white)) (do-verbose ("gen-pitch-line") (rnd-seed seed) (labels ((white (nb-pitch &key (compress 1) (ambitus '(c4 c6)) seed filter-repeat type) (if filter-repeat (gen-trim nb-pitch (filter-repeat …
- 3 replies
- 1.7k views
- 1 follower
-
;;;;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 …
-
- 0 replies
- 1.2k views
-
-
Hi, In today's blog post, I have shared some basic ideas about the Screamer Lisp library, with examples of how to start using it for constraint programming. The inspiration came from some earlier posts in OM forum on this topic. It was an exciting exercise and learnt a few interesting things! Regards, Rangarajan
-
- 2 replies
- 2.7k views
-
-
1) main-idea: a little function (perhaps more interesting when rhy-display-bugs are fixed) ...to use if you want to do "real-fractal-structures", or replace (with motif-map) a length-value with a rhythmical-substructure, or do "rhy-projections" on other lengths... (defun gen-prop-rhythms (proportions main-length) (loop for i in proportions collect (* i (/ main-length (apply '+ (mapcar #'abs proportions)))))) (gen-prop-rhythms '(3 2 5) 4/4)) 2) extension: replace a value from a sequence (generated with "gen-prop-rhythms") with a new gen-prop-seq, and merge it to a new rhy-layer.... repeat this x-times... (defun merge-two-la…
-
- 0 replies
- 903 views
-
-
Hi, In my blog post today, I have attempted to implement a simple technique for generating melody to layer on top of a chord progression. To make the experiment more appealing, I connected OM to Ableton Live, then recorded the session and exported the song to a WAV file. Be warned: I am a newbie when it comes to music, so if you find anything silly, please forgive me and correct me! Regards, Rangarajan
-
- 0 replies
- 1.1k views
-
-
;;; i coded this little function because i wanted to transpose a single pitch without having ;;; a list as output: in the library (pitch-transpose -12 '(c4)) -> (c3) ;;; (or is there such a function/format already in the library?) (defun single-pitch-transpose (pitch interval &key (midi-output 'nil)) (if (numberp pitch) (if (equal midi-output 'nil) (midi-to-pitch (+ interval pitch)) (+ interval pitch)) (if (equal midi-output 'nil) (midi-to-pitch (+ interval (pitch-to-midi pitch))) (+ interval (pitch-to-midi pitch))))) ;;example1 -> omn-in omn-out (single-pitch-transpose 'c4 -12) ;;example2 -> omn-in midi-out (single-pit…
-
- 2 replies
- 1.3k views
-
-
;;;GEN-SUB-STRUCTURE;;; andré meier - 01.05.2016 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;in a given OMN-pitch/duration/articulation-structure -> stream (in events) ;;;you could build a sub-structure from another pitch-seq (:sub-pitch-structure) ;;;it changes the duration and the articulation and the velocity ;;;if keyword ":sieve 't" -> all other pitches/lengths will be replaced by rests, ;;;a bit like LACHENMANN generates his "strukturnetze" ;;;p.s. i coded this event-structure because it's more practical for my recent project ... ;;;and i think it's a very practical DATA-structure... it would be also possible…
- 3 replies
- 1.3k views
-
Friends, Time for yet another blog post! This week I have described a technique that you can use to read a MIDI file and then transform the corresponding score. I personally think that Opusmodus could introduce many interesting functions for working with MIDI files, not just for transforming as explained in my blog, but also for analyzing the score. Hope you find this article interesting. Regards, Rangarajan
- 16 replies
- 3.4k views