Jump to content

Function Examples

Functions, arguments, values and results

  1. here is a short program (based on JOHNSON's writing... pascal-code found in www and modified) to generate TOM JOHNSON's series of numbers for "pascal's triangle ...". maybe interesting to play with the MODULO like JOHNSON did (mod 7)... try it! greetings andré ;;; SUB (defun pascal-next-row (a &key (johnson-modulo nil)) (loop :for q :in a :and p = 0 :then q :as s = (if (null johnson-modulo) (list (+ p q)) (list (mod (+ p q) johnson-modulo))) :nconc s :into a :finally (rplacd s (list 1)) (return a))) ;;; MAIN (defun pascal-tria…

  2. Started by o_e,

    Hi, What am I missing? (pitch-demix '(3 2) '(c3e4g5b6 d3f4a5c6 e3g4b5d6)) =>(e4 f4 g4) I would expect this: =>((e4 f4 g4)(g5 a5 b5)) thanks for an answer!

  3. Dear All, I found a very interesting way to use the span function to my purposes of controlling the harmonic rhythm of my composition. But I need some help. Here is one example: I set pitch lists for each voice of my quartet. Here is an example of how the material is organized for each voice. Each voice for each chord is broken in 16 repeated notes and another 16 notes with some custom made melodic material. The example below corresponds to TWO chords of the harmony. PITCH MATERIAL LISTS The first 16 notes are repeating and the next 16 notes are melodic figures of the same harmony. This is done for all t…

  4. Started by o_e,

    Hi, it says in the doc of vector-to-velocity that the default is float values, but when I evaluate (setf vel (vector-to-velocity 0.1 0.9 (gen-integer 1 16))) =>(pppp pppp ppp pp pp p mp mp mf mf f ff ff fff ffff ffff) I get symbols, when I use (setf vel (vector-to-velocity 0.1 0.9 (gen-integer 1 16):type :float)) =>(0.1 0.15 0.21 0.26 0.31 0.37 0.42 0.47 0.53 0.58 0.63 0.69 0.74 0.79 0.85 0.9) everything is fine, just want to mention it. best ole

  5. Started by JulioHerrlein,

    A faster way to pitch-demix. I found that this works faster than the pitch-demix function. Just to offer something... (setf chorale '(a3b3e4ab4 gs3ds4g4bb4 cs3a3b3e4)) (setf chordarray (build-array (sort-desc (melodize (mclist chorale))))) (setf size (get-count chorale)) (setf voice1 (get-array 0 0 size chordarray :direction 'down)) (setf voice2 (get-array 0 1 size chordarray :direction 'down)) (setf voice3 (get-array 0 2 size chordarray :direction 'down)) (setf voice4 (get-array 0 3 size chordarray :direction 'down)) (ps 'gm :sq (list (flatten (list '(q) voice1)) (flatten (list '(q) voice2)) (flatten (list '(q) voice…

  6. Dear Friends, I have this recurrent problem with lists... Please, help... ;;; I have this TWO lists (setf list1 '(v1rp0 v1rp1 v1rp2 v1rp3 v1rp4) (setf list2 '(melch1-0 melch1-1 melch1-2 melch1-3 melch1-4) ;;;AND ;;; I need a list like this (alternating the list) (v1rp0 melch1-0 v1rp1 melch1-1 v1rp2 melch1-2 v1rp3 melch1-3 v1rp4 melch1-4) How can I proceed ? Thanks a lot Best, Julio (a desperate quarantine composer) OBS. help in combining THREE lists are also greatly appreciated, as well as how to combine parts of the lists. Thank you... my brain is ruined for now (I´m doing so…

  7. Dear All, It´is possible to initialize sublists all at once as setf variables ? To transform a list like this: ((c4 ds4 e4)(c4 d4 f4)(c4 d4 g4)(cs4 d4 e4)), automatically into a list of setf materials, like v1 = (c4 d4 e4) v2 = (c4 d4 f4) v3 = (c4 d4 g4) v4 = (cs4 d4 e4) OBS.: v1 can be any letter, like p1, p2 or maybe mat1, mat2, etc... Thank you

  8. Dear All, I'm searching ways of making lists of lists. I tried all this because I was wanting to call materials from an array, like this: (setf mat1 '(c4 d4 ds7)) (setf mat2 '(d4 e4 c5)) (setf mat3 '(d4 eb4 cs5)) (setf mat4 '(d4 f4 c5)) (setf mat5 '(d4 g4 c5)) (setf mat6 '(d4 a4 c5)) (setf mat7 '(e4 a4 c5)) (setf mat8 '(f4 a4 c5)) (setf mat9 '(g4 a4 c5)) (setf mat10 '(a4 a4 c5)) (setf mat11 '(b4 a4 c5)) (setf array (build-array '((mat0 mat1 mat2 mat3) (mat4 mat5 mat6 mat7) (mat8 mat9 mat10 mat11)))) ;;;GET-ARRAY : (ROW COLUMN SIZE ARRAY &KEY DIRECTION (get-array 0 1 2 array :direction 'down) (setf listmat (get-array 0 1 2 array :directi…

  9. Started by o_e,

    Hi, I'am examing find-bar and I don't get the following: ;from the docs: (setf mat '((c4 db4 ab4 f4 g4 bb4) (a4 eb4 b4 e4 d4 gb4) (db4 ab4 f4 g4 bb4 a4) (eb4 b4 e4 d4 gb4 c4))) (find-bar 1 mat) => Error: The value (1) is not of the expected type number. > While executing: ccl::+-2-into, in process Listener-1(7). > Type cmd-. to abort, cmd-\ for a list of available restarts. > Type :? for other options. ;this works fine: (find-bar '(1) mat) =>((c4 db4 ab4 f4 g4 bb4)) ?? best ole

  10. Started by o_e,

    Hi, When I use omn-to-time-signature with (4 4), everything is fine: (setf test '(w fs5 q. e5 d5 q c5 e c5 h. b4 e a4 h a4 e q. gs4 q. gs4 e fs4 h e4 h e4 q. d4 e c4 h c4 e e fs5 q e5 e e5 q. d5 h c5)) (omn-to-time-signature test '(4 4)) =>((w fs5) (q. e5 d5 q c5) (e c5 h. b4 e a4) (h a4 e q. gs4) (q. gs4 e fs4 h e4) (h e4 q. d4 e c4) (h c4 e e fs5 q e5) (e e5 q. d5 h c5)) but when I use (5 4)or (3 4): (omn-to-time-signature test '(5 4)) => when called with arguments: > (nil) > While executing: #<ccl::standard-kernel-method no-applicable-method (t)>, in process Listener-3(38). &g…

  11. Started by o_e,

    Hi, The doc states: ;Note the handling of further nested sublists: (find-everyother 2 '(((1 2) (3 4) (5 6) (7 8)) ((1 2) (3 4) (5 6) (7 8) (9 10) (11)))) => (((1 2) (5 6)) ((1 2) (5 6) (9 10))) when I evaluate it I get: (find-everyother 2 '(((1 2) (3 4) (5 6) (7 8)) ((1 2) (3 4) (5 6) (7 8) (9 10) (11)))) =>((1 2 5 6) (1 2 5 6 9 10)) What am I missing or how can I achive the upper example? Thanks! ole

  12. Dear Friends, I´m seriously doing a composition for String Quartet now. I was procastinating it for more than one year, but now I´m really finding good results that could be part of a composition. The question is that I generate some VERY LONG (sometimes 200 bars) of material and, inside this stream I´d like to use ONE or TWO measures of this particular stream, and more 6 measures generated by other process, interpolate some Free material in between, and so on. In general, this is the expression I use to compile each voice of the quartet: vh1 (VL), vh2 (VL2), vh3 (VLA) and vh4 (Cello) (setf vh1 (make-omn :length rv1 …

  13. I can't seem to get do-timeline2 function to work. I include an abridged example below; happy to share more code details if necessary. I'd like to filter 64 measures of 4/4 as defined in the timeline. Would anyone be able to offer some feedback? I tried adjusting different 'list' levels, etc. but with no avail. Thank you! (setf chords1 '(e2b2g3d4 e2cs3a3e4 e2d3b3fs4)) (setf chords2 (pitch-transpose 3 chords1)) (setf chorale1-chords (span '(1 1 1 1 1 1 1 1) chords1)) (setf chorale2-chords (span '(1 1 1 1 1 1 1 1) chords2)) ;; OMNS (setf chorale1 (make-omn :length (length-span '(1 1 1 1 1 1 1 1) '(w) :omn t) …

  14. I wonder if there's a function to allow for systematic transformations of rhythmic streams, like in the example below. From a regular stream of 16th notes: (s c4 d4 e4 f4 5q d4 e4 f4 g4 e4 s f4 g4 a4 f4 3q g4 a4 b4) To occasional introduction of quintuplets, tuplets, etc: (s c4 d4 e4 f4 5q d4 e4 f4 g4 e4 s f4 g4 a4 f4 3q g4 a4 b4) Or: (6q c4 d4 e4 f4 d4 e4 s f4 g4 f4 g4 5q a4 f4 g4 a4 b4) Thank you!

  15. I discovered today that you can use just length-diminution to expand OR contract rhythms, just by using fractions. You can use ti to make some proportional metric modulation stuff. Here are some examples. ORIGINAL (length-diminution 1/1 '(q e e e e s s s s)) CONTRACT (length-diminution 2/1 '(q e e e e s s s s)) EXPAND (length-diminution 1/2 '(q e e e e s s s s)) (length-diminution 1/3 '(q e e e e s s s s)) (length-diminution 3/2 '(q e e e e s s s s)) (length-diminution 3/4 '(q e e e e s s s s)) And so on !! This is cool ! Best, Julio

  16. Started by JulioHerrlein,

    Dear Friends, I´m working with this Lenght-Map, for articulations and dynamics. It´s not waorking the way I expected. Some are in the map, but won´t map. Some aren´t in the map, but appears... Stephane use it a lot... What I missed ? ;;;FORUM QUESTION ;;;pitches (setf v1 '(q gs4 bb4 e4 d4 eb4 fs4 b4 gs4 g4 a4 c5 bb4 a4 cs4 d4 d4 d4 g4 d5 b4 g4 f4 eb4 e4 f4 fs4 c5 bb4 eb5 cs5 fs4 g4 fs4 g4 gs4 a4 d5 b4 g4 a4 a4 gs4 bb4 e4 d4 eb4 fs4 b4 gs4 g4 a4 c5 bb4 a4 cs4 d4 d4 d4 g4 d5 b4 g4 f4 eb4 e4 f4 fs4 c5 bb4 eb5 cs5 fs4 g4 fs4 g4 gs4 a4 d5 b4 g4 a4 a4 gs4 bb4 e4 d4 eb4 fs4 b4 gs4 g4 a4 c5 bb4 a4 cs4 d4 d4 d4 g4 d5 b4 g4 f4 eb4 e4 f4 fs4 c5 bb4 eb5 …

  17. Dear All, I´m looking for some way of retrieving musical information from sets of notes. Some problems, for example: 1) This is the first and more needed now: Given some UNORDERED amount of pitches, how retrive the prime form and/or Forte Number. 2) How to do this from an existing midi file or XML ? Is t possible to retrive the forte number of every "n" notes of the pitch collection (melody or chord)? 3) Can you circunscribe some notes for analysis in a large file ? Thanks, everyone ! Best, Julio

    • 5 replies
    • 2.9k views
  18. Started by AM,

    dear all here's a function (revised, should work correct now) to work with rotations - based on the work of karel goeyvaerts (defun goeyvaerts-rotation* (&key pitches static-pitches generations goeyvaerts-transpose-interval (direction 'up) low-border high-border correction-interval) (let ((pitches (filter-remove (pitch-to-midi static-pitches) (pitch-to-midi pitches)))) (midi-to-pitch (append (list (append pitches (p…

    • 0 replies
    • 676 views
  19. Started by AM,

    row-permutation (with rule) for n-generations (defun row-permutation (n row rules &key (one-based nil)) (let ((rules (if (equal one-based t) (mapcar '1- rules) rules))) (loop repeat n collect (setf row (position-filter rules row))))) (row-permutation 5 '(a4 c5 cs5 g4 eb5 gs4 e5 d5 f4 b4 bb4 fs4) '(0 1 6 5 2 3 7 8 11 9 4 10)) => ((a4 gs4 eb5 c5 cs5 e5 d5 bb4 f4 g4 b4) (a4 e5 cs5 gs4 eb5 d5 bb4 b4 f4 c5 g4) (a4 d5 eb5 e5 cs5 bb4 b4 g4 f4 gs4 c5) (a4 bb4 cs5 d5 eb5 b4 g4 c5 f4 e5 gs4) (a4 b4 eb5 bb4 cs5 g4 c5 gs4 f4 d5 e5)) (row-permutation 5 '(a4 c5 cs5 g4 eb5 gs4 e5 d5 f4 b4 bb4 fs4) '(1 4 6 5 2 3 7 8 11 9 10 …

    • 0 replies
    • 769 views
  20. Started by o_e,

    Hi, How does position-insert work? (setf test '(c4 d4 e4 fs5 e4)) (setf test2 (position-insert '(1 3 5 7) 'b3 test)) =>(c4 b3 d4 b3 e4 b3 fs5 e4) ; 1 3 5 ? what am I missing?

  21. Started by Rangarajan,

    Hi, Opusmodus team has done a great job in supporting L-system. I have been spending some time to understand this feature; seems quite powerful. I have just uploaded a blog post on this topic. Your comments and suggestions will be very much appreciated. Does OM implementation support the full functionality as outlined in this paper? - Rangarajan

  22. The documentation on the interval-expansion-series function states that a count list argument refers to a number of intervals to process. Would someone be willing to explain what number of intervals and in what way? I understand that this function also has built-in randomness, resulting in a different output each time. In the example below, does the count list '(1 2 3) mean that only one interval is expanded the first time, then two intervals the second time, etc.? Or does it imply that only the first three intervals from the interval source list will be expanded? (interval-expansion-series 10 '(1 -1 2 -2) '(1 2 3) '(-6 -5 3 4) :max-interval 6) …

  23. Hi, Please have merci with me, but I'am not able to build a library (permanent). I've tried to follow the docs, so I first use def-library: (def-library test (:section testing bla1 '(a b c) bla2 '(e f g) )) This seems to work, testing with: (library 'test 'testing 'bla2) ==>(e f g) Next step in my understanding would be: (create-library 'test 'testing 'bla :file "test" ) that gives an error: ==>Error: Incorrect keyword arguments in ("test") What am I missing, surely something very silly that I overlooked,…

  24. Started by o_e,

    Hi, I'am having hard times to understand what is pitch-transpose doing, please have a look, thanks! (pitch-transpose -12 '((fs1) (f1) (g-1g1bb2e6gs6a6bb6) (gs-1bb1bb2e6gs6a6bb6) (bb-1cs2bb2a3e6gs6a6bb6cs7))) ;==> ((fs1) (f1) (g1 g1bb1e5gs5a5bb5) (gs1 bb0bb1e5gs5a5bb5) (bb0 cs1bb1a2e5gs5a5bb5cs6)) ; x? x? x? (pitch-transpose 12 '((fs1) (f1) (g-1g1bb2e6gs6a6bb6) (gs-1bb1bb2e6gs6a6bb6) (bb-1cs2bb2a3e6gs6a6bb6cs7))) ;==> ((fs2) (f2) (g1 g2bb3e7gs7a7bb7) (gs1 bb2bb3e7gs7a7bb7) (bb0 cs3bb3a4e7gs7a7bb7cs7)) ; …

  25. Started by o_e,

    Hi, I'am examin the distribute-seq function and don't get the exact logic behind it: (setf pitch '(c4 cs4 d4 ds4 e4 f4 fs4 g4 gs4 a4 as4 b4)) #| 1 2 3 4 5 6 7 8 9 10 11 12 |# (setf l-v1 '(1/8 -1/8 2/8 -1/8 5/8) l-v2 '(1/8 1/8 -1/8 2/8 1/8) l-va '(-2/8 1/8 -5/8 1/8) l-vc '(-1/8 3/8 1/8 1/8) ) (setf align (distribute-seq pitch l-v1 l-v2 l-va l-vc)) ==>((c4 e4 gs4) (cs4 d4 fs4 a4) (f4 b4) (ds4 g4 as4)) ;;;from the docs, what is the rule for the distribution (when the lists are of different size)? ;;;Do the list of pitches (have to) match the list of length values? #| -----------------that's what I would expect:------------…


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