Everything posted by JulioHerrlein
-
Melodic Countour Function
Much better version. Really cool !! (defun contour-mel (sequencias contornos) "Função de contorno melódico com controle de densidade e direção inter-bar." (let* (;; 1. Desmonta a sequência para isolar os parâmetros [4, 5] (dis (disassemble-omn sequencias)) (pitches (getf dis :pitch)) (lengths (getf dis :length)) (velocities (getf dis :velocity)) (num-bars (length contornos)) ;; Alinha sequências, ritmos e dinâmicas ao número de contornos [6-8] (p-list (gen-trim num-bars pitches)) (l-list (gen-trim num-bars lengths)) (v-list (gen-trim num-bars (if velocities velocities '(mf)))) ;; Variáveis de estado para a Regra de Direção (prev-last-pitch nil) (prev-last-contour-val nil) (final-pitches nil) (final-lengths nil) (final-velocities nil)) (loop for bar-p in p-list for bar-l in l-list for bar-v in v-list for bar-c in contornos do (let* ((num-notes (length bar-c)) ;; Funcionalidade 1: Estabelece quantas notas serão processadas ;; Repete a sequência do começo ao fim se o contorno for maior [7, 9] (ext-p (gen-trim num-notes bar-p)) (ext-l (gen-trim num-notes bar-l)) (ext-v (gen-trim num-notes bar-v)) ;; Processamento por Inteiros (c4 = 0) [1, 3, 10] (ints (pitch-to-integer ext-p)) (pcs (mapcar (lambda (x) (mod x 12)) ints)) ;; Reconstrução do Contorno Interno (Ranking) [1, 4] (pos-rank-pairs (loop for pc in pcs for rank in bar-c for pos from 0 collect (list :pc pc :rank rank :pos pos))) (sorted-by-rank (sort (copy-list pos-rank-pairs) #'< :key (lambda (x) (getf x :rank)))) (temp-bar-results (make-array num-notes)) (last-val -9999)) ;; Atribui oitavas para satisfazer o contorno interno (dolist (item sorted-by-rank) (let* ((pc (getf item :pc)) (pos (getf item :pos)) (oct 0) (val (+ (* oct 12) pc))) (while (<= val last-val) do (incf oct) (setf val (+ (* oct 12) pc))) (setf (aref temp-bar-results pos) val) (setf last-val val))) ;; Funcionalidade 2: Regra de Direção (Concatenação) (let* ((final-ints (coerce temp-bar-results 'list)) (current-first-val (car bar-c)) (shift 0)) (when (and prev-last-pitch prev-last-contour-val) (let* ((target-first (car final-ints)) ;; Calcula direção baseada no valor numérico do contorno (direction (cond ((> current-first-val prev-last-contour-val) 'up) ((< current-first-val prev-last-contour-val) 'down) (t 'same)))) ;; Ajusta o bloco inteiro para satisfazer a direção em relação ao compasso anterior (case direction (up (while (<= (+ target-first shift) prev-last-pitch) do (incf shift 12))) (down (while (>= (+ target-first shift) prev-last-pitch) do (decf shift 12)))))) ;; Aplica a transposição de registro (oitava) necessária (setf final-ints (mapcar (lambda (x) (+ x shift)) final-ints)) ;; Atualiza estado para o próximo compasso (setf prev-last-pitch (car (last final-ints))) (setf prev-last-contour-val (car (last bar-c))) ;; Coleta resultados processados (push (integer-to-pitch final-ints) final-pitches) (push ext-l final-lengths) (push ext-v final-velocities)))) ;; 4. Remontagem OMN Final [4, 5, 11] (make-omn :pitch (nreverse final-pitches) :length (nreverse final-lengths) :velocity (nreverse final-velocities) :articulation (getf dis :articulation)))) EXPLANATION Explanation of New Features: Density and Repetition Control (Rule 1): The gen-trim function is used to force the note sublist to match the size of the contour sublist. If the original sequence is (c4 e4 g4) (3 notes) and the contour is (1 2 3 4 5) (5 numbers), the system expands the sequence to (c4 e4 g4 c4 e4) before applying octave ranking. Concatenation Direction (Rule 2): The algorithm stores the last contour value and the last pitch (as an integer) from the previous measure. When starting a new measure, it compares the first number of the new contour with the previous one. If it is higher, it applies an octave shift to all notes in the current measure until the first note is higher than the last note of the previous measure, thereby preserving the internal contour while ensuring the required directional flow. Octave Adjustment and Spelling: The process adheres to the convention where c4 = 0. The integer-to-pitch lookup ensures notes remain within a usable register, avoiding "zero-octave" errors when applying the system's implicit base offset of 4. Rhythmic and Dynamic Integrity: Using disassemble-omn, rhythms (durations) and dynamics (velocities) are extracted and expanded via gen-trim to match each new note generated by the contour, ensuring the final result is a perfectly valid OMN expression ready for notation or playback.
-
Melodic Countour Function
Dear All, 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. Best, Julio EXAMPLE (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) ORIGINAL (contour-mel-poly (gen-divide 4 (flatten sequencia)) '(0.5 0.49 2)) ;; can be any number (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) #'< :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 > Rank N-1 (satisfaz posição aberta/fechada) (while (<= 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))))))
-
Poly-Demix
Thank you very much !
-
Poly-Demix
Dear Vani, I recommend this book: Brazilian Guitar Book, by Nelson Faria. You´ll learn a lot about brazilian rhythms and different styles of samba. https://www.amazon.com.br/Brazilian-Guitar-Book-Nelson-Faria/dp/1883217024 Also This one: https://www.amazon.com.br/Ritmos-Brasileiros-Pereira-Marco/dp/8561011009 Best, Julio https://youtu.be/Ni8aFZgCgY0
- Strange Tuplet Behaviour (fixed)
- Strange Tuplet Behaviour (fixed)
- Strange Tuplet Behaviour (fixed)
-
Strange Tuplet Behaviour (fixed)
Hi, all THis snippet apears as sextuplets in the notation viewer but opens as triplets in Musescore, after open in external editor ((6q gs3 cs4 eb4 b3 cs4 gs3 cs4 b3 gs4 e4 b3 cs4) (6q f3 bb3 cs4 g3 bb3 f3 bb3 gs3 f4 b3 bb3 f3) (6q eb4 e3 bb3 eb4 fs4 b3 f4 fs3 g3 f4 gs4 e4)) something strange... Im in the version 4.0.31480
-
OM-Version-Update Changelogs
Pitch-demix works with many voices at the same time now ! Thanks, Janusz
-
pitch-demix function
Dear Cliff, I did this one. Check it and see if it´s good for you. Best, Julio
-
A useful function : Export-to-Dorico
Interesting, Stephane. In Musescore 4, in order to work, you must choose the "outdated" format. It brings all. The other brings an error Undefined function om-capi::assistant-view-quickview-pane called with arguments (#<om-capi::assistant-view "Assistant: gen-rotate.pdf" 4150774DE3>).
-
How to Change some shortcut ?
Hello, I´d like to create an easier shortcut for midi input, with less keytrokes, because for typing "ctr+shift + m" I need my 2 hands. If I could make an easier shortcut, like shift + m, I could be with one hand at the midi keyboard and other at the computer keyboard. Please, any help ? Best, Julio
-
Diatonic Transposition or "Set Transposition" Function
Thank you !! Below is a much better version. In the new version, the function rounds the notes selectively, according to the spelling and there is no need to rewrite-acidentals. If the referential collection have more sharps the function rounds up and vice-versa for the flats. Also, it preserve the spelling of the referential collections (i.e. tonalities). Best ! Julio (defun set-transpose (n omn-sequence sets &key (round 'up)) "Transposição diatônica paramétrica com arredondamento seletivo: 'up' para sets com mais sustenidos e 'down' para sets com mais bemóis." (let* ((dis (disassemble-omn omn-sequence)) (pitches (getf dis :pitch)) (num-bars (length pitches)) (n-list (gen-trim num-bars (if (listp n) n (list n)))) (set-list (gen-trim num-bars sets))) (labels ((process-pitch (p val-n collection local-round) (let* ((p-int (pitch-to-integer p)) (coll-ints (pitch-to-integer (flatten collection))) (coll-pcs (sort (remove-duplicates (mapcar (lambda (x) (mod x 12)) coll-ints)) #'<)) (len-coll (length coll-pcs))) (flet ((transpose-single (single-p) (let* ((pc (mod single-p 12)) (oct (floor single-p 12)) ;; 1. Arredondamento seletivo detectado para este bar (r-info (get-rounded-info pc coll-pcs local-round)) (rounded-pc (car r-info)) (r-oct-shift (cdr r-info)) ;; 2. Transposição diatônica por índices (curr-idx (position rounded-pc coll-pcs)) (new-idx (+ curr-idx val-n)) ;; 3. Ajuste de oitava final (modular) (final-oct-shift (+ r-oct-shift (floor new-idx len-coll))) (final-pc (nth (mod new-idx len-coll) coll-pcs))) (+ (* (+ oct final-oct-shift) 12) final-pc)))) (if (listp p-int) (mapcar #'transpose-single p-int) (transpose-single p-int))))) (get-rounded-info (pc coll direction) (if (member pc coll) (cons pc 0) (case direction (up (let ((higher (find pc coll :test #'<))) (if higher (cons higher 0) (cons (first coll) 1)))) (down (let ((lower (find pc coll :from-end t :test #'>))) (if lower (cons lower 0) (cons (car (last coll)) -1))))))) (spell-note (int-val bar-set) "Reconstrói o símbolo OMN com oitava correta (c4=0) e spelling do set." (let* ((pc (mod int-val 12)) (oct-suffix (+ 4 (floor int-val 12))) (ref-note (find pc (flatten (pitch-to-integer bar-set)) :test (lambda (x y) (= x (mod y 12)))))) (if ref-note (let* ((all-notes (flatten bar-set)) (orig-sym (nth (position ref-note (pitch-to-integer all-notes)) all-notes)) (pure-name (string-right-trim "0123456789" (symbol-name orig-sym)))) (intern (format nil "~a~d" pure-name oct-suffix))) (car (integer-to-pitch (list int-val))))))) ;; --- PROCESSAMENTO BAR-A-BAR COM ARREDONDAMENTO SELETIVO --- (let ((final-pitches (mapcar (lambda (bar bar-n bar-set) (let* ((set-syms (flatten (list! bar-set))) ;; A. Conta sustenidos (s) e bemóis (b) no set (sharps (count-if (lambda (s) (search "s" (symbol-name s) :test #'char-equal)) set-syms)) (flats (count-if (lambda (s) (search "b" (symbol-name s) :test #'char-equal)) set-syms)) ;; B. Define a direção de arredondamento local (local-round (cond ((> sharps flats) 'up) ((> flats sharps) 'down) (t round))) ;; Mantém o default se empatar ;; C. Processa as notas com o arredondamento calculado (trans-ints (mapcar (lambda (p) (process-pitch p bar-n bar-set local-round)) bar))) (mapcar (lambda (item) (if (listp item) (intern (format nil "~{~a~}" (mapcar (lambda (sub) (spell-note sub bar-set)) item))) (spell-note item bar-set))) trans-ints))) pitches n-list set-list))) (make-omn :pitch final-pitches :length (getf dis :length) :velocity (getf dis :velocity) :articulation (getf dis :articulation)))))) EXAMPLE (setf temav1 (gen-repeat 3 '((e. c4 mf s d4 -e e4 e. f4 s g4 - a4) (q b4 mf -e c4 e. d4 s e4 - f4) (q g4 mf -e a4 e. b4 s c4 - d4)))) (setf sets (expand-tonality '((e4 major) (ab4 major) (c4 major) (c4 diminished1)))) (set-transpose 0 temav1 sets) ((e. cs4 mf s ds4 -e e4 e. fs4 s gs4 - a4) (q bb4 mf -e c4 e. db4 s eb4 - f4) (q g4 mf -e a4 e. b4 s c4 - d4) (e. c4 mf s ds4 -e e4 e. fs4 s g4 - a4) (q b4 mf -e cs4 e. ds4 s e4 - fs4) (q g4 mf -e ab4 e. bb4 s c4 - db4) (e. c4 mf s d4 -e e4 e. f4 s g4 - a4) (q c5 mf -e c4 e. ds4 s e4 - fs4) (q gs4 mf -e a4 e. b4 s cs4 - ds4)) (set-transpose -3 temav1 sets) ((e. gs3 mf s a3 -e b3 e. cs4 s ds4 - e4) (q f4 mf -e g3 e. ab3 s bb3 - c4) (q d4 mf -e e4 e. f4 s g3 - a3) (e. g3 mf s as3 -e c4 e. cs4 s ds4 - e4) (q fs4 mf -e gs3 e. a3 s b3 - cs4) (q db4 mf -e eb4 e. f4 s g3 - ab3) (e. g3 mf s a3 -e b3 e. c4 s d4 - e4) (q g4 mf -e g3 e. as3 s c4 - cs4) (q ds4 mf -e e4 e. fs4 s gs3 - a3))
-
Diatonic Transposition or "Set Transposition" Function
Dear All, Here are a version for a diatonic (or all purpose set-transpose) function that rounds material around a collection used as reference). Please, Let me know if you find bugs. Best, Julio (defun set-transpose (n omn-sequence sets &key (round 'up)) "Realiza transposição diatônica por N passos em coleções de referência. Arredonda notas fora do set para cima ou para baixo conforme :round." (let* ((dis (disassemble-omn omn-sequence)) (pitches (getf dis :pitch)) (num-bars (length pitches)) ;; Alinha N e os Sets ao número de sublistas (compassos) (n-list (gen-trim num-bars (if (listp n) n (list n)))) (set-list (gen-trim num-bars sets))) (labels ((process-pitch (p val-n collection) (let* ((p-int (pitch-to-integer p)) ;; Normaliza a coleção para pitch-classes (0-11) ordenadas (coll-pcs (sort (remove-duplicates (mapcar (lambda (x) (mod x 12)) (flatten (pitch-to-integer collection)))) #'<)) (len-coll (length coll-pcs))) (flet ((transpose-single (single-p) (let* ((pc (mod single-p 12)) (oct (floor single-p 12)) ;; 1. Arredondamento com info de oitava (r-info (get-rounded-info pc coll-pcs round)) (rounded-pc (car r-info)) (r-oct-shift (cdr r-info)) ;; 2. Localiza índice e aplica N passos diatônicos (curr-idx (position rounded-pc coll-pcs)) (new-idx (+ curr-idx val-n)) ;; 3. Calcula deslocamento de oitava final (wrap-around) (final-oct-shift (+ r-oct-shift (floor new-idx len-coll))) (final-pc (nth (mod new-idx len-coll) coll-pcs))) ;; 4. Reconstrói o pitch mantendo o registro original (+ (* (+ oct final-oct-shift) 12) final-pc)))) ;; Suporte para notas individuais ou acordes (if (listp p-int) (mapcar #'transpose-single p-int) (transpose-single p-int))))) (get-rounded-info (pc coll direction) ;; Retorna (rounded-pc . octave-shift) (if (member pc coll) (cons pc 0) (case direction (up (let ((higher (find pc coll :test #'<))) (if higher (cons higher 0) (cons (first coll) 1)))) ;; Wrap up: vai p/ próx oitava (down (let ((lower (find pc coll :from-end t :test #'>))) (if lower (cons lower 0) (cons (car (last coll)) -1)))))))) ;; Wrap down: oitava anterior ;; Mapeamento bar-a-bar (let ((new-pitches (mapcar (lambda (bar bar-n bar-set) (mapcar (lambda (p) (process-pitch p bar-n bar-set)) bar)) pitches n-list set-list))) ;; Remontagem OMN final preservando os outros parâmetros (make-omn :pitch (integer-to-pitch new-pitches) :length (getf dis :length) :velocity (getf dis :velocity) :articulation (getf dis :articulation)))))) EXAMPLE (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))) (setf sets (expand-tonality '((ab4 major) (c4 major)))) (set-transpose -4 temav1 sets :round 'down) ((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)) (set-transpose -4 temav1 sets :round 'up) ((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)) (setf sets (expand-tonality '((ab4 messiaen-mode2) (c4 major)))) (set-transpose -4 temav1 sets :round 'up)
-
Poly-Demix
Dear All, An useful function do make various pitch-demix operations at once. (defun poly-demix (n-list mat-omn) "Extrai as vozes especificadas em N-LIST de uma sequência OMN e as combina em um único fluxo polifônico." (let* (;; 1. Garante que n-list seja uma lista e extrai cada voz (extracted-voices (mapcar #'(lambda (n) (pitch-demix n mat-omn)) (list! n-list)))) ;; 2. Aplica merge-voices sobre a lista de vozes extraídas (apply #'merge-voices extracted-voices))) (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))) (poly-demix '(1 2 5) mat-omn) ((e. g2f4a4 s -e c5 e. g2d4f4 s g4 - g2f4a4) (q bb2ab4c5 -e bb4 e. eb5 s ab4 - bb2c5eb5)) Best, Julio
-
Windows Users - Who is using CLM with audio functions ?
Dear Opusmodus Windows Users I can´t use here the CLM functions (with audio instrumentos and functions). Are you having trouble with this in Windows 11 ? I can run sound samples like in the post below, buto no success with CLM. Any help or comments ? Thanks !
-
Loop Midi BUG due to Windows Update
Dear Windows Users, After the Windows 11 26200.7840 Security Update (February 11th 2026), the virtual ports are not showing in windows, only the hardware ones. At first I though it was related to Opusmodus update, but it´s a windows update BUG. Here is the solution. Close all MIDI apps Open Windows Terminal as an Administrator (“run as administrator”) Type "net stop midisrv" After that completes, type "net start midisrv" Start up the app you want to use with MIDI Here is a video: Best, Julio
-
All previous rewrite functions used together
Thanks, Jesper I did not remember that one. Mine have the advantage of having the embedded span, so we can have a more elegant code. Best, Julio
-
All previous rewrite functions used together
Ciao, Opusmoders All previous rewrite functions used in conjunction for transformations. Ciao ! https://opusmodus.com/forums/topic/4097-rewrite-len-function/#comment-14209 (setf expressao-omn '((s eb4 d4 e a4 -s s eb4) (h eb4 a4 -s eb4 d4 -s) (e. d4 a4 eb4 d4) (-q e f4 s c5 qs fs4))) (rewrite-pit (rewrite-dyn (rewrite-len expressao-omn '(h -e s q -h q -q s s s)) '(pp< ff mf fff p < < fff ppp fff mf fff p)) '(c4 g5)) https://opusmodus.com/forums/topic/4097-rewrite-len-function/#comment-14209
-
rewrite-len function
Last one... Time to go to bed in Brasil Function to rewrite lengths BEst, Julio (defun rewrite-len (expressao-omn new-lengths-list) "Substitui os comprimentos (lengths) de uma expressão OMN por uma lista fornecida, repetindo-a ciclicamente e mantendo a estrutura de sublistas original." (let* ((dis (disassemble-omn expressao-omn)) ;; Desmonta a expressão original [2] (old-pit (getf dis :pitch)) ;; Extrai as alturas [4] (old-vel (getf dis :velocity)) ;; Extrai as velocidades [4] (old-art (getf dis :articulation)) ;; Extrai as articulações [4] ;; 1. Mapeia a estrutura original (quantidade de eventos por sublista) ;; Captura o número de elementos rítmicos em cada compasso [3, 5] (structure (mapcar #'length (getf dis :length))) (total-events (apply #'+ structure)) ;; Soma total de eventos [6] ;; 2. Gera a sequência rítmica cíclica com base no total de eventos ;; gen-trim estende a lista do usuário para preencher todos os espaços [3, 7] (new-flat-lengths (gen-trim total-events new-lengths-list)) ;; 3. Re-organiza os novos ritmos na estrutura de sublistas original [3, 8] (new-structured-lengths (gen-divide structure new-flat-lengths))) ;; 4. Remonta o objeto OMN completo com os parâmetros preservados [3, 4] (make-omn :pitch old-pit :length new-structured-lengths :velocity old-vel :articulation old-art))) ;;USE (setf expressao-omn '((s eb4 d4 e a4 -s s eb4) (h eb4 a4 -s eb4 d4 -s) (e. d4 a4 eb4 d4) (-q e f4 s c5 qs fs4))) (omn-to-time-signature (rewrite-len expressao-omn '(h -e s q -h q -q s s s)) '(3 4)) ;;RESULT ((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))
-
rewrite-pit function
Hey, Opusmoders Here is one more function in the style of the previous one (rewrite-dyn). This time to rewrite pitches. (defun rewrite-pit (expressao-omn pitch-list) "Substitui as alturas de uma expressão OMN por uma lista customizada, fazendo a repetição cíclica se a lista for menor que o número de notas." (let* ((dis (disassemble-omn expressao-omn)) ;; Desmonta a expressão [3, 6] (pitches (getf dis :pitch)) ;; Extrai alturas atuais (lengths (getf dis :length)) ;; Extrai durações (inclui rests) [7] (velocities (getf dis :velocity)) ;; Extrai dinâmicas [8] (articulations (getf dis :articulation)) ;; Extrai articulações/ties [9, 10] ;; 1. Mapeia a quantidade de notas em cada sublista/compasso (counts (mapcar #'length pitches)) ;; [2, 5] ;; 2. Calcula o total de eventos de nota para o preenchimento (total-notes (apply #'+ (flatten counts))) ;; [2, 11] ;; 3. Gera a lista de novas alturas repetindo o padrão do usuário (flat-pitches (gen-trim total-notes pitch-list)) ;; [2, 4] ;; 4. Redistribui as alturas na estrutura de sublistas original (structured-pitches (gen-divide counts flat-pitches))) ;; [2, 5] ;; 5. Remonta o objeto OMN completo preservando os demais parâmetros (make-omn :pitch structured-pitches :length lengths :velocity velocities :articulation articulations))) ;; [2, 3] ;;USE (setf expressao-omn '((s eb4 d4 e a4 -s s eb4 tie) (h eb4 a4 -s eb4 d4 -s tie) (e. d4 a4 eb4 d4) (-q e f4 s c5 qs fs4))) Using both rewrite-dyn and rewrite-pit (rewrite-pit expressao-omn '(c4 e4 d4 c4 c4)) (rewrite-dyn (rewrite-pit expressao-omn '(c4 e4 d4 c4 c4)) '(ff > p p< ff> pp ff p p< ff p mf ppp p < ff)) Best !! Julio Herrlein
-
rewrite-dyn function
Hello, Opusmoders This is a very cool and easy to use function to rewrite dynamics. Check it out. Hope you like it ! Best, Julio (defun rewrite-dyn (expressao-omn dynamic-list) "Substitui as dinâmicas de uma expressão OMN por uma lista customizada, fazendo a rotação cíclica se a lista for menor que o número de notas." (let* ((dis (disassemble-omn expressao-omn)) ; [2, 3] (pitches (getf dis :pitch)) (lengths (getf dis :length)) (articulations (getf dis :articulation)) ;; 1. Mapeia a estrutura de cada sublista (quantidade de notas por compasso) (counts (mapcar #'length pitches)) ; [6] ;; 2. Calcula o total de notas para gerar dinâmicas suficientes (total-notes (apply #'+ (flatten counts))) ; [7] ;; 3. Cria a lista plana de dinâmicas repetindo o padrão do usuário [4] (flat-vels (gen-trim total-notes dynamic-list)) ;; 4. Redistribui as dinâmicas na estrutura de sublistas original [5] (structured-vels (gen-divide counts flat-vels))) ;; 5. Remonta o objeto OMN completo com os novos parâmetros [3] (make-omn :pitch pitches :length lengths :velocity structured-vels :articulation articulations))) ;; USE ;; Exemplo 1: Dinâmicas simples (setf expressao-omn '((s eb4 d4 e a4 -s s eb4 tie) (h eb4 a4 -s eb4 d4 -s tie) (e. d4 a4 eb4 d4) (-q e f4 s c5 qs fs4))) (rewrite-dyn expressao-omn '(p mf ff)) ;; >> ((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)) ;; Exemplo 2: Incluindo crescendos (rewrite-dyn expressao-omn '(ff > p p< ff> pp ff p p< ff p mf ppp p < ff)) ;; ((s eb4 ff d4 > e a4 p -s eb4 p< tie) (h eb4 ff> a4 pp -s eb4 ff d4 p - d4 p< tie) (e. d4 ff a4 p eb4 mf d4 ppp) (-q e f4 p s c5 < qs fs4 ff))
-
shift-rhythm Function
Hello, Opusmoders Sometime ago I was here searching for a function to displace rhtyhms by a length amount, not just like a list rotation. 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). Hope it can be useful to you too. All the best, Julio (defun shift-rhythm (rhythm shift-length &key span) ;"Moves rhythmic material by inserting a pause at the beginning. ;Use length-adjust to ensure the result fits within the span." (let* ((rhy (flatten rhythm)) ;;;; Ensures a linear list for processing ;; Adds the offset value as a negative pause at the beginning [5] (with-offset (append (list (- (abs shift-length))) rhy)) ;;Define the target span: either the requested one or the original rhythm. (target-span (or span (get-span rhythm)))) ;; The length-adjust function adjusts the total to the desired span [1]. ;; With :position 'e (default), it removes or adds from the end of the list [6]. (length-adjust target-span with-offset :omn t :type 'r))) ;;; USE ;Exemplo 1: Span de 4/4 (1/1) (setf ideia '(e c5 e d4 q f4 -h)) ;; Span original de 1/1 (shift-rhythm ideia 1/8 :span 3/4) ;; (-e e c5 d4 q f4 -e) (shift-rhythm ideia 3/8 :span 5/4) ;; (-q. e c5 d4 q f4 -q.) also with negative displacement (setf ideia '(-h e c5 e d4 q f4 -h)) (shift-rhythm ideia -1/8 :span 7/4) ;;(-e -h e c5 d4 q f4 -h -e) It could be perfected to deal with nested sublists and with different displacements for each sublist, like (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)) (shift-rhythm ideia '((-1/8) (2/16) (3/8)) :span 7/4) etc
-
New CLM Implementation For Opusmodus Version 4.0.30978
Sorry to be insistent on the topic, I just want to help people that use windows machines.
-
New CLM Implementation For Opusmodus Version 4.0.30978
I did all this and get this on the listener I tried in the first time just deleting the filies you mentioned and got the same error the second time I deleted the content of bin and libclm folders the opusmodus installer built/compiled the files again before restarting. I got this in the listener: OM 1 > ; Loading text file E:\Opusmodus\clm\CLM Startup Instruments.lisp load-clm-ins, instruments: ("add-noise-filtered" "add" "addflt" "addsnd" "anoi" "arith" "arith1" "arith2" "autoc" "backandforth" "badd" "bandedwg" "bell" "bigbird" "bird" "bowl" "btest" "canter" "cellon" "circular-scanned" "cnv" "convolve" "cross-synthesis" "drone" "expandn" "expsrc" "fade" "fft" "filter-noise" "fltnoi" "fltsnd" "flute" "fm-bass" "fmex" "fmtest" "freeverb" "fullmix" "get-spectrum" "gen-control" "gen-delays" "gen-feedback" "gen-file-processing" "gen-filters" "gen-followers" "gen-formants" "gen-mixed-demo" "gen-modulation" "gen-noise" "gen-oscillators" "gen-random-modulation" "gen-reverb" "gen-spatial" "gen-spectral" "gen-utilities" "grani" "granular" "grapheq" "insect" "jcrev" "jcrevf" "jcvoi" "jlrev" "kiprev" "lbjPiano" "leslie" "maraca" "maxf" "mlbvoi" "move-sound" "noise" "nrev" "one-cut" "piano" "pluck" "pm-pulse" "pqw" "pqwvox" "prc95" "prc96" "pvoc" "resflt" "reson" "rev2" "ring-modulate" "rmsenv" "san" "scanned" "scentroid" "shepard" "singer" "sndwarp" "stochastic" "strad" "tb" "tnot" "track-rms" "trp" "ug" "ug1" "ug2" "ug3" "ug4" "ugex" "v" "vowel" "vox" "vslf" "vsum" "waveguide-flute" "wavetrain" "zd" "zipper") ; Loading fasl file E:\Opusmodus\clm\bin\add-noise-filtered.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\add.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\addflt.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\addsnd.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\anoi.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\arith.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\arith1.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\arith2.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\autoc.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\backandforth.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\badd.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\bandedwg.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\bell.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\bigbird.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\bird.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\bowl.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\btest.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\canter.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\cellon.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\circular-scanned.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\cnv.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\convolve.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\cross-synthesis.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\drone.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\expandn.64ofasl ; Loading fasl file E:\Opusmodus\clm\bin\expsrc.64ofasl ;;; Compiling file E:\Opusmodus\clm\instruments\fade.ins ... ;;; Safety = 3, Speed = 1, Space = 1, Float = 1, Interruptible = 1 ;;; Compilation speed = 1, Debug = 2, Fixnum safety = 3 ;;; Source level debugging is off ;;; Source file recording is on ;;; Cross referencing is off ; (lispworks:top-level-form 0) ; (lispworks:top-level-form 1) ; Writing "E:\\Opusmodus\\clm\\libclm\\clm_cross_fade.c" ; (lispworks:top-level-form 2) ; Compiling "E:\\Opusmodus\\clm\\libclm\\clm_cross_fade.c" ; Created shared object file "E:\\Opusmodus\\clm\\libclm\\clm_cross_fade.dll" ; (lispworks:top-level-form 2) ; (lispworks:top-level-form 2) ; (harlequin-common-lisp:subfunction |clm_cross_fade3| (fli:define-foreign-function |clm_cross_fade3|)) ; (fli:define-foreign-function |clm_cross_fade3|) ; (fli:define-foreign-function |clm_cross_fade3|) ; (lispworks:top-level-form 2) ; cross-fade ; cross-fade2 ; (lispworks:top-level-form 2) ; Writing "E:\\Opusmodus\\clm\\libclm\\clm_dissolve_fade.c" ; (lispworks:top-level-form 3) ; Compiling "E:\\Opusmodus\\clm\\libclm\\clm_dissolve_fade.c" ; Created shared object file "E:\\Opusmodus\\clm\\libclm\\clm_dissolve_fade.dll" ; (lispworks:top-level-form 3) ; (lispworks:top-level-form 3) ; (harlequin-common-lisp:subfunction |clm_dissolve_fade5| (fli:define-foreign-function |clm_dissolve_fade5|)) ; (fli:define-foreign-function |clm_dissolve_fade5|) ; (fli:define-foreign-function |clm_dissolve_fade5|) ; (lispworks:top-level-form 3) ; dissolve-fade ; dissolve-fade4 ; (lispworks:top-level-form 3) Error: Failed to rename file E:\Opusmodus\clm\bin\t_fade.64ofasl: The process cannot access the file because it is being used by another process(32). 1 (continue) Try to rename #P"E:/Opusmodus/clm/bin/t_fade.64ofasl" to #P"E:/Opusmodus/clm/bin/fade.64ofasl" again. 2 Try compiling E:\Opusmodus\clm\instruments\fade.ins again. 3 Skip compiling E:\Opusmodus\clm\instruments\fade.ins. 4 (abort) Return to top loop level 0. Type :b for backtrace or :c <option number> to proceed. Type :bug-form "<subject>" for a bug report template or :? for other options. OM 2 : 1 > And this error message window (similar to the other i got before) While loading file E:\Opusmodus\User Source\Extensions\Load CLM Instruments.lisp Failed to compile C file "(E:\Opusmodus\clm\libclm\clm_cross_fade.c E:\Opusmodus\clm\libclm\libclm-o64.lib)" with error 2. >>>>>>>Output: C:\Users\Desk2025\AppData\Local\Temp\lwtemp_DESKTOP-MIMK850_1514818fyrXD.bat E:\Opusmodus\CLM\instruments>call "c:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvars64.bat" ********************************************************************** ** Visual Studio 2026 Developer Command Prompt v18.4.3 ** Copyright (c) 2026 Microsoft Corporation ********************************************************************** [vcvarsall.bat] Environment initialized for: 'x64' Microsoft (R) C/C++ Optimizing Compiler Version 19.50.35728 for x64 Copyright (C) Microsoft Corporation. All rights reserved. clm_cross_fade.c Microsoft (R) Incremental Linker Version 14.50.35728.0 Copyright (C) Microsoft Corporation. All rights reserved. /dll /implib:E:\Opusmodus\clm\libclm\clm_cross_fade.lib /out:E:\Opusmodus\clm\libclm\clm_cross_fade.dll /export:clm_cross_fade1 E:\Opusmodus\clm\libclm\clm_cross_fade.obj E:\Opusmodus\clm\libclm\libclm-o64.lib LINK : error LNK2001: unresolved external symbol clm_cross_fade1 E:\Opusmodus\clm\libclm\clm_cross_fade.lib : fatal error LNK1120: 1 unresolved externals