Function Examples
Functions, arguments, values and results
312 topics in this forum
-
Hi, vector-to-pitch is a very useful function. I want something quite similar with but with a small change. What it does now (from the doc): (vector-to-pitch '(g3 g4) (gen-white-noise 10 :seed 89))(vector-to-pitch '(g3 g4) (gen-white-noise 10 :seed 89)) => (ab3 g4 eb4 a3 b3 eb4 g4 g3 gb4 e4) Instead of giving (low high) as the first argument, I would like to give, for example, a specific scale. Let us say that I want vector-to-pitch to convert the generated white noise to pitches in Major Scale, with tonic of C4. Is this possible? - Rangarajan
- 5 replies
- 1.9k views
- 1 follower
-
Dear Friends, Sometimes my composition process is very related to harmony and voice-leading. For example starting with a sequence of chords in 4-part writing as a foundation for a string quartet or saxophone quartet. So, I have some questions regarding this: 1) How to make ornaments and developing the texture in each voice individually but keeping the harmonic movement based on the first "chorale", the fundation of the composition. Maybe harmonic path ? But do you have other hints ? 2) How to repeat the notes of a given chord within that foundational 4-part structure Something like this... …
- 7 replies
- 2.3k views
- 2 followers
-
Hi, When I evaluate: (interval-to-pitch '(2 2 1 2 2 2 1) :start 'c7) => (c7 d7 e7 f7 g7 a7 b7 c8) This is expected. But when I evaluate: (interval-to-pitch '(2 2 1 2 2 2 1) :start 'c8) => (c8 bb7 gs7 g7 f7 eb7 cs7 c7) Is this expected? - Rangarajan
-
- 2 replies
- 1.3k views
- 1 follower
-
-
Hi, I was looking at the documentation of "gen-walk" function and have a doubt. It is my understanding that the probability of "forward" and probability of "backward" can each range from 0 to 1, but the sum cannot be greater than 1. However, the sum could be less than 1. So, I think it is not correct to have forward probability as 1 and backward probability as 0.7. This would make the total exceed 1. However, it is OK to have forward probability as 0.3 and backward probability as 0.4. In this case the stationary probability would be 1 - 0.3 - 0.4 = 0.3 Am I correct in my understanding? If this is correct, then there is a mistake in the documen…
-
- 3 replies
- 1.5k views
- 1 follower
-
-
Hi, I am trying to understand the polygon-rhythm function, but having some difficulty with the finer details. The expression (polygon-rhythm 5 8 4) returns 8 points (randomly generated) like this: => (-1/8 -1/8 1/8 1/8 1/8 1/8 1/8 -1/8) Likewise, (polygon-rhythm 5 16 4) returns 16 points: => (1/16 -1/16 -1/16 -1/16 1/16 -1/16 -1/16 -1/16 1/16 1/16 -1/16 -1/16 -1/16 -1/16 -1/16 1/16) This: (polygon-rhythm 3 16 8) also returns 16 points: => (-1/16 -1/16 -1/16 -1/16 -1/16 1/16 -1/16 -1/16 1/16 -1/16 -1/16 1/16 -1/16 -1/16 -1/16 -1/16) What is the role of the first and 3rd arguments to this function? Next: What does the keywo…
-
- 7 replies
- 1.8k views
- 1 follower
-
-
dear all here's an example (from my current work)... this little video shows how i generate/display SCORE (instrumental parts) on a screen + virtual conductor (piano part). the example is "nonsense", but shows how it looks/works... you see the bars (generating), the cue, beat... and the arrow (that shows you where to read/play) ...also you hear some bad (sry) sound-simulation of the setup. in this way i can generate a whole piece in realtime on STAGE (all musicians will read their part from their own screen). this one will be for 5 instruments, ePlayer and modular synthesizer. during the performance an algorithm (or some data-streams) w…
- 5 replies
- 4.2k views
- 1 follower
-
Hi, Is it possible to change the offset from find-everyother somehow? (find-everyother 2 '(1 2 3 4 5 6)) --> (1 3 5) like this: (find-everyother 2 '(1 2 3 4 5 6) :offset 1) --> (2 4 6) thanks!
- 2 replies
- 3.8k views
- 1 follower
-
I like how the function unfold allows for rather concisely expressed transformations. I also like that with this function, methods can easily by commented out or added without changing the nesting structure of the overall Lisp program. However, what I do not like is that the unfold methods don't support any further arguments, and as a result the required preliminary work with def-unfold-set is rather cumbersome. So, I rolled by own version of unfold that addresses this shortcoming. This new function works as follows: you can use the names of arbitrary Opusmodus functions, as long as they expect an OMN sequence as first argument. The following example applies…
- 8 replies
- 4.6k views
- 2 followers
-
Dear All, I´m creating some permutations and I´d like to assign a text under each note to make clear the use of certain intervals. substitute-map '(T 2M 3M 4J 5J 6M 7M) '(c3 d3 e3 f3 g3 a3 b3) '(c3 d3 e3 f3 g3 c3 c3 c3 g3 c3 c3 d3)) But in the evaluation, I get this: (t 2m 3m 4j 5j t t t 5j t t 2m) With lowercase letters, I get 2m , 3m and 5J instead of 2M, 3M and 5J (uppercase names of intervals). Since I want it for pedagogical reasons, can it be generated with the corresponding UPPERCASE letters ? Thanks in advance. All the best, Julio
- 2 replies
- 2.7k views
-
Hi, In the docs it says that arp-adlib makes an arpeggio up or down randomly, but there are only arps upward, what am I missing? thanks! (setf arp '(c4d4e4g4a4b4d5fs5 arp-adlib c4d4e4g4a4b4d5fs5 arp-adlib c4d4e4g4a4b4d5fs5 arp-adlib c4d4e4g4a4b4d5fs5 arp-adlib c4d4e4g4a4b4d5fs5 arp-adlib c4d4e4g4a4b4d5fs5 arp-adlib c4d4e4g4a4b4d5fs5 arp-adlib c4d4e4g4a4b4d5fs5 arp-adlib c4d4e4g4a4b4d5fs5 arp-adlib))
- 2 replies
- 2.7k views
-
In the video "Opusmodus Parametric Composition" by Jorvd, from 2019-12, at 11:10, he demonstrates using harmonic-path to combine a melody and chords. I entered this code to match the video, and it didn't work for me. Here's what he showed: (setf chords '(c3g3c4ds4 gs2f3c4d4 c3g3c4ds4 gs2f3c4d4 c3g3c4ds4 d3g3b3f4 c3g3c4g4 d3f3c4gs4 ds3g3c4g4 cs3g3as3f4 ds3a3c4fs4 fs3a3c4ds4 c3g3c4ds4 g2g3b3d4 gs2f3c4d4 b2d3f4 c3g3c4ds4 f3gs3c4d4 g2g3b3d4 c3ds3g3ds4 as2e3g3g4 f2f3c4gs4 g2g3b3d4 cs3g3as3f4 b2g3d4g4 c3g3c4ds4 f3gs3c4f4 g2g3b3d4 gs2ds3c4gs4 gs2ds3c4gs4 as2as3d4f4 ds3as3…
- 5 replies
- 3.2k views
- 1 follower
-
Dear All, One interesting thing that could be implemented as a function could be a form of generating Negative Harmony. In the video below, there are some explanation of what it is and the origin in the Levy book. It was a trendy topic due to the Jacob Collier interview. And there are a lot of fun videos making versions of pop tunes using negative harmony. The way I understand it, it is simply a kind of mapping notes in relation to an axis, like in the figure below. So we need a function that could map a note in any register to another note in the closest register to the first on. So, any C note will be mapp…
- 9 replies
- 9.9k views
- 1 follower
-
Hi, I don't understand the result of harmonic-path, as I understand it, it should be (something like): (eb4 g4 bb4 d4 gs4 c4 eb4 fs5 b5 bb5 ds5 fs5 b5 d5 g4 b4 eb4 g4 bb4 g4) below is the evaluation and I don't understand it, what am I missing..? (harmonic-path '(eb3g3bb3d4 gs3c4ds4fs4 b3ds4fs4bb4 g3b3d4fs4) '(c4 d4 e4 f4 g4 a4 b4 c5 d5 e5 f5 e5 d5 c5 b4 a4 g4 f4 e4 d4)) ==>(eb4 g4 bb4 d4 gs4 c4 eb4 fs5 b5 bb5 eb5 g5 bb5 d5 gs4 c4 eb4 fs4 b4 bb4) It seems that I am overlooking something obvious, so I'am greatful for some help! Thanks!
- 2 replies
- 2.6k views
-
Dear Friends, I´m interested in the 4-note combinations of the diatonic scale without repeating elements. (combination2 4 '(c3 d3 e3 f3 g3 a3 b3)) The filter-repeat and the remove-duplicates are not giving the right result. PARTIAL RESULT,,, combination2, size: 4 ((b3 b3 b3 b3) (a3 b3 b3 b3) (g3 b3 b3 b3) (f3 b3 b3 b3) (e3 b3 b3 b3) (d3 b3 b3 b3) (c3 b3 b3 b3) (b3 a3 b3 b3) (a3 a3 b3 b3) (g3 a3 b3 b3) (f3 a3 b3 b3) (e3 a3 b3 b3) (d3 a3 b3 b3) (c3 a3 b3 b3) (b3 g3 b3 b3) (a3 g3 b3 b3) (g3 g3 b3 b3) (f3 g3 b3 b3) (e3 g3 b3 b3) (d3 g3 b3 b3) (c3 g3 b3 b3) (b3 f3 b3 b3) (a3 f3 b3 b3) (g3 f3 b3 b3) (f3 f3 b3 b3) (e3 f3 b3 b3) (d3 f3 b3 b3)…
- 5 replies
- 3k views
-
Hi, For training purposes I'am rebuilding the examples that Stéphane demonstrates in the Karajan Music Tech Conference Video, but the second example throws me an error and I can't find out what I'am missing..thanks for assistance.. (setf thema '(s c4 leg d4 leg e4 leg f4 q g4 ff stacc)) (setf thema.repeat (gen-repeat 24 thema)) (setf scales '((c4 d4 e4 fs4 gs4 a4 b4)(c4 d4 eb4 f4 g4 ab4 bb4))) (setf path (tonality-series (chordize scales) :closest '(down))) (setf thema.harm (tonality-map path thema.repeat)) > Error: Incorrect keyword arguments in (:scale ((c4d4e4fs4gs4a4b4) :closest down :ambitus piano) ((c4d4eb4…
-
- 4 replies
- 3.4k views
-
-
Can I assign integer to attribute, for e.x integer to attribute?
-
- 6 replies
- 3.7k views
-
-
Hi, Newcomer here, please point me to resources if I'm missing something obvious. Here is a function that substitutes attributes when they are combined. Is there an easier way of doing this? Thanks! (defun attribute-substitution (new old list-of-attributes) (mapcar (lambda (list) (join-attributes list)) (substitute-map new old (mapcar (lambda (attr) (disjoin-attributes attr)) list-of-attributes)))) (attribute-substitution 'pizz 'arco '(ten+arco pizz arco)) => (ten+pizz pizz pizz)
- 2 replies
- 2.6k views
-
I understand that the first argument value in the ambitus-chord function represents the outer-interval size measured by an integer or a list of integers. What does the second value in the size argument list affect when processing two [or more] chords, as illustrated in the example below? Is the second value affecting the second chord in the first list or both chords in the second list? Thank you! (ambitus-chord '(14 6) '((eb4c6 c4fs4 b4) (c4b4 b3eb5b3)))
-
- 1 reply
- 2.7k views
-
-
After a short break, I'm slowly coming back to Opusmodus, mainly by working through functions examples. Looking at the gen-ambitus-series function example below, would someone be willing to explain why the ambitus function is not producing all diatonic pitches included in list_? I understand that I may want to use harmonic-path or similar instead, but I just wanted to ask for the learning experience. I feel like I might be missing something so I welcome the feedback! (setf range_ (gen-ambitus-series '(-10 30) (vector-smooth 0.2 (gen-white-noise 6 :seed 23)) (vector-smooth 0.2 (gen-white-noise 8 :seed 24)))) (integer-to-pitch ran…
- 4 replies
- 3k views
-
Hi, I'am examine 'harmonic-path more closly and have some hard time to understand, if someone could please explain some things to me.. (setf chord '(c3 g3 c4 e4 f3 c4 f4 a4)) (setf melodytest '( c4 cs4 d4 e4 f4 fs4 g4 gs4)) (harmonic-path chordtest2 melodytest :octave 'path ) ==>(c3 g3 c4 e4 f3 f4 a4 c3) in the example above harmonic-path is obviously swallowing the recurring notes (and is looping the path although the doc says the default is looping nil), why, I don't get the logic behind it? And can I change this? In the example below there is no difference in the output between :loop t or :loop nil, I assumed that the l…
- 3 replies
- 3k views
-
Dear All, Happy New Year I´m back to a lot of work with sets, subsets and supersets and I have an idea/suggestion: When evaluating this (pcs-super-sets 7 (pcs '3-1) :forte) I get this result (7-1 7-2 7-2b 7-3 7-3b 7-4 7-4b 7-5 7-5b 7-6 7-6b 7-7 7-7b 7-8 7-9 7-9b 7-10 7-10b 7-11 7-11b 7-z12 7-13 7-13b 7-14 7-14b 7-15 7-16 7-16b 7-z17 7-z18 7-z18b 7-19 7-19b 7-20 7-20b 7-21 7-21b 7-22 7-23 7-23b 7-24 7-24b 7-25 7-25b 7-26 7-26b 7-27 7-27b 7-28 7-28b 7-29 7-29b 7-30 7-30b 7-33 7-z36 7-z36b 7-z37 7-z38 7-z38b) These are all the supersets of cardinality 7 of the 3-1 set. Would be very nice in this context to have a keyword to invert th…
- 3 replies
- 2.9k views
-
In my Dissertation, I worked a way to convert every chord and set in a modulo 12 rhythm, so the entire catalog of FORTE are converted to rhythms, following the steps of Babitt: As a hardcore serialist, Babbitt was interested in converting 12-tone rows to rhythms, in a kind of 12-tone rhythm theory. Below, Wuorinen show one example of a typical Babbitt idea: For the sake of explaining my idea of function, it's important to have in mind that for Babbitt, the order of the row is very important and lead to different results in the pitch to rhythm conversion. Take a look in the example below: …
- 40 replies
- 16.8k views
-
I'm not an expert in Neo-Riemannian Theory at all but as a consequence of my Common Lisp study and writing of some functions to do Diatonic Neigbour Tones and Leading Tones, I bumped into this and it's kind of what I'm trying to accomplish musically. Does Opusmodus have functions for this (implicitly or explicitly) or does anyone know of a Common Lisp library that is already specialized in Neo-Riemannian transformation? Basically the ability to do P R and L motions using elegant functions and calculating the shortest modulation (shortest Tonnetz steps) from any triad to any other triad. One of the many explanations on youtube:
- 24 replies
- 16.3k views
-
Hi there, i'm a excited beginner with OM! Just exploring and modifying the turotials. One Question: What would be a good approach to sort the notes which are generated from the snippet below to, say, a scale. In other words: The outoot below is chromatic. How can i turn it into a scale, eg. d-phrygian) Thank you! (setf size 60) (setf vector (gen-sine size 1 '(0.5 0.4 0.3 0.6) :modulation (gen-sine size 1 0.3 :phase 180))) (setf pitchvec (vector-to-pitch '(g1 g6) vector))
- 3 replies
- 2.6k views
-
This caused a hanging (not responding) crash. I don´t know why... THIS CRASHES (setf padrao '(7 -1 -5 4 -3 2 12 -16)) (setf pitches (gen-sieve '(c4 e6) padrao :type :pitch)) THIS DON´T CRASH (setf padrao '(7 -1 -5 4 -3 2 12 -15)) (setf pitches (gen-sieve '(c4 e6) padrao :type :pitch))
- 3 replies
- 2.4k views