Jump to content

Function Examples

Functions, arguments, values and results

  1. Started by born,

    Lets say I have 2 measures of music. I want to make random variations of the rhythms (not the pitches) The result should fit in the initial 2 measures. What is the function called for this. I cannot remember ... Thanks for help, Achim

  2. Started by marqrdt,

    OMers, I wrote this function and use it in my composition work. Please feel free to steal use it. It returns the "polarity" of a sequence, defined as the ratio of consecutive uneven and even interval classes (IC) in a sequence. I use this as a way of testing if a generated sequence contains a balanced mix of even or uneven ICs. (defun polarity (in-seq) (when (equal (length in-seq) 0) return 0 ) (let((accum 0) (int-pairs (interval-class in-seq))) (mapcar (lambda (x) (when (evenp x) (incf accum) )) int-pairs) (/ (* accum 1.0) (- (length in-seq) 1)) ) ) Some examples: ;; The polarity of a chromatic scale…

  3. Dear All, One interesting conversion would be the one for transforming the get-time-signature result to length-span time signature format. This would be useful to rephrase rhythmically one rhythm with another´s rhythm time-signature structure. For example: ; Take this rhythm (setf ritmos (gen-repeat 4 (gen-length '((1 2 1 2 1 1) (1 1 1 1 1 2 1) (1 -3 1 -3 2 -2 4) (-3 1 -1 1 1 1)) '(16)))) Here is the bar structure for this (get-time-signature ritmos) This is the output ((2 4 2) (4 4 1) (2 4 3) (4 4 1) (2 4 3) (4 4 1) (2 4 3) (4 4 1) (2 4 1)) If I want to use this result …

  4. I am trying to get a random series of lengths from the list (4/14 5/14 6/14) to span over a certain time, in this case 4 bars. (length-span '4 (rnd-sample 40 '(4/14 5/14 6/14))) The result keeps including tied sixteenth notes, although I want to limit the score and rhythm to two eighth septuplets per bar (with ties). I also tried to include quantize as a second grid which didn't help to "clean" the result. Am I making a mistake here or is this some kind of bug?

  5. Started by Stephane Boussuge,

    I've shared a video here on CHORD-DICTUM function and you will find here the code from the video. Enjoy ! The Score: ;;;-------------------------------------------------------- ;;; SCORE 186 ;;; VARIATIONS POUR PIANO ;;; Etude de la fonction "chord-dictum" ;;; S.BOUSSUGE ;;; WIEN - 27.01.2024 ;;;-------------------------------------------------------- ;;; LEARN OPUSMODUS: WWW.COMPOSERWORKSHOP.COM ;;;-------------------------------------------------------- ;;; To view the score press the Cmd-Option-1 keys. ;;;-------------------------------------------------------- ;;; UTILITY ;;; REA-MARK (defun rea-mark (omn-exp) "Add rehearsal marks…

  6. Started by strumm,

    In this simple example from the documentation. The first chord is divided into 5, but why are the pitches for the 2nd through 5th chord division seemingly random? The dictum states a rule for dividing the chord rhythmically, but has no rules for altering pitches? (setf mat1 '((h a2b2e3f3gs3 mf) (h a2b2e3f3gs3 p) (q bb4c5gs5a5b5 mp q bb4c5gs5a5b5 p))) (chord-dictum '((:len h :chd 5 :div 5) (:len q :chd 5 :div 4)) mat1)

  7. Started by rcadiz,

    Hi everyone, I am having a hard time trying to add appoggiaturas to selected length values on an omn sequence. Let's say I want to search for all whole durations and add an appoggiatura before this event. I have been trying these kind of solutions using dictum (setf mat '(w c4 stacc)) (dictum '( (:and w :apply (app e f4)) ) mat) (dictum '( (:and w :apply '(app e f4)) ) mat) (dictum '( (:and w :apply ((app e f4) w)) ) mat) (dictum '( (:and w :apply (app e f4 w)) ) mat) All of these fail. I get some error saying the sequenced-event :type nil :phrase (nil nil) is not of type ?event when ac…

  8. Started by strumm,

    Hello, I'm on my 30 day free trial and going through the documentation. I'm a guitarist, and I would like to use opusmodus to generate guitar parts, and I need some general direction. My final output will play a virtual guitar which takes input on midi channels 1-6 where each channel is a string. Given that, I'm thinking in opusmodus, that each string would be a voice. I can see how to do this just treating each string as a differnt instrument, but I would like to represent a chord as a single unit that I can then repeat, and represents what notes are present on all 6 strings(voices) , or 5 or 4, whatever number the chord has. Then…

  9. Video about 5-note voicings with drop-voicing function (in portuguese)

  10. Started by Andersskibsted,

    Hi, Does anyone know of a good way to sort a list of pitches so I get a list of all the quartertones and another list of all the semitones? Or maybe a function that tests if a pitch is within the twelve semitones or not? Thank you Anders

  11. Started by AndreOktave,

    Hello, I am trying to assign articulations (attributes) to certain note lengths my attempt: (setf omn '((q e3 p -q s a4) (s f3 mp -s) (e g3 mf))) (setf rh (omn :length omn)) ;=> ((1/4 -1/4 1/16) (1/16 -1/16) (1/8)) ;; how is it possible to convert the ratios to omn-notation?: (setf rhomn '((q -q s) (s -s) (e))) (setf aq '(ord) as '(stacc) ae '(spicc) a-q '(-) a-s '(-)) (setf art (assemble-section 'a (flatten rhomn))) ;;I don't understand how to handle the rests (setf pch (omn :pitch omn)) (setf vel (omn :velocity omn)) (make-omn :length rh :pitch pch :velocity vel :articulation art) …

  12. Started by TomTolleson,

    Hello, I'm working with a plainchant as source material and I'd like to augment the lengths of the notes without augmenting the rest size. For example in this example, I'm able to increase the source material sourcemat with the length-augmentation. (setf augmat (length-augmentation 4 sourcemat)) I'm wondering if the exception parameter is the key here? Unfortunately the documentation doesn't include much for the use of exception. To better illustrate the issue I'm including an example below using a single instrument (tuba). Thanks. ;;;--------------------------------------------------------- ;;; Parameter…

  13. INSPIRING IDEA FOR RHYTHM (Nested Tuplets) Nestup [[]_[]] NESTUP.CUTELAB.NYC Nestup, a Language for Musical Rhythms

  14. Started by david,

    Hi, Is it possible to indicate in a make-omn parameter list to execute list in 4/4 except the last two measures? Thanks for your help (setf seq+ry (omn-to-measure (make-omn :pitch (omn :pitch seq) :length (gen-repeat 1 ry7) :span :length) '(4/4)))

  15. Started by david,

    So I was saying I'm have a problem with this code. After reading documentation several times, I admit I don't understand how to do it with my code. ;;;variation rythmique Gamme majeure 4/4 (setf mat '((e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5) (e d5 e5 f5 s d5 db5 e c5 d5 e5 s c5 b4) (e bb4 c5 d5 s b4 bb4 e a4 bb4 c5 s a4 ab4) (e g4 a4 bb4 s g4 gb4 e f4 g4 a4 -e))) (loop for i in '(0 5 -2 3 8 1 6 -1 4 9 2 7) append (pitch-transpose i (loop for bar in mat collect (list (filter-repeat 1 (rnd-order (first (gen-divide 5 bar)) :type :pitch)…

  16. Started by david,

    Hi, I'm a beginner, can anyone help me? I'm trying to figure out how to transpose the whole list. currently i have transposition individually to each measure in a pitch sequence (setf theme-tr (pitch-transpose '(0 5 -2 3 8 1 6 -1 4 9 2 7) (gen-repeat 12 '((e f5 g5 a5 s gb5 f5 e e5 f5 g5 s e5 eb5) (e d5 e5 f5 s d5 db5 e c5 d5 e5 s c5 b4) (e bb4 c5 d5 s b4 bb4 e a4 bb4 c5 s a4 ab4) (e g4 a4 bb4 s g4 gb4 e f4 g4 a4 -e)))))

  17. Started by born,

    Has anybody an idea how to formalize the following task? A list of 4 sublists with 2 elements: '((1 2) (3 4) (5 6) (7 8))) ==> All the possible combinations of either one or the other number in the sublist: '( (1 3 5 7) (1 4 5 7) (1 3 6 7) (1 4 6 7) (1 3 5 8) (1 4 5 8) (1 3 6 8) (1 4 6 8) (2 3 5 7) (2 4 5 7) (2 3 6 7) (2 4 6 7) (2 3 5 8) (2 4 5 8) (2 3 6 8) (2 4 6 8) ) Did I miss a combination? Thanks for help. Achim

  18. Started by erka,

    I was looking for a function like Scale-quantize in Logic or quantize-modules in VCV-Rack etc. I tried tonality-map and harmonic-path, but they are changing the start point of the sequence. So I wrote a function that does what I want. Maybe there is already a function like this. Maybe there is a way to do the same with tonality-map etc and I didn't get it. Please let me know. (defun rk_pitch-quantize ( sequence scale &key seed ) ;with rnd-seed "sequence can be omn-form or pitches. scale being e.g.'(g0 dorian)" (when (not (or (every 'listp sequence) (omn-formp sequence) (every 'pitchp sequence) ) ) (error "rk_pitch-qu…

  19. Started by born,

    Hello people, again struggling to find the name of the function which ranges all values in a list to a specific sum of the list. Any help?

  20. Hello, This seems like a simple issue but I think there's some underlying lisp concept I'm missing. I'm trying to apply length-augmentation to a list rather than explicit lengths and getting an error. So to begin with I import a plainchant MIDI file: (setf source "/Users/tomtolleson/OpusModus/Scores/The Bifurcated Fruit of a Mirror/MIDI/dominabi.mid") I define the lengths from the source as "sourcelengths" (setf sourcelengths (midi-to-omn source :type :length)) This all works properly. Now, if I apply length-augmentation to a series of lengths explicitly (from the documentation): (length-augmentation 2 '(1/8…

  21. Started by Veit,

    I am trying to create a rnd-sample process with a tightening range of material. For example: (rnd-sample 50 (gen-integer 50 60) ) -> it should start with sampling from the full range between 50 and 60, but tightening the range until at the last sample only chosing from material between 54 and 56 Maybe I could somehow map the sampled material to 2 vectors, a rising linear function and a falling one? Or get the range between 2 functions? I am kind of lost here, sorry if the answer is obvious đź‘€

  22. Hi! If I have an omn sequence including pitches, lengths, and articulations is there any way to change events into rests? Some kind of procedure of "filtering out" (silencing) some notes in either a deterministic or random fashion. Thanks! Rodrigo

  23. Hi! Is there a function like merge-voices that would work for omn sequences with articulations? If I merge two sequences with merge-voices containing articulations they are lost in the merging process.

  24. Started by AM,

    (defun prob-mutation (alist blist &key (factor 1) (prob-list nil)) (loop for a in alist for b in blist for x in (if (null prob-list) (cumulative-sums (gen-repeat (length alist) (float (/ factor (length alist))))) prob-list) when (probp x) collect b else collect a)) ;;; with linear prob-incf (prob-mutation (gen-repeat 100 1) (gen-repeat 100 2)) => (1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 2 1 1 1 1 2 2 1 2 2 2 1 1 1 1 1 2 1 1 1 1 1 2 2 1 1 2 2 1 1 2 2 2 2 1 1 2 2 2 1 1 2 1 1 1 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2) ;;; with an external prob-list …

    • 0 replies
    • 443 views
  25. Started by Veit,

    I know how to create a set of pitches that moves from a to b in a linear or exponential curve. Now, how can I get such a movement but not with a line of single pitches, but with transposed sets of pitches? For example: Create movement from a4 to d4 but only with variants of (g4 a4), thus transposing the major second upwards movement until reaching (d4 e4).


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy