<?xml version="1.0"?>
<rss version="2.0"><channel><title>Function Examples Latest Topics</title><link>https://opusmodus.com/forums/forum/36-function-examples/</link><description>Function Examples Latest Topics</description><language>en</language><item><title>Lisp/Opusmodus to Arduino</title><link>https://opusmodus.com/forums/topic/4141-lispopusmodus-to-arduino/</link><description><![CDATA[<p>A simple way to send serial data to Arduino. I'm sending Data to a Servo Motor...</p><p></p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>;; Setup TERMINAL (Mac)
;; stty -f /dev/dev/cu.usbmodem1401 9600 raw


(defparameter *arduino*
  (open "/dev/cu.usbmodem1401"
        :direction :output
        :if-exists :append
        :element-type '(unsigned-byte 8)))

;;Function
(defun send-byte (n)
          (uiop:run-program
           (format nil "printf '%b' \"\\x~2,'0X\" &gt; /dev/cu.usbmodem1401"
                   n)))


;;Test
(loop repeat 20
        do (send-byte (random 100))
        do (sleep 1))

</code></pre>]]></description><guid isPermaLink="false">4141</guid><pubDate>Wed, 01 Jul 2026 09:00:14 +0000</pubDate></item><item><title>Melodic Countour Function</title><link>https://opusmodus.com/forums/topic/4158-melodic-countour-function/</link><description><![CDATA[<p>Dear All,</p><p></p><p>Here is a function I created (vibe coded) with NotebookLM/Gemini to create melodic countour of any sequence of pitches. It works with OMN expressions and also with chords. In the case of chords, you must count how many voices there is in the chords in order to create a countour. After processing (melodizing), the function puts the chords back to its place.</p><p></p><p>Best,</p><p>Julio</p><p></p><p>EXAMPLE</p><p></p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>(setf contornos '((1 2 3) (3 1 2) (2 3 1) (1 3 2) (2 1 3) (3 2 1)))
(setf sequencia (gen-divide 3 (gen-repeat 10 '(q c4 e4 g4))))
(contour-mel-poly sequencia contornos)</code></pre><p></p><p></p><p>ORIGINAL</p><p></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4454" src="https://opusmodus.com/forums/uploads/monthly_2026_07/image.png.7b936a6eba60a8715de604ffb1b30de2.png" alt="image.png" title="image.png" width="998" height="134" loading="lazy"></p><p></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4455" src="https://opusmodus.com/forums/uploads/monthly_2026_07/image.png.5b3d816fb2afbd62444c6f4b1682f437.png" alt="image.png" title="image.png" width="1285" height="160" loading="lazy"></p><p></p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>(contour-mel-poly (gen-divide 4 (flatten sequencia)) '(0.5 0.49 2))
;; can be any number</code></pre><p></p><p></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4453" src="https://opusmodus.com/forums/uploads/monthly_2026_07/image.png.c3e11a7c536aeccec701d95f96163621.png" alt="image.png" title="image.png" width="1253" height="188" loading="lazy"></p><p></p><p></p><p></p><p></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4452" src="https://opusmodus.com/forums/uploads/monthly_2026_07/image.png.87dbe949240a29d66cfa0c5a63b712d5.png" alt="image.png" title="image.png" width="909" height="713" loading="lazy"></p><p></p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>(defun contour-mel-poly (omn-exp contornos)
  "Ordena alturas e acordes segundo um contorno melódico (ranking), 
   ajustando as oitavas para satisfazer a hierarquia do contorno."
  (let* ((dis (disassemble-omn omn-exp))
         (pitches (getf dis :pitch))
         (num-bars (length pitches))
         ;; 1. Alinha a lista de contornos ao número de compassos [2]
         (contorno-list (gen-trim num-bars (if (listp (car contornos)) contornos (list contornos)))))

    (labels ((apply-contour-logic (bar-ints contour)
               "Processa uma lista de inteiros (melodia/acordes) aplicando o contorno."
               (let* (;; A. Melodize: trata tudo como uma sequência linear de notas
                      (flat-ints (flatten bar-ints))
                      (pcs (mapcar (lambda (x) (mod x 12)) flat-ints))
                      (num-notes (length pcs))
                      ;; B. Cria mapeamento (PC, Rank-Alvo, Posição-Original)
                      (pos-rank-pairs (loop for pc in pcs 
                                            for rank in contour 
                                            for pos from 0
                                            collect (list :pc pc :rank rank :pos pos)))
                      ;; C. Ordena pelo ranking para definir as oitavas progressivamente
                      (sorted-by-rank (sort (copy-list pos-rank-pairs) #'&lt; 
                                            :key (lambda (x) (getf x :rank))))
                      (last-val -999)
                      (final-pos-val-pairs nil))

                 ;; D. Atribuição de oitavas baseada no ranking
                 (dolist (item sorted-by-rank)
                   (let* ((pc (getf item :pc))
                          (pos (getf item :pos))
                          (oct 0)
                          (candidate (+ (* oct 12) pc)))
                     ;; Garante que Rank N &gt; Rank N-1 (satisfaz posição aberta/fechada)
                     (while (&lt;= candidate last-val)
                        do (setf oct (1+ oct))
                           (setf candidate (+ (* oct 12) pc)))
                     (setf last-val candidate)
                     (push (cons pos candidate) final-pos-val-pairs)))

                 ;; E. Restaura a ordem linear e reagrupa acordes se existiam
                 (let* ((linear-ints (loop for i from 0 below num-notes
                                           collect (cdr (assoc i final-pos-val-pairs))))
                        (idx 0))
                   (mapcar (lambda (evt)
                             (if (listp evt)
                                 (prog1 (loop repeat (length evt) collect (nth idx linear-ints) do (incf idx)) nil)
                                 (prog1 (nth idx linear-ints) (incf idx))))
                           bar-ints)))))

      ;; 2. Processamento por compasso
      (let ((processed-pitches
             (mapcar (lambda (bar contour)
                       (let* ((bar-ints (pitch-to-integer bar))
                              (new-ints (apply-contour-logic bar-ints contour)))
                         ;; Converte de volta para pitches OMN [4]
                         (integer-to-pitch new-ints)))
                     pitches contorno-list)))

        ;; 3. Remontagem OMN final preservando a estrutura original [5]
        (make-omn :pitch processed-pitches
                  :length (getf dis :length)
                  :velocity (getf dis :velocity)
                  :articulation (getf dis :articulation))))))</code></pre>]]></description><guid isPermaLink="false">4158</guid><pubDate>Thu, 23 Jul 2026 18:11:53 +0000</pubDate></item><item><title>Poly-Demix</title><link>https://opusmodus.com/forums/topic/4106-poly-demix/</link><description><![CDATA[<p>Dear All, </p><p></p><p>An useful function do make various pitch-demix operations at once.</p><p></p><p><code>(defun poly-demix (n-list mat-omn)</code></p><p><code>  "Extrai as vozes especificadas em N-LIST de uma sequência OMN </code></p><p><code>   e as combina em um único fluxo polifônico."</code></p><p><code>  (let* (;; 1. Garante que n-list seja uma lista e extrai cada voz</code></p><p><code>         (extracted-voices (mapcar #'(lambda (n) </code></p><p><code>                                       (pitch-demix n mat-omn)) </code></p><p><code>                                   (list! n-list))))</code></p><p><code>    </code></p><p><code>    ;; 2. Aplica merge-voices sobre a lista de vozes extraídas</code></p><p><code>    (apply #'merge-voices extracted-voices)))</code></p><p></p><p></p><p>(setf mat-omn '((e. g2bb3d4f4a4 mf s -e e c4c5c5 e. g2bb3c4d4f4 s g3g4g4 -s s g2bb3d4f4a4) (q bb2db4f4ab4c5 mf -e e bb3bb4bb4 e. eb4eb5eb5 s ab3ab4ab4 -s s bb2db4ab4c5eb5))) </p><p></p><p></p><p>(poly-demix '(1 2 5) mat-omn)</p><p></p><p></p><p>((e. g2f4a4 s -e c5 e. g2d4f4 s g4 - g2f4a4) (q bb2ab4c5 -e bb4 e. eb5 s ab4 - bb2c5eb5))</p><p></p><p>Best, Julio</p><p></p>]]></description><guid isPermaLink="false">4106</guid><pubDate>Sun, 03 May 2026 00:17:40 +0000</pubDate></item><item><title>Interval/Pitch-Based Articulation</title><link>https://opusmodus.com/forums/topic/4143-intervalpitch-based-articulation/</link><description><![CDATA[<p>A sketch: I generate noise and define a list of intervals (or pitches) that is applied to the noise pitches. Whenever one of these intervals (or pitches) is detected, its dynamic is changed to <strong>fff</strong>. This creates a form of articulation that is determined by the intervallic structure.</p><p></p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>(setf intervals  '(-2 -1 1 2 5 -5))


