Function Examples
Functions, arguments, values and results
264 topics in this forum
-
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.3k views
- 1 follower
Rangarajan replied -
-
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
- 1.6k views
- 2 followers
JulioHerrlein replied -
Hi, I am looking for some functions that support chord progressions. For example, I would like to get the chords in the popular "I-IV-V" sequence in C Major scale. Is there built-in support for such standard progressions in the keys of common scales? Regards, Rangarajan
- 7 replies
- 4.1k views
Rangarajan replied -
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.4k views
- 1 follower
JulioHerrlein replied -
I have a basic lisp question - I'd like to create a function that takes a tonality as its argument and performs something like the following line: (setf test (tonality-map '((pcs '3-2) :root b3 :map shift) (make-scale 'c4 12))) So (defun pitches (tonality) .....) - and then (pitches (pcs '3-2)) would return the list (b3 c4 d4 b4 c5 d5 b5 c6 d6 b6 c7 d7) Thanks so much!
- 7 replies
- 2.5k views
Avner Dorman replied -
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.3k views
- 2 followers
opmo replied -
Sometimes we generate some flow of pitch and lengths that we assemble later into OMN material, It can be tiedous to add manually the articulations particularly the "leg" omn instruction, and it can sometimes be useful to have a technique for automated implementation of part of these task, who it will be always possible to edit more precisely thereafter. Below a possible technique based on the recognition and association of patterns of lengths values with articulation instructions. At first, we define a stream of lengths for our phrase: (setf len '(1/8 1/8 1/16 1/16 -1/16 1/8 1/8 1/8 1/8)) and we generate with the help of the function …
- 7 replies
- 3.1k views
torstenanders replied -
Dear Friends, I'm struggling to find a modulo 12 function Something like this: (mod12 '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 24 48)) returns >> (0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 0 0) Any Hint ? Best, Julio
- 7 replies
- 2.3k views
JulioHerrlein replied -
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.3k views
- 2 followers
JulioHerrlein replied -
In Lesson 4, it is statet that "You can see the LENGTH-WEIGHT replaces previously 'sounding' lengths with rest-lengths throughout the stream of pitches. " But actually Length-Weight INSERTS rests. Sounding pitches are not replaced, but shiftet. Is that correct?
- 6 replies
- 2.1k views
Stephane Boussuge replied -
Is there a function that returns all intervals from a chord? Thanks, Achim
- 6 replies
- 690 views
- 1 follower
erka replied -
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
-
- 6 replies
- 548 views
- 2 followers
opmo replied -
-
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.4k views
- 2 followers
o_e replied -
Dear Friends, I´m searching for a function to make rhythmic displacement of lists and sublists at once. It´s not like rotating, it´s more like displacing all the rhythms by a fixed amount, like transforming this: (-e he. d4 mf e cs4 hs eb4) into this (he. d4 mf e cs4 hs eb4 -e) This means displace all the phrase one 8th note earlier in time. Thank you all ! Best ! Julio
- 6 replies
- 981 views
- 1 follower
JulioHerrlein replied -
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.1k views
- 1 follower
JulioHerrlein replied -
Hello, If I have a list like ( (c4) (cs4d4) (f4) (e4fs4) ), I'd like to modify just the chord sublists so that it shows the root and all inversions of the chord. If I do (chord-inversion 1 '((c4) (cs4d4) (f4) (e4fs4)) :series t :root t ) , I get (((c4) c4) ((cs4d4) d4cs5) ((f4) f4) ((e4fs4) fs4e5)) but I'd want the chord-inversion function to ignore the single note sublists ( e.g. (c4) ) since they aren't chords. So, how would I get a result similar to the below? ( (c4) (cs4d4 d4cs5) (f4) (e4fs4 fs4e5) ) Also, is there a way to identify which sublists have a chord versus just a single note? …
- 6 replies
- 396 views
- 2 followers
opmo replied -
I wonder if it's possible to evaluate a function (that has a seed argument) a set number of times (using gen-loop) with a predefined, custom seed list applied to the function. Something that I'm trying to achieve in the example below. Thank you! (setf seeds (vector-round 1 100 (gen-white-noise 8 :seed 13))) (setf rhythm (gen-loop 8 (euclidean-rhythm 16 4 16 's :type 2 :seed seeds)))
- 6 replies
- 1.5k views
- 2 followers
NagyMusic replied -
Can I assign integer to attribute, for e.x integer to attribute?
-
- 6 replies
- 3.1k views
dsyk replied -
-
I sometimes like to turn certain notes into rests. The built-in function length-rest-series is great for that, but it only works with lengths, not full OMN expressions. So, I generalised that function. I can do now, e.g., the following. (setf melody '((s eb6 < leg f5 < leg c5 < leg f5 < leg) (e e6 f - -q))) (note-rest-series '(1 1) melody :swallow T :section '(0)) ; => ((-s - c5 < leg f5 < leg) (e e6 f - -q)) Note that in contrast to the original function length-rest-series, the new function note-rest-series does not only support OMN expressions, but also extra arguments like swallow and section. The defi…
-
- 6 replies
- 2k views
lviklund replied -
-
Dear friends, I'm still learning. This is a simple thing. How can I put inside a function the name of a variable, like the example below. I want to do this: (gen-binary-row 12 '(0 2 5 7 8 11)) >> (1 0 1 0 0 1 0 1 1 0 0 1) But in this way: (setf binrow '(0 2 5 7 8 11)) (gen-binary-row 12 '(binrow)) What am I missing ? Thanks for help. Best, Julio
- 6 replies
- 2.1k views
JulioHerrlein replied -
Dear, All I need a function for shuffle elements. A function similar to URN in Pure Data. The scenario: 1) I have a list of durations: s s -s s s -s -s -s e -s s -s s -e e -e -e s -s 2) The lenghts together form a 6/4 timesignature or a 12/8. 3) Just repeating the rhythm is BORING ! 4) I need variations, but I want to still sum 12/8 or 6/4. 5) So, I need to shuffle this elements, without changing the total of the sum of lenghts. TWO APPROACHES: 1) RANDOM - How to randomize, not like the random sample, but, using each element JUST ONCE, like an Hamiltonian Path ? (Actually…
- 6 replies
- 2k views
JulioHerrlein replied -
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
- 6 replies
- 1.4k views
- 1 follower
opmo replied -
Video about 5-note voicings with drop-voicing function (in portuguese)
- 6 replies
- 784 views
- 1 follower
JulioHerrlein replied -
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.4k views
- 1 follower
JulioHerrlein replied -
Salut, J'aimerais utiliser la fonction omn-to-time-signature directement dans mon code Gr, si quelqu'un peut m'aider. Merci ! ;;;découpe de barre (setf time-signatures (gen-repeat 2 '((2 4 1) (3 4 1)(2 4 1)(2 4 1)(2 4 1))) ;;;11/4 bar trop long (setf Gr (butlast (omn-à-mesurer (make-omn :pitch (omn :pitch (omn-à-mesurer (boucle pour x dans tétra collecter (filtre-répéter 1 (rnd-order x :type :pitch :seed 5))) '(1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4 1/4))) :length (omn :length (omn-à-mesurer …
-
- 6 replies
- 341 views
- 2 followers
david replied -