Jump to content

Search the Community

Showing results for tags 'code'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to Opusmodus
    • Announcements
    • Pre Sales Questions
  • Support Forum
    • Support & Troubleshooting
    • OMN Lingo
    • Function Examples
    • Score and Notation
    • Live Coding Instrument
    • Library Setup
    • MIDI Setup
  • Question & Answer
    • Suggestions & Ideas
    • Zoom into Opusmodus
  • Sharing
    • Made In Opusmodus
    • User Extensions Source Code


  • OMN The Language
  • Tutorial Guide
  • CLM Examples


  • Getting Started
  • HowTo
  • Live Coding
  • Music Theory and Analysis
  • How-to in 100 sec
  • Presentation

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL




About Me

  1. 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 un
  2. 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)))))))
  3. testing videoplayer in OPMO.mov whitenoise.mov
  4. 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 (
  5. 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
  6. ;;; 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)
  7. 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 typ
  8. 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) ty
  9. ;;; 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))
  10. hi all i'm looking for different SORTING ALGORITHMS in LISP - no problem to find (different) in the WWW... but: i would like to have as OUTPUT-result ALL generations of the SORTING-process and not only the LAST one - i'm interested in the PROCESS!! thanks for some help or any idea? (for once i do not want to code it myself :-)) greetings andré
  11. to use the function which works on event-numbers, first you have to number it (the score), so that you could work with this afterwards... ;;; ADD numbers to text attributes (can do that in your setup), then ADD number to events ;;; have a look to the example. after that, easy to use REPLACE-ON-EVENT-NUMBER etc... (defun add-numbers-to-text-attributes (a b) (loop for i from a to b append (add-text-attributes (list (compress (list 'nr i)) (write-to-string i))))) (add-numbers-to-text-attributes 0 100) (defun add-num-to-events (omnlist) (loop for x in (single-events omn
  12. the same idea with INSERT/REPLACE (defun replace-on-event-number (omn-list &key position/list (type 'replace) (output nil)) (progn (setf omn-list (loop for i in (single-events omn-list) for cnt = 0 then (incf cnt) with position-list = (loop for x in position/list collect (car x)) with list = (loop for y in position/list collect (rest y)) with cnt2 = 0 when (= cnt (nth cnt2 position-list))
  13. ;;; FUNCTION: for some coding-cases i needed THIS function, to keep the OMN-notation ;;; and not to change to RATIO (otherwise i got strange results in NOTATION because the "ties are gone") (defun length-invert** (length-val) (append (compress (list '- length-val)))) ;;; EXAMPLES ;;; new => keeps OMN (length-invert** (car '(q e4 mp))) => -q ; in this case i wanted to keep the format with tie (length-invert** (car '(3q_q e4 mp))) => -3q_q ;;; original => changes to ratio (length-invert (car '(q e4 mp))) => -1/4 ; no tie here! i was in trouble :-) (length-invert (car '
  14. Here's a new function a bit similar to my old "add-interval-if-length" function but bit more sophisticated. It use gen-chord3 to create chord on defined length. ;;; ============================================== ;;; UTILITY FUNCTIONS ;;; (defun make-chord-if-length-aux (omn &key (test #'>) (length-val 1/8) (interval-list '((4 7)(7 12))) (cycle t)(relative nil) seed) (setf seed (rnd-seed seed)) (let ((s-events (single-events omn))) (loop for e in s-events for i in (gen-trim (length s-events) interval-list) when (funcall test (omn-encode (first e)
  15. hi all the following function could be usefull, it's a first sketch, but it seems to work.... if you want to INSERT a new OMN-seq, perhaps in bar 2 on the 3/20 in your BASIC-OMN-sequence... with this function you can do this, it will overwrite your original phrase. test it or tell me whatelse would be better... greetings andré ;;; ------------------------------------------------------------------------ ;;; INSERTING SEQ BY OVERWRITING ;;; ------------------------------------------------------------------------ ;;; SUB (defun get-resol
  16. ;; a function which fills up a sequence randomly - max-length = length sequence ;; (regardless of the number of cycles) (defun rnd-complete-seq (n &key sequence (step 1) seed (sort '<) (exclude nil) (append-excluded nil)) (let* ((testseq) (sequence (if (null exclude) sequence (filter-remove exclude sequence))) (sequence (loop repeat (length sequence) with sequence = (loop repeat n with seq = '() do (setf seq (append (rnd-unique
  17. Hi, here are the two functions i use daily in my workflow. The first gen-pitch-line can be used as this but is also required for the second function svoice1. svoice1 is a generic omn generator i find useful for my work. ;;; ------------------------------------------------------------------------------ ;;; GEN-PITCH-LINE ;;; Fonction de génération de hauteurs basées sur une conversion de vecteur de bruit ;;; avec un grand choix de type de bruit, taux de compression du vecteur, filtrage des répétitions et ambitus. (defun gen-pitch-line (nb-pitch &key
  18. works, but only for one-time-repetiton... could you use it? (defun merge-lengths-of-a-pitch-rep (omn-seq) (let* ((omn-seq (single-events omn-seq)) (l)) (flatten (loop repeat (length omn-seq) for cnt = 0 then (incf cnt) when (equal (omn :pitch (nth cnt omn-seq)) (omn :pitch (nth (1+ cnt) omn-seq))) do (progn (setf l (length-note-merge (append (omn :length (nth cnt omn-seq)) (omn :length (nth (1+ cnt) omn-seq))))) (incf cnt)) and collect (omn-replace :length l (n
  19. ;;; removes pitches by its position-number, will be replaced by rests. (starts with 0) (defun omn-pitch-position-remove (positions omnseq) (length-rest-merge (loop for i in (single-events omnseq) with cnt = 0 when (and (pitchp (cadr i)) (not (equal 'nil (member cnt positions)))) append (make-omn :length (list (length-invert (car i)))) else append i when (pitchp (cadr i)) do
  20. could be an interesting idea for OPMO? (or already existing?) greetings andré ;;; a function (a sketch - i needed it for my momentary work) which filters ;;; an OMN-sequence in a specific bar, from a specific beat, with a specific ;;; span. (in such a basic version all in quarters (bars/...)) (defun copy-omn-seq (omnseq bar/beat-list &key (measure '(4/4)) (span nil)) (loop for i in bar/beat-list collect (loop repeat (if (null span) (- (/ (car measure) 1/4) (1- (cadr i))) span) for x = (1- (cad
  21. ;;; CHANGE-TIME-STRUCTURES ;;; works okay, but not exactly precise because of rhy-to-integer, which is not very easy in some cases ;;; this function changes basic-rhy-structures (if it's all the time perhaps in x/32) ;;; to other/changing sections. the lengths/rests will be rounded like in LENGTH-RATIONAL-QUANTIZE ;;; rhy+span => '((32 2) (44 7)) => means in 32 three values, in 44 seven values (defun change-time-structure (omnseq rhy+span &key (basic-rhy 32) (round 1/4)) (let* ((intseq (loop for i in (omn :length (flatten omnseq)) collect (* i basic-rhy)))
  22. a sieve/filter-function - filters specific INTERVALS and replacing the others by rests. (don't work perfect, but as a sketch....) ;;; (defun equal/or (n alist) (car (loop for i in alist when (equal i n) collect 't))) ;;; FUNCTION (defun filter-omn-by-intervals (omn-seq intervals) (setf omn-seq (loop with omn-events = (single-events omn-seq) with i = 0 while (not (null (nth i omn-events))) when (equal/or (car (pitch-to-interval (append (omn :pitch (nth i omn-events)) (o
  23. (defun replace-lengths-of-a-pitch-sequence (omn-list pitch-list length-list) (flatten (loop with cnt = 0 for i in (single-events omn-list) when (equal (cadr i) (nth cnt pitch-list)) collect (append (list (nth cnt length-list)) (rest i)) and do (incf cnt) else collect i when (= cnt (length pitch-list)) do (setf cnt 0)))) (setf white-series-l (vector-to-pitch '(c4 c5) (gen-white-noise 100 :type :logistic :seed 23))) (replace-lengths-of-a-pitch-sequence (cons 't white-series-l) '(e4 f4 a4 gs4 g4 b4 c5 bb4) '(
  24. hi all i would like to code a NAND gate with more then two input-items (as extension to AND etc...). here is a simple version of the NAND function with two inputs, but i don't know how to exapnd it to n-inputs without putting the the inputs to in a list (like lisp-internal AND / OR)... https://en.wikipedia.org/wiki/NAND_gate i dont't want it: (nand '(t t t nil)) but like to have (nand t nil nil t t t) when i get a solution for that i will code an XOR, NOR etc.... so the "problem" is: how to manage in DEFUN more
  25. Hello All As I continue my fascination with the fractal structures contained in Per Norgard's infinity series, I am wondering whether it might be possible to apply the infinity to particular scales or modes? Say I want to generate an infinity-series based on a pre-existing scales/modes (like in G major) or by any self-defined mode such as (make-scale 'c2 49 :alt '(1 2 1 1)) Any help much appreciated as always. Kind regards Brian
  • Create New...

Important Information

Terms of Use Privacy Policy