(setf seq
 (loop repeat 200
       with alist = (filter-repeat 1 (vector-to-pitch '(a3 g5) (gen-noise  300)))
       with cnt = 0 
         
       when (memberp (car (pitch-to-interval (list (nth cnt alist)
                                             (nth  (1+ cnt) alist))))
                     intervals)

         append (make-omn :pitch (list (nth cnt alist)
                                       (nth  (1+ cnt) alist))
                          :length '(1/16 1/16)
                          :velocity '(fff fff))
         and do (incf cnt 1)
         

       else append (make-omn :pitch (list (nth cnt alist))
                             :length '(1/16)
                             :velocity '(ppp))
         
       do (incf cnt)))


(omn-list-plot seq :join-points t)</code></pre><p><video class="ipsEmbeddedVideo ipsRichText__align--block" data-controller="core.global.core.embeddedvideo" controls="" title="" preload="metadata"><source src="https://opusmodus.com/forums/uploads/monthly_2026_07/Bildschirmaufnahme2026-07-02um21_06_57.mov.3bec899dfb90fda0818d7eced62cc697.mov#t=0" type="video/quicktime"><a href="https://opusmodus.com/forums/applications/core/interface/file/attachment.php?id=4429&amp;key=034ac653c3260637707d8d439267554e" class="ipsAttachLink" data-fileid="4429" data-fileext="mov" rel="">Bildschirmaufnahme 2026-07-02 um 21.06.57.mov</a></source></video></p>]]></description><guid isPermaLink="false">4143</guid><pubDate>Thu, 02 Jul 2026 19:09:40 +0000</pubDate></item><item><title>range function</title><link>https://opusmodus.com/forums/topic/4116-range-function/</link><description><![CDATA[<p>Hello,</p><p>is there a simple range function in Opusmodus (no vector) like this?:</p><p></p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>(defun range (lis min max)
"
Range a list between min and max.
Ex.:
;; (range '(1 2 3 4 5) 1 2) =&gt; (1.0 1.25 1.5 1.75 2.0)
;; (range '(1 3 6 7) 1 2) =&gt; (1.0 1.3333334 1.8333334 2.0)
;; (range '(2 3 6 4 5 8 6 7) 2 3) =&gt; (2.0 2.1666667 2.6666667 2.3333333 2.5 3.0 2.6666667 2.8333333)
;; (range '(0.2 0.4 0.7 0.3 0.9) 0.3 1.2)
"
(let ((minlis (reduce #'min lis))
(maxlis (reduce #'max lis)))
(labels ((map-range (a1 a2 b1 b2 s)
(* 1.0 (+ b1
(/ (* (- s a1)
(- b2 b1))
(- a2 a1))))))
(loop for i in lis
collect (map-range minlis maxlis min max i)))))</code></pre><p></p><p>Achim</p>]]></description><guid isPermaLink="false">4116</guid><pubDate>Tue, 19 May 2026 22:42:17 +0000</pubDate></item><item><title>Diatonic Transposition or "Set Transposition" Function</title><link>https://opusmodus.com/forums/topic/4109-diatonic-transposition-or-set-transposition-function/</link><description><![CDATA[<p>Dear All,</p><p></p><p>Here are a version for a diatonic (or all purpose set-transpose) function that rounds material around a collection  used as reference).</p><p>Please, Let me know if you find bugs. </p><p></p><p>Best,</p><p></p><p>Julio</p><p></p><p><code>(defun set-transpose (n omn-sequence sets &amp;key (round 'up))</code></p><p><code>  "Realiza transposição diatônica por N passos em coleções de referência.</code></p><p><code>   Arredonda notas fora do set para cima ou para baixo conforme :round."</code></p><p><code>  (let* ((dis (disassemble-omn omn-sequence))</code></p><p><code>         (pitches (getf dis :pitch))</code></p><p><code>         (num-bars (length pitches))</code></p><p><code>         ;; Alinha N e os Sets ao número de sublistas (compassos)</code></p><p><code>         (n-list (gen-trim num-bars (if (listp n) n (list n))))</code></p><p><code>         (set-list (gen-trim num-bars sets)))</code></p><p><code>    (labels ((process-pitch (p val-n collection)</code></p><p><code>               (let* ((p-int (pitch-to-integer p))</code></p><p><code>                      ;; Normaliza a coleção para pitch-classes (0-11) ordenadas</code></p><p><code>                      (coll-pcs (sort (remove-duplicates </code></p><p><code>                                       (mapcar (lambda (x) (mod x 12)) </code></p><p><code>                                               (flatten (pitch-to-integer collection)))) </code></p><p><code>                                      #'&lt;))</code></p><p><code>                      (len-coll (length coll-pcs)))</code></p><p><code>                 </code></p><p><code>                 (flet ((transpose-single (single-p)</code></p><p><code>                          (let* ((pc (mod single-p 12))</code></p><p><code>                                 (oct (floor single-p 12))</code></p><p><code>                                 ;; 1. Arredondamento com info de oitava</code></p><p><code>                                 (r-info (get-rounded-info pc coll-pcs round))</code></p><p><code>                                 (rounded-pc (car r-info))</code></p><p><code>                                 (r-oct-shift (cdr r-info))</code></p><p><code>                                 ;; 2. Localiza índice e aplica N passos diatônicos</code></p><p><code>                                 (curr-idx (position rounded-pc coll-pcs))</code></p><p><code>                                 (new-idx (+ curr-idx val-n))</code></p><p><code>                                 ;; 3. Calcula deslocamento de oitava final (wrap-around)</code></p><p><code>                                 (final-oct-shift (+ r-oct-shift (floor new-idx len-coll)))</code></p><p><code>                                 (final-pc (nth (mod new-idx len-coll) coll-pcs)))</code></p><p><code>                            ;; 4. Reconstrói o pitch mantendo o registro original</code></p><p><code>                            (+ (* (+ oct final-oct-shift) 12) final-pc))))</code></p><p><code>                       </code></p><p><code>                       ;; Suporte para notas individuais ou acordes</code></p><p><code>                       (if (listp p-int)</code></p><p><code>                           (mapcar #'transpose-single p-int)</code></p><p><code>                           (transpose-single p-int)))))</code></p><p><code>             (get-rounded-info (pc coll direction)</code></p><p><code>               ;; Retorna (rounded-pc . octave-shift)</code></p><p><code>               (if (member pc coll)</code></p><p><code>                   (cons pc 0)</code></p><p><code>                   (case direction</code></p><p><code>                     (up (let ((higher (find pc coll :test #'&lt;)))</code></p><p><code>                           (if higher </code></p><p><code>                               (cons higher 0)</code></p><p><code>                               (cons (first coll) 1)))) ;; Wrap up: vai p/ próx oitava</code></p><p><code>                     (down (let ((lower (find pc coll :from-end t :test #'&gt;)))</code></p><p><code>                             (if lower</code></p><p><code>                                 (cons lower 0)</code></p><p><code>                                 (cons (car (last coll)) -1)))))))) ;; Wrap down: oitava anterior</code></p><p><code>      ;; Mapeamento bar-a-bar</code></p><p><code>      (let ((new-pitches (mapcar (lambda (bar bar-n bar-set)</code></p><p><code>                                   (mapcar (lambda (p) (process-pitch p bar-n bar-set)) bar))</code></p><p><code>                                 pitches n-list set-list)))</code></p><p><code>        </code></p><p><code>        ;; Remontagem OMN final preservando os outros parâmetros</code></p><p><code>        (make-omn :pitch (integer-to-pitch new-pitches)</code></p><p><code>                  :length (getf dis :length)</code></p><p><code>                  :velocity (getf dis :velocity)</code></p><p><code>                  :articulation (getf dis :articulation))))))</code></p><p></p><p></p><p>EXAMPLE</p><p></p><p>(setf temav1 '((e. a4 mf s -e c5 e. f4 s g4 - a4) (q c5 mf -e bb4 e. eb5 s ab4 - eb5)  (q cs5 mf -e e5 e. as4 s b4 - cs5))) </p><p></p><p>(setf sets (expand-tonality '((ab4 major) (c4 major))))</p><p></p><p>(set-transpose -4 temav1 sets :round 'down) </p><p></p><p>((e. cs4 mf s -e f4 e. bb3 s c4 - cs4) (q f4 mf -e d4 e. g4 s c4 - g4) (q g4 mf -e gs4 e. eb4 s - g4))</p><p></p><p>(set-transpose -4 temav1 sets :round 'up)</p><p></p><p>((e. eb4 mf s -e f4 e. bb3 s c4 - eb4) (q f4 mf -e e4 e. a4 s d4 - a4) (q g4 mf -e bb4 e. eb4 s f4 - g4)) </p><p></p><p>(setf sets (expand-tonality '((ab4 messiaen-mode2) (c4 major))))</p><p></p><p>(set-transpose -4 temav1 sets :round 'up)</p>]]></description><guid isPermaLink="false">4109</guid><pubDate>Wed, 06 May 2026 19:58:50 +0000</pubDate></item><item><title>tendencies and vector-smooth</title><link>https://opusmodus.com/forums/topic/4100-tendencies-and-vector-smooth/</link><description><![CDATA[<p>Hello,</p><p>when using vector-smooth my tendencies start around 0.1 but end &gt;0.2 (should be around 0.1 as well)</p><p>How can I prevent that?<br></p><pre spellcheck="" class="ipsCode language-plaintext" data-language="Plain Text"><code>(setf tend-list
'(0.1 0.4 0.2 0.6 0.5 0.5 0.9 0.7 0.7 1 0.9 1.2 0.9 0.9 0.5 0.5 0.6 0.2 0.2 0.1))

(list-plot
(setf dur-mults
(loop for i in durlens
with seed = (init-seed 123)
collect
(vector-smooth 0.3
(gen-tendency i tend-list :variance 0.2))))
:zero-based t :join-points t)</code></pre><p></p><p>Thanks for help, Achim</p>]]></description><guid isPermaLink="false">4100</guid><pubDate>Mon, 13 Apr 2026 17:35:13 +0000</pubDate></item><item><title>All previous rewrite functions used together</title><link>https://opusmodus.com/forums/topic/4098-all-previous-rewrite-functions-used-together/</link><description><![CDATA[<p>Ciao, Opusmoders </p><p></p><p>All previous rewrite functions used in conjunction for transformations.</p><p></p><p>Ciao !</p><p></p><p><a rel="" href="https://opusmodus.com/forums/topic/4097-rewrite-len-function/#comment-14209">https://opusmodus.com/forums/topic/4097-rewrite-len-function/#comment-14209</a></p><p></p><p><code>(setf expressao-omn '((s eb4 d4 e a4 -s s eb4) (h eb4 a4 -s eb4 d4 -s)</code></p><p><code>                      (e. d4 a4 eb4 d4)</code></p><p><code>                      (-q e f4 s c5 qs fs4)))</code></p><p></p><p><img class="ipsImage ipsRichText__align--block ipsRichText__align--width-custom" data-fileid="4399" src="https://opusmodus.com/forums/uploads/monthly_2026_04/image.png.b235b138e82177f81d861f209aeaf392.png" alt="image.png" title="" width="912" height="144" style="--i-media-width: 510px;" loading="lazy"></p><p></p><p></p><p><code>(rewrite-pit </code></p><p><code>(rewrite-dyn </code></p><p><code>(rewrite-len expressao-omn </code></p><p><code>'(h -e s q -h q -q s s s)) </code></p><p><code>'(pp&lt; ff mf fff p &lt; &lt; fff ppp fff mf fff p))</code></p><p><code>'(c4 g5))</code></p><p></p><p><img class="ipsImage ipsRichText__align--block ipsRichText__align--width-fullwidth" data-fileid="4398" src="https://opusmodus.com/forums/uploads/monthly_2026_04/image.png.1c1654b4a3d931779f730579ea1de1d2.png" alt="image.png" title="" width="1657" height="339" loading="lazy"></p><p></p><p></p><div class="ipsEmbeddedOther" data-og-user_text="https://opusmodus.com/forums/topic/4096-rewrite-pit-function/#comment-14208"><iframe src="https://opusmodus.com/forums/topic/4096-rewrite-pit-function/?do=embed&amp;comment=14208&amp;embedComment=14208&amp;embedDo=findComment#comment-14208" data-embedcontent="" data-internalembed="" data-controller="core.front.core.autosizeiframe" data-embedauthorid="394" data-ipsembed-contentapp="forums" data-ipsembed-contentclass="forums_Topic" data-ipsembed-contentid="4096" data-ipsembed-timestamp="1775874151" data-ipsembed-contentcommentid="14208" allowfullscreen="" data-og-user_text="https://opusmodus.com/forums/topic/4096-rewrite-pit-function/#comment-14208" loading="lazy"></iframe></div><p></p><p></p><p><a rel="" href="https://opusmodus.com/forums/topic/4097-rewrite-len-function/#comment-14209">https://opusmodus.com/forums/topic/4097-rewrite-len-function/#comment-14209</a></p><p></p><p></p><div class="ipsEmbeddedOther" data-og-user_text="https://opusmodus.com/forums/topic/4095-rewrite-dyn-function/#comment-14207"><iframe src="https://opusmodus.com/forums/topic/4095-rewrite-dyn-function/?do=embed&amp;comment=14207&amp;embedComment=14207&amp;embedDo=findComment#comment-14207" data-embedcontent="" data-internalembed="" data-controller="core.front.core.autosizeiframe" data-embedauthorid="394" data-ipsembed-contentapp="forums" data-ipsembed-contentclass="forums_Topic" data-ipsembed-contentid="4095" data-ipsembed-timestamp="1775874180" data-ipsembed-contentcommentid="14207" allowfullscreen="" data-og-user_text="https://opusmodus.com/forums/topic/4095-rewrite-dyn-function/#comment-14207" loading="lazy"></iframe></div><p></p>]]></description><guid isPermaLink="false">4098</guid><pubDate>Sat, 11 Apr 2026 02:24:47 +0000</pubDate></item><item><title>rewrite-len function</title><link>https://opusmodus.com/forums/topic/4097-rewrite-len-function/</link><description><![CDATA[<p>Last one... Time to go to bed in Brasil</p><p></p><p>Function to rewrite lengths</p><p></p><p>BEst,</p><p>Julio</p><p></p><p><code>(defun rewrite-len (expressao-omn new-lengths-list)</code></p><p><code>  "Substitui os comprimentos (lengths) de uma expressão OMN por uma lista fornecida, </code></p><p><code>   repetindo-a ciclicamente e mantendo a estrutura de sublistas original."</code></p><p><code>  (let* ((dis (disassemble-omn expressao-omn))          ;; Desmonta a expressão original [2]</code></p><p><code>         (old-pit (getf dis :pitch))                    ;; Extrai as alturas [4]</code></p><p><code>         (old-vel (getf dis :velocity))                 ;; Extrai as velocidades [4]</code></p><p><code>         (old-art (getf dis :articulation))             ;; Extrai as articulações [4]</code></p><p><code>         </code></p><p><code>         ;; 1. Mapeia a estrutura original (quantidade de eventos por sublista)</code></p><p><code>         ;; Captura o número de elementos rítmicos em cada compasso [3, 5]</code></p><p><code>         (structure (mapcar #'length (getf dis :length))) </code></p><p><code>         (total-events (apply #'+ structure))           ;; Soma total de eventos [6]</code></p><p><code>         </code></p><p><code>         ;; 2. Gera a sequência rítmica cíclica com base no total de eventos</code></p><p><code>         ;; gen-trim estende a lista do usuário para preencher todos os espaços [3, 7]</code></p><p><code>         (new-flat-lengths (gen-trim total-events new-lengths-list))</code></p><p><code>         </code></p><p><code>         ;; 3. Re-organiza os novos ritmos na estrutura de sublistas original [3, 8]</code></p><p><code>         (new-structured-lengths (gen-divide structure new-flat-lengths)))</code></p><p><code>    ;; 4. Remonta o objeto OMN completo com os parâmetros preservados [3, 4]</code></p><p><code>    (make-omn :pitch old-pit</code></p><p><code>              :length new-structured-lengths</code></p><p><code>              :velocity old-vel</code></p><p><code>              :articulation old-art)))</code></p><p></p><p>;;USE</p><p></p><p></p><p><code>(setf expressao-omn '((s eb4 d4 e a4 -s s eb4) (h eb4 a4 -s eb4 d4 -s)</code></p><p><code>                      (e. d4 a4 eb4 d4)</code></p><p><code>                      (-q e f4 s c5 qs fs4)))</code></p><p><code>(omn-to-time-signature (rewrite-len expressao-omn '(h -e s q -h q -q s s s)) '(3 4))</code></p><p></p><p>;;RESULT</p><p></p><p><code>((h eb4 mf -e s d4 a4 tie) (e. a4 -h s eb4 mf tie) (e. eb4 mf -q s a4 eb4 d4 e eb4 tie) (q. eb4 -e s d4 mf e. a4 tie) (s a4 -h e. f4 mf tie) (s f4 mf -q s c5 fs4))</code></p>]]></description><guid isPermaLink="false">4097</guid><pubDate>Sat, 11 Apr 2026 02:14:20 +0000</pubDate></item><item><title>rewrite-pit function</title><link>https://opusmodus.com/forums/topic/4096-rewrite-pit-function/</link><description><![CDATA[<p>Hey, Opusmoders</p><p></p><p>Here is one more function in the style of the previous one (rewrite-dyn). This time to rewrite pitches.</p><p></p><p></p><p><code>(defun rewrite-pit (expressao-omn pitch-list)</code></p><p><code>  "Substitui as alturas de uma expressão OMN por uma lista customizada, </code></p><p><code>   fazendo a repetição cíclica se a lista for menor que o número de notas."</code></p><p><code>  (let* ((dis (disassemble-omn expressao-omn))          ;; Desmonta a expressão [3, 6]</code></p><p><code>         (pitches (getf dis :pitch))                    ;; Extrai alturas atuais</code></p><p><code>         (lengths (getf dis :length))                  ;; Extrai durações (inclui rests) [7]</code></p><p><code>         (velocities (getf dis :velocity))              ;; Extrai dinâmicas [8]</code></p><p><code>         (articulations (getf dis :articulation))        ;; Extrai articulações/ties [9, 10]</code></p><p><code>         ;; 1. Mapeia a quantidade de notas em cada sublista/compasso</code></p><p><code>         (counts (mapcar #'length pitches))             ;; [2, 5]</code></p><p><code>         ;; 2. Calcula o total de eventos de nota para o preenchimento</code></p><p><code>         (total-notes (apply #'+ (flatten counts)))     ;; [2, 11]</code></p><p><code>         ;; 3. Gera a lista de novas alturas repetindo o padrão do usuário</code></p><p><code>         (flat-pitches (gen-trim total-notes pitch-list)) ;; [2, 4]</code></p><p><code>         ;; 4. Redistribui as alturas na estrutura de sublistas original</code></p><p><code>         (structured-pitches (gen-divide counts flat-pitches))) ;; [2, 5]</code></p><p><code>    </code></p><p><code>    ;; 5. Remonta o objeto OMN completo preservando os demais parâmetros</code></p><p><code>    (make-omn :pitch structured-pitches</code></p><p><code>              :length lengths</code></p><p><code>              :velocity velocities</code></p><p><code>              :articulation articulations)))            ;; [2, 3]</code></p><p></p><p>;;USE</p><p></p><p></p><p><code>(setf expressao-omn '((s eb4 d4 e a4 -s s eb4 tie) (h eb4 a4 -s eb4 d4 -s tie) </code></p><p><code>               (e. d4 a4 eb4 d4) </code></p><p><code>               (-q e f4 s c5 qs fs4)))</code></p><p></p><p>Using both rewrite-dyn and rewrite-pit </p><p></p><p><code>(rewrite-pit expressao-omn '(c4 e4 d4 c4 c4))</code></p><p><code>(rewrite-dyn (rewrite-pit expressao-omn '(c4 e4 d4 c4 c4)) '(ff &gt; p p&lt; ff&gt; pp ff p p&lt; ff p mf ppp p &lt; ff))</code></p><p></p><p>Best !!</p><p></p><p>Julio Herrlein</p>]]></description><guid isPermaLink="false">4096</guid><pubDate>Sat, 11 Apr 2026 01:24:46 +0000</pubDate></item><item><title>rewrite-dyn function</title><link>https://opusmodus.com/forums/topic/4095-rewrite-dyn-function/</link><description><![CDATA[<p>Hello, Opusmoders</p><p></p><p>This is a very cool and easy to use function to rewrite dynamics.</p><p>Check it out. Hope you like it !</p><p>Best,</p><p>Julio</p><p></p><p><code>(defun rewrite-dyn (expressao-omn dynamic-list)</code></p><p><code>  "Substitui as dinâmicas de uma expressão OMN por uma lista customizada, </code></p><p><code>   fazendo a rotação cíclica se a lista for menor que o número de notas."</code></p><p><code>  (let* ((dis (disassemble-omn expressao-omn))          ; [2, 3]</code></p><p><code>         (pitches (getf dis :pitch))</code></p><p><code>         (lengths (getf dis :length))</code></p><p><code>         (articulations (getf dis :articulation))</code></p><p><code>         ;; 1. Mapeia a estrutura de cada sublista (quantidade de notas por compasso)</code></p><p><code>         (counts (mapcar #'length pitches))             ; [6]</code></p><p><code>         ;; 2. Calcula o total de notas para gerar dinâmicas suficientes</code></p><p><code>         (total-notes (apply #'+ (flatten counts)))     ; [7]</code></p><p><code>         ;; 3. Cria a lista plana de dinâmicas repetindo o padrão do usuário [4]</code></p><p><code>         (flat-vels (gen-trim total-notes dynamic-list))</code></p><p><code>         ;; 4. Redistribui as dinâmicas na estrutura de sublistas original [5]</code></p><p><code>         (structured-vels (gen-divide counts flat-vels)))</code></p><p><code>    </code></p><p><code>    ;; 5. Remonta o objeto OMN completo com os novos parâmetros [3]</code></p><p><code>    (make-omn :pitch pitches</code></p><p><code>              :length lengths</code></p><p><code>              :velocity structured-vels</code></p><p><code>              :articulation articulations)))</code></p><p></p><p>;; USE</p><p>;; Exemplo 1: Dinâmicas simples</p><p></p><p><code>(setf expressao-omn '((s eb4 d4 e a4 -s s eb4 tie) (h eb4 a4 -s eb4 d4 -s tie) </code></p><p><code>               (e. d4 a4 eb4 d4) </code></p><p><code>               (-q e f4 s c5 qs fs4)))</code></p><p></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4396" src="https://opusmodus.com/forums/uploads/monthly_2026_04/image.png.8cc59f1ade67e4efc78c6e8e30c476d2.png" alt="image.png" title="" width="937" height="125" loading="lazy"></p><p></p><p><code>(rewrite-dyn expressao-omn '(p mf ff))</code></p><p></p><p><code>;; &gt;&gt; ((s eb4 p d4 mf e a4 ff -s eb4 p tie) (h eb4 mf a4 ff -s eb4 p d4 mf - d4 ff tie) (e. d4 p a4 mf eb4 ff d4 p) (-q e f4 mf s c5 ff qs fs4 p))</code></p><p></p><p></p><p>;; Exemplo 2: Incluindo crescendos</p><p></p><p><code>(rewrite-dyn expressao-omn '(ff &gt; p p&lt; ff&gt; pp ff p p&lt; ff p mf ppp p &lt; ff))</code></p><p></p><p><code>;; ((s eb4 ff d4 &gt; e a4 p -s eb4 p&lt; tie) (h eb4 ff&gt; a4 pp -s eb4 ff d4 p - d4 p&lt; tie) (e. d4 ff a4 p eb4 mf d4 ppp) (-q e f4 p s c5 &lt; qs fs4 ff))</code></p><p></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4397" src="https://opusmodus.com/forums/uploads/monthly_2026_04/image.png.c6f67f048aace69b80455cb68917ba0e.png" alt="image.png" title="" width="1270" height="148" loading="lazy"></p>]]></description><guid isPermaLink="false">4095</guid><pubDate>Sat, 11 Apr 2026 00:52:19 +0000</pubDate></item><item><title>shift-rhythm Function</title><link>https://opusmodus.com/forums/topic/4094-shift-rhythm-function/</link><description><![CDATA[<p>Hello, Opusmoders</p><p></p><p>Sometime ago I was here searching for a function to displace rhtyhms by a length amount, not just like a list rotation.</p><p>Now I did this prototype. I think that this can be very useful, specially inside counterpoint dictums where patterns can be displaced ( I did not tried inside the counterpoint function but seems like it will work).</p><p>Hope it can be useful to you too.</p><p></p><p>All the best,</p><p>Julio</p><p></p><p><code>(defun shift-rhythm (rhythm shift-length &amp;key span)</code></p><p></p><p><code>;"Moves rhythmic material by inserting a pause at the beginning.</code></p><p><code>;Use length-adjust to ensure the result fits within the span."</code></p><p></p><p><code>(let* ((rhy (flatten rhythm))</code></p><p><code>;;;; Ensures a linear list for processing</code></p><p><code>;; Adds the offset value as a negative pause at the beginning [5]</code></p><p><code>(with-offset (append (list (- (abs shift-length))) rhy))</code></p><p></p><p><code>;;Define the target span: either the requested one or the original rhythm.</code></p><p><code>(target-span (or span (get-span rhythm))))</code></p><p></p><p><code>;; The length-adjust function adjusts the total to the desired span [1].</code></p><p><code>;; With :position 'e (default), it removes or adds from the end of the list [6].</code></p><p><code>(length-adjust target-span with-offset :omn t :type 'r)))</code></p><p></p><p><code>;;; USE</code></p><p><code>;Exemplo 1: Span de 4/4 (1/1)</code></p><p><code>(setf ideia '(e c5 e d4 q f4 -h)) ;; Span original de 1/1</code></p><p><code>(shift-rhythm ideia 1/8 :span 3/4)</code></p><p><code>;; (-e e c5 d4 q f4 -e)</code></p><p><code>(shift-rhythm ideia 3/8 :span 5/4)</code></p><p><code>;; (-q. e c5 d4 q f4 -q.)</code></p><p></p><p>also with negative displacement</p><p></p><p><code>(setf ideia '(-h e c5 e d4 q f4 -h))</code></p><p><code>(shift-rhythm ideia -1/8 :span 7/4)</code></p><p><code>;;(-e -h e c5 d4 q f4 -h -e)</code></p><p>It could be perfected to deal with nested sublists and with different displacements for each sublist, like</p><p></p><p>(setf ideia '((-h e c5 e d4 q f4 -h)(-h e c5 e d4 q f4 -h.)(-h e c5 e d4 q f4 -q))</p><p>(shift-rhythm ideia '((-1/8) (2/16) (3/8)) :span 7/4)</p><p></p><p>etc</p>]]></description><guid isPermaLink="false">4094</guid><pubDate>Fri, 10 Apr 2026 16:56:39 +0000</pubDate></item><item><title>merge-rotated-sublists function</title><link>https://opusmodus.com/forums/topic/4082-merge-rotated-sublists-function/</link><description><![CDATA[<p>Hello, Opusmoders</p><p></p><p>I did (with a little help of Notebooklm) this cool function whose function is to concatenate 2 diferent lists with sublists, merging the first sublist of the list A with the first sublist of list B, with the options <br>1) to choose how many elements of each list to use; and</p><p>2) the possibility of not only mix different numbers of elements in each list but also the possibility to select the starting element of the list to pick elements.</p><p>3) The function also consider each list as a rotating element: for example, if 5 elements are required from the list (1 2 3), starting in the first element, the result will be (1 2 3 1 2), if the start is on the second element, the result will be (2 3 1 2 3) and so on.</p><p></p><p>This is useful for me. Hope you like it.</p><p></p><p>Best,</p><p>Julio</p><p></p><p></p><p><code>(defun get-rotated-elements (lst start count)</code></p><p><code>"Extracts COUNT elements from LST starting at index START, wrapping around if needed."</code></p><p><code>(let ((len (length lst)))</code></p><p><code>(loop for i from 0 below count</code></p><p><code>collect (nth (mod (+ start i) len) lst))))</code></p><p><code>(defun merge-rotated-sublists (list-a list-b counts-a counts-b starts-a starts-b)</code></p><p><code>"Merges sublists from A and B based on specific counts and starting positions with rotation."</code></p><p><code>(mapcar #'(lambda (sub-a sub-b n m s-a s-b)</code></p><p><code>(append (get-rotated-elements sub-a s-a n)</code></p><p><code>(get-rotated-elements sub-b s-b m)))</code></p><p><code>list-a list-b counts-a counts-b starts-a starts-b))</code></p><p><code>Example of Usage</code></p><p></p><p><code>(setf list-a '((1 2 3 4) (a b c) (q w e r t)))</code></p><p><code>(setf list-b '((4 5 6 7) (d e f) (a s d f g)))</code></p><p><code>(merge-rotated-sublists list-a list-b '(2 1 5) '(1 5 3) '(0 2 2) '(0 0 1))</code></p><p><code>;; Result: ((1 2 4) (c d e f d e) (e r t q w s d f))</code></p><p><code>(merge-rotated-sublists list-a list-b '(2 7 1) '(4 3 7) '(0 0 0) '(1 1 0))</code></p><p><code>;((1 2 5 6 7 4) (a b c a b c a e f d) (q a s d f g a s))</code></p>]]></description><guid isPermaLink="false">4082</guid><pubDate>Fri, 20 Mar 2026 18:20:09 +0000</pubDate></item><item><title>remove successive repeated dynamics and attributes</title><link>https://opusmodus.com/forums/topic/4080-remove-successive-repeated-dynamics-and-attributes/</link><description><![CDATA[<p>Does anyone has an idea how to get rid of all successive repeated dynamics and attributes?</p><p>Thanks a lot, Achim</p><p></p><p><code>((-w) (-w) (w cs6 &lt;mp&gt; -14c) (w c6 &lt;mp&gt; -31c) (w c6 &lt;mp&gt; -31c) (w c6 &lt;mp&gt; -31c) (w c6 &lt;mp&gt; -31c) (w c6 &lt;mp&gt; -31c) (w cs6 &lt;mp&gt; -49c) (w cs6 &lt;mp&gt; -49c) (w cs6 &lt;mp&gt; -49c) (w cs6 &lt;mp&gt; -49c) (w cs6 &lt;mp&gt; 5c) (w cs6 &lt;mp&gt; 5c) (w cs6 &lt;mp&gt; 5c) (w c6 &lt;mp&gt;) (w c6 &lt;mp&gt; 2c) (w c6 &lt;mp&gt; 2c) (w c6 &lt;mp&gt; 2c) (w c6 &lt;mp&gt; 2c) (w c6 &lt;mp&gt; 5c) (w c6 &lt;mp&gt; 5c) (w c6 &lt;mp&gt; 5c) (w a5 &lt;mp&gt; -31c) (w a5 &lt;mp&gt; -31c) (w a5 &lt;mp&gt; -31c) (w gs5 &lt;mp&gt; -14c))</code></p>]]></description><guid isPermaLink="false">4080</guid><pubDate>Tue, 17 Mar 2026 18:46:18 +0000</pubDate></item><item><title>harmonics function</title><link>https://opusmodus.com/forums/topic/4069-harmonics-function/</link><description><![CDATA[<p>Using this expression</p><p><code>(harmonics 'a2 8 :quantize nil :type :hertz)</code></p><p>I am getting</p><p><code>(110.0 220.0 329.62756 440.0 546.4174 659.2551 772.751 880.0)</code></p><p>but I am expecting</p><p><code>(110.0 220.0 330.0 440.0 550.0 660.0 770.0 880.0)</code></p><p>What am I understanding wrong?</p><p>Best, Achim</p>]]></description><guid isPermaLink="false">4069</guid><pubDate>Fri, 27 Feb 2026 12:59:05 +0000</pubDate></item><item><title>def-score :tempo keyword</title><link>https://opusmodus.com/forums/topic/4074-def-score-tempo-keyword/</link><description><![CDATA[<p>Are there any examples about how to apply the different features in the :tempo keyword in def-score?</p><p>Achim</p>]]></description><guid isPermaLink="false">4074</guid><pubDate>Sat, 07 Mar 2026 14:03:55 +0000</pubDate></item><item><title>N-Tonic-Library Creator</title><link>https://opusmodus.com/forums/topic/4060-n-tonic-library-creator/</link><description><![CDATA[<p>Hi alltogether, with this post, I want to share with you my Math-N-Tonic-Library creators. They use 2 different naming shemes and are compiled in two lisp files. </p><p>They have been algorithmically created in order to collect all the mathematically possible tonalities:</p><p></p><p>;; Complete Summary</p><p>;; ==============================================================</p><p>;; Ditonic‑note scales: 66</p><p>;; Tritonic‑note scales: 220</p><p>;; Tetratonic‑note scales: 495</p><p>;; Pentatonic‑note scales: 792</p><p>;; Hexatonic‑note scales: 924</p><p>;; Heptatonic‑note scales: 792</p><p>;; Octatonic‑note scales: 495</p><p>;; Nonatonic‑note scales: 220</p><p>;; Decatonic‑note scales: 66</p><p>;; Undecatonic‑note scales: 12</p><p>;; Total mathematical tonalities: 4082</p><p></p><p>Once executed, the tonalities are available in Opusmodus. Place the chosen (or both) lisp file(s) into your Extensions Folder.</p><p></p><p>Here are the starts of the two files:</p><p></p><p>(in-package :Opusmodus)</p><p>;;; ==============================================================</p><p>;;; Math‑Tonalities — Complete Output</p><p>;;; ==============================================================</p><p>;; ditonic‑note tonalities (66 total)</p><p>;; ---------------------------------------------------------------</p><p>;; Group 01 (starting on 0)</p><p>;; ----------------------------------------------</p><p>(create-tonality math-ditonic-01-001 '(0 1))</p><p>(create-tonality math-ditonic-01-002 '(0 2))</p><p>(create-tonality math-ditonic-01-003 '(0 3))</p><p>(create-tonality math-ditonic-01-004 '(0 4))</p><p>(create-tonality math-ditonic-01-005 '(0 5))</p><p>(create-tonality math-ditonic-01-006 '(0 6))</p><p>(create-tonality math-ditonic-01-007 '(0 7))</p><p>(create-tonality math-ditonic-01-008 '(0 8))</p><p>(create-tonality math-ditonic-01-009 '(0 9))</p><p>(create-tonality math-ditonic-01-010 '(0 10))</p><p>(create-tonality math-ditonic-01-011 '(0 11))</p><p>;; Group 02 (starting on 1)</p><p>;; ----------------------------------------------</p><p>(create-tonality math-ditonic-02-001 '(1 2))</p><p>(create-tonality math-ditonic-02-002 '(1 3))</p><p>(create-tonality math-ditonic-02-003 '(1 4))</p><p>(create-tonality math-ditonic-02-004 '(1 5))</p><p>(create-tonality math-ditonic-02-005 '(1 6))</p><p>......</p><p></p><p>(in-package :Opusmodus)</p><p>;;; ==============================================================</p><p>;;; Math‑Tonalities — Complete Output</p><p>;;; ==============================================================</p><p>;; Ditonic‑note tonalities (66 total)</p><p>;; ---------------------------------------------------------------</p><p>;; Group 01 (starting on 0)</p><p>;; ----------------------------------------------</p><p>(create-tonality math-02-tonic-01-001 '(0 1))</p><p>(create-tonality math-02-tonic-01-002 '(0 2))</p><p>(create-tonality math-02-tonic-01-003 '(0 3))</p><p>(create-tonality math-02-tonic-01-004 '(0 4))</p><p>(create-tonality math-02-tonic-01-005 '(0 5))</p><p>(create-tonality math-02-tonic-01-006 '(0 6))</p><p>(create-tonality math-02-tonic-01-007 '(0 7))</p><p>(create-tonality math-02-tonic-01-008 '(0 8))</p><p>(create-tonality math-02-tonic-01-009 '(0 9))</p><p>(create-tonality math-02-tonic-01-010 '(0 10))</p><p>(create-tonality math-02-tonic-01-011 '(0 11))</p><p>;; Group 02 (starting on 1)</p><p>;; ----------------------------------------------</p><p>(create-tonality math-02-tonic-02-001 '(1 2))</p><p>(create-tonality math-02-tonic-02-002 '(1 3))</p><p>(create-tonality math-02-tonic-02-003 '(1 4))</p><p>(create-tonality math-02-tonic-02-004 '(1 5))</p><p>(create-tonality math-02-tonic-02-005 '(1 6))</p><p>......<a class="ipsAttachLink" data-fileid="4354" href="https://opusmodus.com/forums/applications/core/interface/file/attachment.php?id=4354&amp;key=c4cbbb1bb2109b5f94ab34e79de30f5c" data-fileext="lisp" rel="">Math-N-Tonic-Library-Creator.lisp</a></p><p>
<a class="ipsAttachLink" href="https://opusmodus.com/forums/applications/core/interface/file/attachment.php?id=4355&amp;key=abe867bfba01e3413d183dc6bcf81049" data-fileExt='lisp' data-fileid='4355' data-filekey='abe867bfba01e3413d183dc6bcf81049'>Math-Tonality-Library-Creator.lisp</a></p>]]></description><guid isPermaLink="false">4060</guid><pubDate>Wed, 18 Feb 2026 18:13:25 +0000</pubDate></item><item><title>Sample Slicing, Chopping and Breakbeats</title><link>https://opusmodus.com/forums/topic/4002-sample-slicing-chopping-and-breakbeats/</link><description><![CDATA[<p>Dear Friends,</p><p></p><p>With the audio tools in windows can we make some breakbeats, like chopping audio files, like beat slicing and starting in different parts of the audio file, like the video below (serato sample plugin), and also sync accurately with midi parts in Opusmodus ?</p><p>All the best !</p><p>Julio</p><p></p><p>SOME HISTORY</p><p></p><div class="ipsEmbeddedVideo" contenteditable="false" data-og-user_text="https://youtu.be/i4ViYJn9MhU" style="--i-media-width: 100%;"><iframe width="200" height="113" src="https://www.youtube-nocookie.com/embed/i4ViYJn9MhU?feature=oembed" frameborder="0" allow="encrypted-media; picture-in-picture; fullscreen" title="Chopping up The Amen Break in Serato Studio #seratostudio" loading="lazy"></iframe></div><p></p><div class="ipsEmbeddedVideo" contenteditable="false" data-og-user_text="https://youtu.be/eJf9Jptq7VY" style="--i-media-width: 100%;"><iframe width="200" height="113" src="https://www.youtube-nocookie.com/embed/eJf9Jptq7VY?feature=oembed" frameborder="0" allow="encrypted-media; picture-in-picture; fullscreen" title="Breakbeat Deconstruction: From hip hop to drum &amp; bass and beyond | Loop" loading="lazy"></iframe></div><p></p><p>Here are some breakbeats (amen sample)</p><div class="ipsEmbeddedVideo" contenteditable="false" data-og-user_text="https://youtu.be/izc8xtNR7LU" style="--i-media-width: 100%;"><iframe width="200" height="113" src="https://www.youtube-nocookie.com/embed/izc8xtNR7LU?feature=oembed" frameborder="0" allow="encrypted-media; picture-in-picture; fullscreen" title="Amen Break Samples (174 bpm)" loading="lazy"></iframe></div><p></p><div class="ipsEmbeddedVideo" contenteditable="false" data-og-user_text="https://youtu.be/zqTB5XSjmzI" style="--i-media-width: 100%;"><iframe width="200" height="113" src="https://www.youtube-nocookie.com/embed/zqTB5XSjmzI?feature=oembed" frameborder="0" allow="encrypted-media; picture-in-picture; fullscreen" title="10 MOST ICONIC AMEN PATTERNS IN JUNGLE HISTORY!! | HOW TO CHOP BREAKS" loading="lazy"></iframe></div><p></p><p>If possible, would be great to includ a sample of the amen beat inside the documentation with an example of breakbeat.</p><p>This function can also serve to launch samples of any nature for electroacoustic or mixed music.</p>]]></description><guid isPermaLink="false">4002</guid><pubDate>Sun, 23 Nov 2025 21:05:09 +0000</pubDate></item><item><title>Display Issues with Quintuplets and Septuplets with Rests in OMN</title><link>https://opusmodus.com/forums/topic/4053-display-issues-with-quintuplets-and-septuplets-with-rests-in-omn/</link><description><![CDATA[<p>Hi,<br><br>I have a valid rhythmic notation (quarter notes, eighth notes, triplets, etc.) where only quintuplets and septuplets display incorrectly as soon as rests are included in the group (-5q, -7q).<br>Triplets don't cause any problems, but for 5 and 7, the grouping breaks (incorrect braces), as if the engine is closing/reopening the tuplets.<br><br>Is this a known limitation of how rests are handled within odd-numbered tuplets (5, 7) in OMN, or is there a strict rule to follow to avoid this behavior?</p><p></p><p>Thank you for your help.</p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4332" src="https://opusmodus.com/forums/uploads/monthly_2026_02/image.png.cc0ceb6b45e98a9229993aa26273bcbd.png" alt="image.png" title="" width="1312" height="118" loading="lazy"></p><p></p><p>(setf accent   '((q -q -q ) </p><p>                 (e -e -e e -e -e)</p><p>                 (3q -3q -3q 3q -3q -3q 3q -3q -3q)</p><p>                 (s -s -s s -s -s s -s -s s -s -s) </p><p>                 (5q -5q -5q 5q -5q -5q 5q -5q -5q 5q -5q -5q 5q -5q -5q)  </p><p>                 (6q -6q -6q 6q -6q -6q 6q -6q -6q 6q -6q -6q 6q -6q -6q 6q -6q -6q)</p><p>                 (7q -7q -7q 7q -7q -7q 7q -7q -7q 7q -7q -7q 7q -7q -7q 7q -7q -7q 7q -7q -7q)</p><p>                 (8q -8q -8q 8q -8q -8q 8q -8q -8q 8q -8q -8q 8q -8q -8q 8q -8q -8q 8q -8q -8q 8q -8q -8q) </p><p>                 (8q -8q -8q 8q -8q -8q 8q -8q -8q 8q -8q -8q 8q -8q -8q 8q -8q -8q 8q -8q -8q 8q -8q -8q) </p><p>                 (7q -7q -7q 7q -7q -7q 7q -7q -7q 7q -7q -7q 7q -7q -7q 7q -7q -7q 7q -7q -7q)</p><p>                 (6q -6q -6q 6q -6q -6q 6q -6q -6q 6q -6q -6q 6q -6q -6q 6q -6q -6q)</p><p>                 (5q -5q -5q 5q -5q -5q 5q -5q -5q 5q -5q -5q 5q -5q -5q) </p><p>                 (s -s -s s -s -s s -s -s s -s -s) </p><p>                 (3q -3q -3q 3q -3q -3q 3q -3q -3q)</p><p>                 (e -e -e e -e -e)</p><p>                 (q -q -q)))</p><p></p><p>(setf pitacc '(e4   ;(1 notes)</p><p>            e4 fs4  ;(2 notes)</p><p>            e4 fs4 g4  ;(3 notes)</p><p>            e4 fs4 g4 fs4  ;( 4 notes)</p><p>            e4 fs4 g4 fs4 g4  ;(5 notes)</p><p>            e4 fs4 g4 fs4 g4 a4  ;(6 notes)</p><p>            e4 fs4 g4 fs4 g4 a4 g4  ;(7 notes)</p><p>            e4 fs4 g4 fs4 g4 a4 g4 a4  ;(8 notes)</p><p>            e4 fs4 g4 fs4 g4 a4 g4 a4  ;(8 notes)</p><p>            e4 fs4 g4 fs4 g4 a4 g4  ;(7 notes)</p><p>            e4 fs4 g4 fs4 g4 a4  ;(6 notes)</p><p>            e4 fs4 g4 fs4 g4  ;(5 notes)</p><p>            e4 fs4 g4 fs4  ;( 4 notes)</p><p>            e4 fs4 g4  ;(3 notes)</p><p>            e4 fs4  ;(2 notes)</p><p>            e4  ;(1 notes)</p><p>                ))</p><p>(setf exo3acc (omn-to-time-signature (make-omn</p><p>             :length accent</p><p>             :pitch pitacc)</p><p>             '(3 4)))</p><p></p><p>same with def-score </p><p><img src="https://opusmodus.com/forums/uploads/monthly_2026_02/image.png.cc0ceb6b45e98a9229993aa26273bcbd.png" class="ipsRichText__align--block" width="1312" height="118" alt="image.png.cc0ceb6b45e98a9229993aa26273bcbd.png" data-fileid="4332" loading="lazy"></p><p></p><p></p><p>(def-score kona-score</p><p>  (:title "kona"</p><p>   :key-signature 'atonal</p><p>   :time-signature '(3 4)</p><p>   :tempo 50)</p><p>  (instrument</p><p>   :omn exo3acc</p><p>   :channel 1</p><p>   :sound 'gm</p><p>   :program 'acoustic-grand-piano))</p><p></p>]]></description><guid isPermaLink="false">4053</guid><pubDate>Mon, 09 Feb 2026 13:59:39 +0000</pubDate></item><item><title>harmonics</title><link>https://opusmodus.com/forums/topic/4055-harmonics/</link><description><![CDATA[<p>I am reading the documentation of "harmonics":<br>"The coeff keyword can be used to manipulate the pitches by adjusting the coefficients of the sine waves that correspond to each note. For example, by increasing the coefficient of the sine wave that corresponds to the fundamental frequency of a note, the pitch of that note can be raised. Similarly, by decreasing the coefficient of a higher harmonic, the pitch can be lowered. The use of coefficients in music theory is a mathematical approach to analysing and manipulating the frequency of a note."</p><p>I have following questions:</p><p>What is "the sine wave corresponding to each note"?</p><p>I cannot change the coefficient of higher harmonics since I have only one coefficient argument. What does that mean?</p><p>Where can I find the explanation of "coefficients used in music theory"?</p><p>Where can I find the "mathematical approach" explained?</p><p>Thanks for help.</p><p>Achim</p>]]></description><guid isPermaLink="false">4055</guid><pubDate>Thu, 12 Feb 2026 17:23:20 +0000</pubDate></item><item><title>Infinity series from binary numbers</title><link>https://opusmodus.com/forums/topic/4045-infinity-series-from-binary-numbers/</link><description><![CDATA[<p>You can create the infinity series from binary numbers. ones are added, zeros reverse sign.</p><p></p><p>Jesper</p><p></p><p><code>(defun inf-ser (n &amp;optional (offset 0) &amp;aux tmp)</code></p><p><code>  (loop for i to (1- n) do</code></p><p><code>          (setf tmp 0)</code></p><p><code>          (loop for bin in (decimal-to-binary i) </code></p><p><code>                do</code></p><p><code>                  (setf tmp (if (zerop bin) (- tmp) (+ tmp bin))))</code></p><p><code>        ;(format t "~B = ~D~%" i tmp)  </code></p><p><code>        collect (+ tmp offset)))</code></p><p></p><p><code>(integer-to-pitch (inf-ser 128))</code></p><p><code>(integer-to-pitch (inf-ser 128 12))</code></p><p> </p>]]></description><guid isPermaLink="false">4045</guid><pubDate>Sun, 25 Jan 2026 14:54:29 +0000</pubDate></item><item><title>Recursive Function for finding complementary set of notes in Chord/Scale relationship</title><link>https://opusmodus.com/forums/topic/2061-recursive-function-for-finding-complementary-set-of-notes-in-chordscale-relationship/</link><description><![CDATA[<p>
	Hey, people !
</p>

<p>
	 
</p>

<p>
	I´m doing a function to extract the complementary set of notes.
</p>

<p>
	For example:
</p>

<p>
	 
</p>

<p>
	1) Specify a set of notes, like a chord, Dm7
</p>

<p>
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">(setf note-list '(d5 f5 a5 c6))</span></pre>

<p>
	 
</p>

<p>
	Specify a tonality, like Cmajor or D dorian (same notes)
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">(expand-tonality '(c5 major))</span></pre>

<p>
	 
</p>

<p>
	Now, I want a function that gives me all the other available notes from the mode, except the chord tones (the first set of notes).
</p>

<p>
	 
</p>

<p>
	So, this function gives me exactly what I need (for ONE tonality at a time and ONE chord at a time):
</p>

<p>
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">(let ((rem (expand-tonality '(c5 major)))
      (super (ambitus '(c5 b5) note-list)))
  (loop for i in super
    do (setf rem (remove i rem))
    finally (return rem)))</span></pre>

<p>
	 
</p>

<p>
	Ok, this give me the right result, I.E., the complementary set of notes of C major in relation to Dm7
</p>

<p>
	=&gt; (e5 g5 b5)
</p>

<p>
	 
</p>

<p>
	<strong>The question is simple:</strong>
</p>

<p>
	 
</p>

<p>
	<strong>How can I do it for a list with many tonalities and many chords. How to do this recursively in nested lists, like</strong>
</p>

<p>
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">(setf note-list '((d5 f5 a5 c6)(eb4 gb4 bb4 db4)(fs4 as4 cs4)))</span></pre>

<p>
	 
</p>

<p>
	to sucessive tonalities, like:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">(expand-tonality '((c5 major) (db4 major) (gb4 major)))</span></pre>

<p>
	 
</p>

<p>
	Since this WON´T work
</p>

<p>
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted"><span class="pln">(let ((rem (ambitus '(c5 b5) (expand-tonality '((c5 major) (db5 major) (gb5 major)))))
      (super (ambitus '(c5 b5) '((d5 f5 a5 c6)(eb4 gb4 bb4 db4)(fs4 as4 cs4)))))
  (loop for i in super
    do (setf rem (remove i rem))
    finally (return rem)))</span></pre>

<p>
	 
</p>

<p>
	The expected result, if the above worked would be:
</p>

<p>
	 
</p>

<p>
	 ((e5 g5 b5)  (f5 ab5 c5) (gs4 cb5 ds5))
</p>

<p>
	 
</p>

<p>
	Thanks in advance !!
</p>

<p>
	 
</p>

<p>
	Best !
</p>

<p>
	Julio
</p>
]]></description><guid isPermaLink="false">2061</guid><pubDate>Sat, 19 Jun 2021 23:52:27 +0000</pubDate></item><item><title>Idea for a function  "motive-subdivision" or "motif-subdivision"</title><link>https://opusmodus.com/forums/topic/4040-idea-for-a-function-motive-subdivision-or-motif-subdivision/</link><description><![CDATA[<p>Dear All,</p><p></p><p>Here is a proto-function idea... If Janusz or someone are interested in transform it in a core function, I think it could be interesting...</p><p></p><p>Sometimes I like to take a motive or chorale texture and use it to make a kind of accompaniment or texture ala Reich.</p><p>I created my way to do it, but it could be perfected in a better function and integrated in the core system.</p><p></p><p>Here is the idea:</p><p></p><p><code>;; Motive</code></p><p><code>(setf mat '(h c4 q. d4 e e4 -q w c4 h d4 q e4 -q))</code></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4313" src="https://opusmodus.com/forums/uploads/monthly_2026_01/image.png.53aa06bae1d1f2842317e1cc96d47e63.png" alt="image.png" title="image.png" width="447" height="88" loading="lazy"></p><p></p><p>;; small value</p><p></p><p><code>(setf fig-value '(e))</code></p><p></p><p>The "proto-function". What I could not achieve was how to make it respect the rests in the motive, but it works for generating the texture, respecting the pitch and length boundaries of the motive.</p><p></p><p><code>(flatten (make-omn</code></p><p><code>:pitch (omn :pitch (omn-to-time-signature mat (get-time-signature (omn-to-measure (length-legato mat) (flatten (length-legato (omn :length mat)))))))</code></p><p><code>:length (omn-to-time-signature</code></p><p><code>(length-span (get-span mat)</code></p><p><code>(gen-repeat 200 fig-value))</code></p><p><code>(get-time-signature (omn-to-measure (length-legato mat) (flatten (length-legato (omn :length mat))))))</code></p><p><code>))</code></p><p></p><p>RESULT</p><p></p><p><code>(e c4 mf c4 c4 c4 e d4 mf d4 d4 e e4 mf e4 e4 e c4 mf c4 c4 c4 c4 c4 c4 c4 e d4 mf d4 d4 d4 e e4 mf e4 e4 e4)</code></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4314" src="https://opusmodus.com/forums/uploads/monthly_2026_01/image.png.dd663a12f74a7b10af99e8322621f636.png" alt="image.png" title="image.png" width="653" height="120" loading="lazy"></p><p></p><p>It could be perfected to result this:</p><p></p><p>(e c4 mf c4 c4 c4 d4 d4 d4 e4 -q e c4 c4 c4 c4 c4 c4 e c4 c4 d4 mf d4 d4 d4 e4 e4 -q)</p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4315" src="https://opusmodus.com/forums/uploads/monthly_2026_01/image.png.63d7de88b1c662275669b6cf62f1a15f.png" alt="image.png" title="image.png" width="659" height="105" loading="lazy"></p><p></p><p>Same texture with the fig-value set do 16th note</p><p></p><p><code>(setf fig-value '(s))</code></p><p></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4316" src="https://opusmodus.com/forums/uploads/monthly_2026_01/image.png.b593f45461b46e9e038416235f5c34a2.png" alt="image.png" title="image.png" width="1073" height="110" loading="lazy"></p><p></p><p>Best wishes,</p><p>Julio</p>]]></description><guid isPermaLink="false">4040</guid><pubDate>Wed, 14 Jan 2026 15:15:20 +0000</pubDate></item><item><title>Missing Documentation</title><link>https://opusmodus.com/forums/topic/4032-missing-documentation/</link><description><![CDATA[<p>Hello,</p><p></p><p>I found a function that is missing documentation: <strong>2d-matrix-&gt;linearized-upper-trangular</strong>.  Would you mind explaining this briefly?  I hope to see the documentation added to the next update. </p><p>Thanks!</p>]]></description><guid isPermaLink="false">4032</guid><pubDate>Mon, 05 Jan 2026 20:38:25 +0000</pubDate></item><item><title><![CDATA[Jazz Shell Voicings Type A & B in OM]]></title><link>https://opusmodus.com/forums/topic/4031-jazz-shell-voicings-type-a-b-in-om/</link><description><![CDATA[<p>As hobbyist I am trying to learn how Jazz works and then explore what I have learned using OM for composition.</p><p>For the composers and musicians among you following might seem trivial, so this post is probably only relevant for beginners like me (except for the question at the end of the post)</p><p>But for me it's all new and exploring and discovering new concepts is fascinating.</p><p>OM helps me a lot as learning tool to conceptualize and reuse in a principled, reproducible manner.</p><p></p><p>In Jazz for piano comping, the use of rootless shell-voicings is common as far as I have learned.</p><p></p><p>I have learned in a text book (Jeremy Siskind, Jazz Band Pianist), that typically for chord comping</p><ul><li><p>the bass pitch is removed as it's already covered by the bass player, see a question on that to community at the end of this post.</p></li></ul><ul><li><p>the left hand plays the "essential tones" of the chord, which are 3rd and 7th</p></li><li><p>the right hand plays the "color tones" of the chord, which are the 5th and 9th.</p></li></ul><p></p><p>I have learned that there 2 types of voicings</p><ul><li><p>Type A: left-hand: 3rd below 7th; right-hand: 9th below 5th</p></li><li><p>Type B is flipped version, so left-hand: 7th below 3rd; right-hand: 5th below 9th.</p></li></ul><p></p><p>Here's a screenshot of the book were both voicings are demonstrated for 3 chords.</p><p>Now I have tried to reproduce this with OM and want to share my findings in this post.</p><p></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4293" src="https://opusmodus.com/forums/uploads/monthly_2026_01/JazzBandPianist-BasicSkillsfortheJazzBandPianist.jpeg.d737eb2b198090d40a4bf7f3cbfabf03.jpeg" alt="Jazz Band Pianist - Basic Skills for the Jazz Band Pianist.jpeg" title="Jazz Band Pianist - Basic Skills for the Jazz Band Pianist.jpeg" width="1832" height="1370" loading="lazy"></p><p></p><p>Turns out, that</p><ul><li><p>Type A: is accomplished with <code>drop-voicing :type '(2) :leading '(l)</code></p></li><li><p>Type B: is accomplished with <code>drop-voicing :type '(2) :leading '(h)</code></p></li><li><p>and in both cases then splitting the chord to both hands with <code>(split-chord 13 &lt;&gt; :lower-size 2 :upper-size 2)</code></p></li></ul><p></p><p>Here's the code to reproduce the text book example:</p><pre spellcheck="" class="ipsCode language-ini" data-language="ini"><code>(asdf:load-system :arrows)


