User Extensions Source Code
Here you can share your functions source code
199 topics in this forum
-
Hi folks, here's a function I find useful for my work and sharing it here. This is an anti oscillation function to remove aba type patterns when working on algorithmically generated material. (defun anti-oscil (lst) "Supprime les éléments formant des oscillations de type x _ x dans LST. Exemple : (anti-oscil '(a b a a c)) => (a b c)" (labels ((rec (remaining result) (if (null remaining) ;; Plus rien à traiter, on renvoie le résultat tel quel result (let ((x (car remaining))) (if (and (>= (length result) 2) (equal x (nth (- (length result) 2) result))) ;…
-
- 0 replies
- 360 views
- 1 follower
-
-
I'm new to Opusmodus and Lisp programming. It will be awhile before I can implement some of the ideas that I have. In the meantime I've discovered that the Opusmodus GPT can do some programming for me. Here are two functions that it generated for me. A one dimensional totalistc CA with an arbitrary number of states, and a function to generate random rule sets. It took some prompting to get them to this stage. Totalistic CA rules are symmetrical, so if your initial state is a palindrome all generations will be. (defun totalistic-cellular-automaton (states rules initial-state generations) "Generates a multi-state totalistic cellular automaton. STATES: the num…
-
- 0 replies
- 263 views
- 2 followers
-
-
here's a useful function (for me at least) who use unfold internally to apply some variations from a reservoir to some OMN material. This function can surely be much improved (adding seed etc...) but actually I'm using it like this... Example of usage is at the end of the function definition file, a short string quartet example. ;;; OMN-RND-VAR ;;; Base sur ma vieille pratique ;;; avec omn-rnd-variations1. (defun generate-variation (max-length num-measures) "Generate a sorted list of unique random numbers based on num-measures." (sort-asc (find-unique (rnd-number num-measures 1 max-length :norep t)))) (defun omn-rnd-var (variations measures omn-sequen…
-
- 0 replies
- 520 views
-
-
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)
-
- 0 replies
- 1.2k views
-
-
Edit: Thanks to Janusz and Stephane I could correct and improve the function . See below. This is an earlier version: For the fun of it and hopefully some use I wrote this simple function: ;;;;;;;;; (defun rk_rnd-order-omn (inomnl &key (exclude nil) seed (flat nil)) "to exclude use l for :length, p for :pitch, v for :velocity; d for :duration, a for :articulation, leg for :leg, ped for :ped; i.e :exclude '(p leg) To be even more random flatten the omn with :flat t" (let* ( (state *init-seed* ) (vseed (rnd-seed seed)) (omnl (if flat (flatten inomnl) inomnl)) (len (if (member…
- 4 replies
- 636 views
- 1 follower
-
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 Brownsche Brücke – Wikipedia 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 1…
- 1 reply
- 754 views
- 2 followers
-
The ITERATE library is build in version 1.2.20405, therefore there is no need to load the library with QUICKLISP anymore. About ITERATE library: https://common-lisp.net/project/iterate/
-
- 2 replies
- 1.4k views
- 1 follower
-
-
Inspired by the example from this thread but I could not find the related function been shipped with the OM application. The code requires OM3.0 because of LispWorks specific API but the concept should be simple enough to be implemented in Clozure CL. After some midi objects has been compiled and inserted to the playlist one can use run-playlist to start play. While it is still playing one can feed more midi objects queued to the playlist. When the playlist is empty and after the specified seconds of timeout, the player process would exit. (setq midi1 (compile-score 'score1)) (setq midi2 (compile-score 'score2)) (setq midi3 (compile…
- 6 replies
- 1.3k views
-
;; gen-hoquetus.4 https://en.wikipedia.org/wiki/Hocket ;;; andré meier / 27-4-2016 ;;; write a instrumentation-list (instrument + techniques + velocity), pitch-list ;;; and length-list. the gen-hoquetus-function will split the melody ;;; off... in any possibilities, techniques/articulations/velocities will be added ;;; this is only a function i coded for my actual work... perhaps you could use ;;; it or code it properly :-) ;;; HAVE FUN! regards, andré (setq instrumentation '(((pno ponte ppp)) ((vn pizz p)) ((vn pizz f) (va ponte f)) ((pno tasto ff)) ((pno pizz fff)) …
- 7 replies
- 2.6k views
- 2 followers
-
In many scores, Pierre Boulez use a lot of accacciatura or appoggiatura , for exemple like in Dérive (1984), a score composed for and based on the name SACHER (famous hexachord used also in "Message esquisse"). Here's a function to help to add such appoggiature in your score based on a list of rhythmic values. There is a draft doc in French joined to the function definition. Hope it could be useful for some of us and may be improved and better coded and refined. My best to all of Opmo users. SB. gen-ornament.lisp gen-ornament.rtfd.zip
-
- 0 replies
- 878 views
-
-
Hi, here's a function i've made for my own usage and i think could be useful for others. It is a split point function which divide an OMN flux according to a list of split points. Attached, you will find the French doc of the function 😉 ;;; SPLIT-POINT ;;; SB. 2020 ;;; Fonction utile pour séparer les 2 mains pour une partie de piano ;;; renvoie une liste de listes (defun split-point (split-points omn-seq) (do-verbose ("split-point") (let* ( (spltconvert (if (numberp (car split-points)) split-points (pitch-to-integer split-points))) (spltp (gen-trim (length omn-seq) splt…
- 3 replies
- 1.9k views
- 1 follower
-
here is a function to MAP a 2d-field to chords (via intervals) // an idea i got from "Nierhaus - Algorithmic Composition" - Cellular Automata (p. 198). so you can "import/map" some GAME-OF-LIFE configurations or whatelse (a pixel photo?) // the PITCH-MAPPING is like in Miranda's CAMUS. ;; FUNCTION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun 2d-field-to-chord (matrix &key (start 'c4) (merge-chords nil)) (let* ((int-horizontal (x+b (loop for x in (loop for i in matrix collect (position-item 1 i)) when (not (null x)) collect x) …
- 1 reply
- 934 views
- 1 follower
-
Hi, here's a function I've made for my personal usage. May be it could be useful for some users... Best Stéphane ;;;=================================== ;;; PITCH-TRAJECTORY ;;;=================================== ;;; SB 1.11.21 ;;;=================================== (defun pitch-trajectory (nbpitch range tendency &key (variance 0.5) (type :around) (quantize 1/2) (smooth 1) filter-repeat seed …
- 4 replies
- 1.8k views
- 3 followers
-
here a function... to barraqué's techniques (defun serie-proliferantes (row) (let* ((ri_row (pitch-invert (gen-retrograde row))) (row (loop for z in (loop for x in (pitch-to-midi ri_row) collect (or (position x (pitch-to-midi row)) (position (- x 12) (pitch-to-midi row)) (position (+ x 12) (pitch-to-midi row)))) collect (nth z ri_row)))) row)) (serie-proliferantes '(c5 ab4 g4 db5 e4 d4 bb4 eb4 b4 f4 fs4 a4)) => (fs…
- 13 replies
- 21.1k views
-
I'm new to the OpusModus IDE and project/file structure. As a senior programmer my version control system (mainly GIT and TFVC) with a proper version control / branching strategy is an import friend. Any ideas/experience in applying version control on OpusModus scripts while composing? Big hug, Wim Dijkgraaf
-
- 2 replies
- 1.7k views
- 1 follower
-
-
After our recent Opusmodus Convention I have been asked whether there would be any Opusmodus tutorials for the libraries I shared. While there is no bespoke Opusmodus tutorial for any of them (you might consider my presentation at he Opusmodus convention as that tutorial, and additionally there are some nods to Opusmodus in the docs here and there), these libraries are all documented. For all libraries I write I tend to create detailed reference documentation for my own good 🙂 Much of the documentation is simply at the Common Lisp level, but that means in Opusmodus it would be largely used the same way. Fenv (Function Envelopes) There is…
-
- 0 replies
- 1.1k views
-
-
Hi, Is there a way to fill in distances between 'time-points' like in the example? Thanks for help! best ole (setf time-points '(e b5 f - - - b5 - - b5 - - - - b5 - b5 - - b5 - - - b5 - - - - a5 - - - - - a5 - - - a5 - - - - a5 - - - a5 - - - a5 - - - - a5 - - - a5 - - - - a5)) (omn :length time-points) ;is there a way to achive this: (setf filled '(4/8 3/8 5/8 2/8 3/8 4/8 5/8 6/8 4/8 5/8 4/8 4/8 5/8 4/8 5/8 1/8)) (setf time-points-filled (make-omn :length filled :pitch (pitch-transpose -12 (omn :pitch time-points)) :velocity (omn :velocity time-points))) (def-score tp (:key…
-
- 3 replies
- 2.2k views
-
-
If you want to use Emacs and SLIME with Opusmodus, that is possible. Here are steps that work: If you haven't already done so, install Quicklisp. Evaluate (ql:quickload "quicklisp-slime-helper"). Follow its instructions and put (load (expand-file-name "~/quicklisp/slime-helper.el")) into your ~/.emacs file. Start Opusmodus, and evaluate (cl-user::start-swank). This should print something like ";; Swank started at port: 4005". Now, start your Emacs. Type M-x slime-connect and you'll be prompted for a host (use the default, which is 127.0.0.1) and then a port. The port needs to match the port (default 4005) that was printed out earl…
- 9 replies
- 4.6k views
- 1 follower
-
Move-set is a function inspired by Mikael Kuhn's move-set function in PGen for Csound. https://mikelkuehn.com/index.php/ng It allows you to make random choices by moving progressively in a morphing from one set to another linearly or by following a convex or concave curve controlled by the parameter: curve. <1 = concave, 1 = linear,> 1 = convex. The norep option allows you to remove direct repeats in random choices. ;;;====================================== ;;; MOVE-SET ;;; SB. 01.11.2020 ;;;====================================== ;;; Move-set est une fonction inspirée de la fonction move-set de Mikael Kuhn dans PGen pour Csound…
-
- 0 replies
- 1.1k views
-
-
here is a sketch for an alternative "binary-(or element-)layer-FUNCTION (defun element-layer (lists &key (rnd nil)) (let ((lists (if (null rnd) lists (rnd-order lists :list t)))) (car (last (loop for x in (rest lists) with list = (car lists) collect (setf list (loop for i in list with cnt = 0 when (equal i 0) collect (nth cnt x) and do (incf cnt) else collect i))))))) (element-layer (list '(1 0 0 1 1 0 0 1 0 0 0 0) '(…
-
- 0 replies
- 4.4k views
-
-
Hi, i've made this function for my own usage. Sharing here if it can be useful for some others. It is a function who replace articulation by a given one on repeated notes. Best SB. ;;; OMN-REPLACE-ARTICULATION-IF-REPEAT (defun omn-replace-articulation-if-repeat (new-art omn-sequence) (do-verbose ("omn-replace-articulation-if-repeat") (let ((spn '()) (res '()) ) (progn (setf spn (get-span omn-sequence)) (setf res (loop for i from 0 to (- (length (flatten-sublist (single-events omn-sequence))) 1) collect (if (or (eq (second (nth i (flatten-sublist (single-events omn-sequence)))) (second …
-
- 0 replies
- 1.3k views
-
-
;;; ADD-RND-DUST TO LENGTHS ;;; this function adding RANDOMLY some "dust" to the LENGTHS, so it will be like a little rubato, ;;; or "humanizing"-effect. the ADD-SPAN is in percent (0.1 = 10%) on each length-value. (defun add-rnd-dust (omnseq &key (span '(0.1)) (seed nil) (quantize '(1 2 3 4 5 6 7 8 9))) (let ((rhy (omn :length omnseq)) (sp)) (progn (setf rhy (loop with cnt = 0 for i in rhy do (setf sp (nth cnt span)) when (not (null seed)) do (incf seed) when (> i 0) collect (+ i (car (rnd-num…
- 8 replies
- 3.9k views
- 1 follower
-
greetings andré ;;; MODIFY THE PITCH CONTOUR inside a pitchfield or tonality ;;; please evaluate the example and have a look to the contours ;;; subfunction (defun position-items (items alist) (loop for item in items append (position-item item alist))) ;;; function (defun compr/expand-melody (melody field &key (type 'add) (n 1) (shift 0)) (let* ((ints (loop for i in (difference (position-items (pitch-to-midi melody) (pitch-to-midi field))) collect (cond ((equal type 'add) (cond ((<= i -1) …
-
- 3 replies
- 2.3k views
- 1 follower
-
-
have fun... greetings andré ;;; here is a MULTI-GEN-SORT ------------------------- ;;; you could interlace different processes of SORTING (defun multi-gen-sort (lists &key (types nil) (sorts '>) (steps nil) (seed nil)) (let* ((sorted-lists (loop for i in lists for cnt = 0 then (incf cnt) collect (gen-sort i :type (if (listp types) (nth cnt types) types) :sort (if (listp sorts) …
-
- 0 replies
- 1.7k views
-
-
;;; THIS FUNCTION DOING SYMM TRANSPOSITIONS TO CONRACT (OR EXPAND, depends on INTERVAL) A CHORD or PITCH-SEQ ;;; default setting: it changes in every generation the highest and lowest pitch by an OCTAVE ;;; by changing :position (see examples) you could change which position should be changed/transposed ;;; default interval is 12 ;;; FUNCTION (defun chord-contraction/expansion (n pitchlist &key (position nil) (interval 12) (chord nil)) (let* ((pitchlist (if (chordp (car pitchlist)) (melodize pitchlist) pitchlist)) (position (if (null position) (list 0 (1- (length pitch…
- 7 replies
- 2.8k views