Function Examples
Functions, arguments, values and results
271 topics in this forum
-
I'm trying to combine a series of counterpoint dictums into a single dictum list. I tried several things, but can't seem to get it work. Is there a function similar to assemble-seq that could be applied here? Thank you! (setf dictum-1a '(((1 2 3) :methods ( (r ft) (t-12 ft) (dl1 t-12 pr1 ten)))) ) (setf dictum-1b '(((1 2 3) :methods ( (r ft) (t-12 ft) (dl1 t-12 pr2 ten)))) ) (setf dictum-1b '(((1 2 3) :methods ( …
-
- 1 reply
- 753 views
- 1 follower
-
-
The following example randomly segments a list of given pitches into progressively increasing sublist of elements. I can't seem to recall a function one could use instead of rnd-repeat that would do the same but not randomly, preserving the original order or pitches => (c4) (d4 e4) (f4 g4 a4), etc. Thank you! (setf pitches '(c4 d4 e4 f4 g4 a4 b4 c5)) (setf seq (make-omn :pitch (rnd-repeat (gen-integer 1 4) pitches) :length '(1/16) :velocity '(f) :articulation '(stacc) :span :pitch))
- 3 replies
- 855 views
- 1 follower
-
Maybe I missed it, but is there a function that removes ties, opposite to filter-tie? Thanks!
- 1 reply
- 803 views
- 1 follower
-
Hello! I’m trying to span a list and produce new lines of pitches, by interval (or otherwise) and with varying rhythmic values but have all the lines end on the same beat in the same bar. To explain more specifically - I'm trying to span a list and perform an operation on each item in the list more than once. For example, if I have two melodic lines (variables named "pitches" and "basspitches") they might look something like this: (setf pitches '(fs3 e3 gs3 b2 a3 fs4 d4 b5 e4 gs4 fs4 gs4 cs4 fs4 b3 e4 fs4)) (setf basspitches '(fs2 cs3 a2 e3 fs3 d3 b3 gs3 cs4 e3 cs3 fs3 d3 b3 gs2 fs2)) I can play them together…
- 2 replies
- 842 views
-
Hello! The example below has been taking several minutes to compile, eventually crashing Opusmodus. Would someone be willing to look at the code and let me know what's causing this? Thank you so much! (setf pattern1 (length-augmentation 2'((-h. q g4) (q. g4 e e4 q e4 -q) (-h. q g4) (q. g4 e d4 q d4 -q) (-h. q e4) (q f4 g4 a4 b4) (h. g4 -q)))) (setf pattern1a (length-augmentation 3 '((-h. q g4) (q. g4 e e4 q e4 -q) (-h. q g4) (q. g4 e d4 q d4 -q)))) (setf scale '(c4 eb4 f4 g4 ab4)) (setf pattern1-scale (tonality-map '(scale :map octave :closest up) pattern1)) (setf pattern1a-scale (tonality-map '(scale :map octave :closest up) pattern1a)) (setf voic…
- 4 replies
- 1.1k views
- 2 followers
-
Hello, Friends Is there some function to convert this: (1 0 0 1 0 1 1 0 1 0 1 0 0 0 0 1) 3 2 1 2 2 5 1 to this: (3 2 1 2 2 5 1) Best ! Julio
- 2 replies
- 642 views
-
Hello, Friends I´m exploring this interesting counterpoint function. When I write the parameter for the keyword :harmony note for note everything works fine, but when I substitute the chords of the :harmony keyword with the content of the variable setf harmony 2 it won´t work, giving the following error: > Error: (harmony2) is not a tonality or a chord. > While executing: %make-tonality, in process Listener-1(7). > Type cmd-. to abort, cmd-\ for a list of available restarts. > Type :? for other options. I´d like to use the :harmony keyword in a way that I can process the chords in other place (by MIDI Entry or genera…
- 14 replies
- 3.8k views
- 2 followers
-
Dear All, Recently, I used the function combination and got some strange result I did this (combination 3 '(0 1 2 3 4 5)) I got this result - 60 combinations (0 1 2) (0 1 3) (0 1 4) (0 1 5) (0 2 3) (0 2 4) (0 2 5) (0 3 4) (0 3 5) (0 4 5) (1 2 3) (1 2 4) (1 2 5) (1 3 4) (1 3 5) (1 4 5)(2 3 4) (2 3 5) (2 4 5) (3 4 5)(5 0 1) (5 0 2) (5 0 3) (5 0 4) (5 1 2) (5 1 3) (5 1 4) (5 2 3) (5 2 4) (5 3 4) ,(4 5 0) (4 5 1) (4 5 2) (4 5 3) (4 0 1) (4 0 2) (4 0 3) (4 1 2) (4 1 3) (4 2 3)(3 4 0) (3 4 1) (3 4 2) (3 5 0) (3 5 1) (3 5 2) (3 0 1) (3 0 2) (3 1 2) (2 3 0) (2 3 1) (2 4 0) (2 4 1) (2 5 0) (2 5 1) (2 0 1) (1 2 0) (1 3 0)…
- 6 replies
- 1.2k views
- 1 follower
-
Hi all, has anyone written a function that calculates the total duration of a score (including tempo changes and fermatas) in minutes and seconds? Achim
-
- 0 replies
- 703 views
- 1 follower
-
-
Hi, When I constrain the ambitus range to be smaller than an octave, I do not understand exactly on which axis the pitches are inverted, when I use :type :invert it is clear, but what does the default transpose type? Thanks! (setf range '((q c4 cs4 d4 ds4 e4 f4 fs4 g4 gs4 a4 bb4 b4 c5))) (setf amb2 (ambitus '(c4 a4) range )) (merge-voices range amb2)
-
- 1 reply
- 850 views
- 1 follower
-
-
Hi, How do I point :methods and :global-methods to my own def-unfold-set instead of the default one? (counterpoint patterns '(((- 2 3 -)) ((4 * * 6)) ((1 - - 2)) ((5 6 1 2))) :index 'voice :global-polyphony '((1 p) (2 o) (10 o) (11 o)) :iterate t :global-methods '((fl) (cl) (hn) (vc))) Thanks!
-
- 2 replies
- 975 views
- 1 follower
-
-
Hi, When I write functions and make use of setf's, I get the brown colored warning: Undeclared free variable This becomes a problem, when I'd like to put the function into the extensions folder. How can I remedy this? Thanks!
- 6 replies
- 1.5k views
- 2 followers
-
Dear All, The second half of trope 21 is showing a note repetition. (trope-hexachord 21) ((c4 b3 bb3 eb3g3a3) (d3fs3gs3 cs3f3 fs3)) The pitch-class fs3 appears twice, comprising a 5 note set (it should be an hexachord, a 6 note-set) (d3fs3gs3 cs3f3 fs3)) According to Sedivy (2011, pg 134) the trope 21 is shown below: In Sedivy´s book, this trope are shown starting in E, thus (pitch-transpose -8 (trope-hexachord 21)), thus ((e3 eb3 d3 g2b2cs3) (fs2bb2c3 f2a2 bb2)) There is a repetition of two Bb pitch classes in the second hexachord (pitch-transpose -8 (melodize (l…
- 8 replies
- 1.4k views
- 1 follower
-
Dear Friends, Please check this replace-stream function !! This is what I was searching for and trying to achieve for a long time !! It really worth to upgrade. I have some questions regarding this new tool: Here is the code, similar to the documentation. First, we have the Bach Chorale. Second, there are some original material that looks like this: V1 plays only E and F pitch classes V2 plays only C and D pitch classes VLA plays only Bb and G# pitch classes CELLO plays only Bb and Eb pitch classes For easy understanding of the point When I do the replace-stream, I.E., using the new…
- 6 replies
- 18.4k views
- 2 followers
-
Dear All, From the example below I suppose that choralis function applyes some voice-leading in the progression provided. Maybe to generate some more singable sequence ? (maybe not...) For example, here I provide my classic test-debuggin harmony: (setf chords2 (gen-trim 31 '(a3b3e4gs4 gs3eb4g4bb4 cs3a3b3e4 gs2f3bb3d4 gs2e3b3eb4 eb3b3cs4fs4 a2e3eb4b4 fs2cs3c4gs4 d3gs3b3g4 b3e4fs4a4 fs3cs4f4c5 b3cs4fs4bb4 g2d3cs4a4 g2fs3b3cs4 e2fs3g3d4 f2eb3bb3d4 b2g3a3d4 bb2gs3eb4g4 e3c4g4d5 cs3a3e4b4 gs3bb3eb4g4 fs3gs3cs4f4 fs2e3b3eb4 cs3a3b3e4 b2gs3cs4f4 eb3a3d4fs4 d3bb3f4c5 e3eb4gs4bb4 f3cs4gs4eb5 b2fs3f4cs5 eb3b3cs4fs4 eb3gs3b3g4 e3g3d4fs4 a2bb3eb4g4 d…
- 1 reply
- 1.2k views
- 1 follower
-
Dear All, Sometimes you are working on a very cluttered file with many setf variables that you need to evalate before starting. Is there a way to put a shortcut inside and .opmo score to evaluate a set of code in a different .opmo score, without having to move to the other document to evaluate it ? Best, Julio
- 2 replies
- 985 views
- 1 follower
-
Hey, people ! I´m doing a function to extract the complementary set of notes. For example: 1) Specify a set of notes, like a chord, Dm7 (setf note-list '(d5 f5 a5 c6)) Specify a tonality, like Cmajor or D dorian (same notes) (expand-tonality '(c5 major)) 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). So, this function gives me exactly what I need (for ONE tonality at a time and ONE chord at a time): (let ((rem (expand-tonality '(c5 major))) (super (ambitus '(c5 b5) note-list))) (loop for i in super …
- 2 replies
- 992 views
- 1 follower
-
Dear Friends, I think a good companion to the gen-divide option to count rests would be a function that counts the positive rhythm items (the positive value attacks, excluding the pauses). It would be great to calculate the size and to align rhythms and its groupings for later span processing of lists related to pitches (or any other use you might think). Is there already a function like this: GET-COUNT-ATTACKS (get-count-attacks '((1/8 7/8) (1/8 7/8) (1/4 1/12 1/12 1/12 3/16 5/16) (-3/8 1/8 1/4 -1/8 1/8))) would return: (2)(2)(7)(3) or maybe (2 2 7 3) in flatten version …
-
- 2 replies
- 901 views
-
-
Dear All, How can I get controlled seeds in a expression like this? (let ((r-lis nil)) (dotimes (i 4) (push (rnd-unique 5 '(1 2 3 4 5)) r-lis)) r-lis) This will result four different seeds (one for each loop iteration), like this: rnd-unique :seed 361914 rnd-unique :seed 275956 rnd-unique :seed 883737 rnd-unique :seed 46981 ((3 1 4 5 2) (4 2 1 5 3) (2 5 4 1 3) (1 3 5 4 2)) And this will result the same seed for all four iterations: (let ((r-lis nil)) (dotimes (i 4) (push (rnd-unique 5 '(1 2 3 4 5):seed 1) r-lis)) r-lis) Like this: rn…
- 2 replies
- 927 views
- 1 follower
-
Dear All, Is there a function for get all intervals of a row (or any list of integers or pitches) in relation to one note ? For example, given this 12 tone row: (a3 gs4 c4 d4 bb3 b3 fs4 f4 cs4 g4 ds4 e4) Get all intervals related to a4 ? The result should be: (-12 -1 -9 -7 -11 -10 -3 -4 -8 -2 -6 -5) This is for getting a resultant set of numbers related to a chromatic octave-module. Each order of the set result in a different set. Maybe can be a mapping function.
- 5 replies
- 1.2k views
- 1 follower
-
Suppose a density is defined by measuring the amount of information. Why does the first list having three pitches result in lower density than the second list comprising two pitches? (density-analysis '((c4 d4 g4) (d4 a4))) => (0.2916667 0.5833334) Thank you!
- 7 replies
- 1.4k views
- 2 followers
-
Dear friends, A cool idea to implement would be to have a gen-divide like function for dividing rhythm lists, filtering just the positive values, like this: (setf rhy '(q -q -e e e e q q -s s s s)) ;;;Standard gen divide (gen-divide 3 rhy) ;;result: (q -q -e) (e e e) (q q -s) (s s s) ;;; (gen-divide-attack 3 rhy) ;;;result (q -q -e e e) (e q q) (-s s s s) To me, would be very useful. All the best ! Julio
- 6 replies
- 1.5k views
- 1 follower
-
Dear all Is there some way to make a processing of accidentals in the make-omn expression or even later, in the PS expression ? Something like: bar #1 all sharps bar#2 all flats etc. I noticed that after many sucessive list processing, my original notes were altered. Thanks ! Best ! Julio
- 7 replies
- 1.5k views
- 1 follower
-
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…
- 1 reply
- 995 views
- 1 follower
-
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!
-
- 2 replies
- 913 views
- 1 follower
-