(setf chord '((w (e3 m9))   ; e3g3b3d4fs4
              (w (d3 9))    ; d3fs3a3c4e4
              (w (bb2 maj9)); bb2d3f3a3c4
              ))

; Type A voicing
(setf chord-voiced-a
      (arrows:-&lt;&gt;
       ; remove bass from 5 note chord
       (loop for n in (reverse '(1 2 3 4))
        collect (pitch-demix n chord))
       (matrix-transpose)
       (mapcar 'pitch-mix &lt;&gt;)
       ; restore original length
       (omn-replace :length (omn :length chord) &lt;&gt;)
       ; voice-leading type a
       (drop-voicing :type '(2) :leading '(l))
       ; distribute to both hands
       (split-chord 13 &lt;&gt; :lower-size 2 :upper-size 2)
       ))


; Type B voicing
(setf chord-voiced-b
      (arrows:-&lt;&gt;
       ; remove bass from 5 note chord
       (loop for n in (reverse '(1 2 3 4))
        collect (pitch-demix n chord))
       (matrix-transpose)
       (mapcar 'pitch-mix &lt;&gt;)
       ; restore original length
       (omn-replace :length (omn :length chord) &lt;&gt;)
       ; voice-leading type a
       (drop-voicing :type '(2) :leading '(h))
       ; distribute to both hands
       (split-chord 13 &lt;&gt; :lower-size 2 :upper-size 2)
       ))

(setf rh-a (assemble-voices 1 chord-voiced-a))
(setf lh-a (assemble-voices 2 chord-voiced-a))
(setf rh-b (assemble-voices 1 chord-voiced-b))
(setf lh-b (assemble-voices 2 chord-voiced-b))

(ps 'gm 
    :title "Type A"
    :p (list rh-a lh-a))

(ps 'gm 
    :title "Type B"
    :p (list rh-b lh-b))

</code></pre><p></p><p>Result:</p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4294" src="https://opusmodus.com/forums/uploads/monthly_2026_01/Bildschirmfoto2026-01-04um11_01_21.png.cbafa0b2782615645036cd6c9d8b3914.png" alt="Bildschirmfoto 2026-01-04 um 11.01.21.png" title="Bildschirmfoto 2026-01-04 um 11.01.21.png" width="560" height="344" loading="lazy"></p><p><img class="ipsImage ipsRichText__align--block" data-fileid="4295" src="https://opusmodus.com/forums/uploads/monthly_2026_01/Bildschirmfoto2026-01-04um11_02_08.png.33e8e6432376c98c93da28609a69655b.png" alt="Bildschirmfoto 2026-01-04 um 11.02.08.png" title="Bildschirmfoto 2026-01-04 um 11.02.08.png" width="550" height="352" loading="lazy"></p><p></p><p><strong>Question to community:</strong></p><p>Are there smarter ways to remove the root pitch in a omn-notation chord-sequence like the one I defined in variable <code>chord</code> (which just drops the lowest pitch while retaining the other omn parameters like length from original) ?</p><p></p><p>Thanks for any hints.</p><p></p><p></p>]]></description><guid isPermaLink="false">4031</guid><pubDate>Sun, 04 Jan 2026 10:08:48 +0000</pubDate></item></channel></rss>
