Function Examples
Functions, arguments, values and results
297 topics in this forum
-
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.9k views
-
I'm thinking about the formal conditions of the diatonic transposition. It may seem trivial, but actually is much more difficult than it appears. I think that modelling tonality and diatonic stuff is far more difficult than the 12-tone operations. One of the things I think is that in diatonic transposition you need to inform more to the machine, a kind of axis point or map, because the transposition of each degree is going to be different. In the case of the diatonic set, the MyHill property assures that each diatonic distance will be in exactly 2 sizes. Seconds: major and minor; Thirds: major and minor; Fourths: perfect a…
- 6 replies
- 3.4k views
-
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.9k views
-
Is there a function like group-list in PWGL: SYSTEM GROUP-LST (LIST GROUP-LENS): groups list into subsequnces, where group-lens indicates the length of each sublist. group-lens can be a number or a list of numbers. If list is not exhausted by group-lens, the last value of group-lens will be used as a constant until list has been exhausted. (group-lst lis '(1 2 3 4 5 6 7 8 9 10) '(2 3 5)) ; => ((1 2) (3 4 5) (6 7 8 9 10)) (group-lst lis '(1 2 3 4 5 6 7 8 9 10) '(2 3 4)) ; => ((1 2) (3 4 5) (6 7 8 9) (10))
-
- 1 reply
- 1.8k views
-
-
Dear All, HAPPY 2018 !! With the new PCS organization in Opusmodus is possible to implement a concept of my book, called Combinatorial Voiceleading of Hexachords. From a Hexachord Set, is possible to find 10 different ways to combine the notes in the for of voice-leading sets. Each hexachord is divided in (3 + 3) way. This expression: (setf hexavl (mclist (chordize-list (integer-to-pitch (remove-duplicates (sort-asc (gen-divide 3 (flatten (permute (pcs '6-32))))) :test #'equal))))) Will result in this combination of the 6-32 hexachord, si…
-
- 0 replies
- 2k views
-
-
I need a function to filter the Permutations. For example: (gen-divide 2 (flatten (permute (pcs '4-1)))) Will result in: ((0 1) (2 3) (0 1) (3 2) (0 2) (1 3) (0 2) (3 1) (0 3) (1 2) (0 3) (2 1) (1 0) (2 3) (1 0) (3 2) (1 2) (0 3) (1 2) (3 0) (1 3) (0 2) (1 3) (2 0) (2 0) (1 3) (2 0) (3 1) (2 1) (0 3) (2 1) (3 0) (2 3) (0 1) (2 3) (1 0) (3 0) (1 2) (3 0) (2 1) (3 1) (0 2) (3 1) (2 0) (3 2) (0 1) (3 2) (1 0)) But I don't mind with the order, since I'll make chords out of it, so ((0 1) (2 3) or (0 1) (3 2) or (1 0) (2 3) will result in the same chord. How to filter the list onto a list where th…
- 3 replies
- 2.1k views
-
Are rewrite-lsystem and its friends based on L-Lisp by Knut Arild Erstad (Erstad, 2002; http://www.ii.uib.no/~knute/lsystems/llisp.html) If not, they look and work surprisingly similar. For example, I can just use complex examples as the following from Erstad's documentation, and they work in OM. ;; Mycelis muralis (from ABoP, p. 87--90) (defclass mycelis (l-system) ((axiom :initform '((I 20) Fa (A 0))) (ignore-list :initform '(+ /)) (homomorphism-depth :initform 10) (frame-delay :initform 0.5) (frame-list :initform '((0 100))) (limits :initform '((-2 -1 -1) (2 14 1))))) (defmethod l-productions ((ls mycelis)) (choose-production ls …
-
- 4 replies
- 2.5k views
-
-
Dear Friends, I'm working with pcs now. A lot of pcs have inverted forms. For example: Pcs 3-11 correspond to the minor triad (037) and also the major triad (047) since both have the same interval vector. But when I evaluate the expression below, I get only the prime form (037) and not the IF (047). Is it possible to retrieve also the inverted form, like the example below ? (setf pcset (pcs '3-11)) >> (0 4 7) ??? Thanks a lot
- 21 replies
- 5.5k views
-
Dear Friends, When working in my patches in Pure Data, one of the things I implemented back then was a function similar to Lenght-Weight. I'm searching for something like this example. 1) Take a duration sequence, for example '(s e s) used as span in OMN way, i.e., aligning the materials with the longer list of pitches. 2) Take any pitch sequence, like for example '(c4 d4 e4 f4 g4 a4 b4 a4 g4 f4 e4 d4), gen-repeat 10 times This example could result in a ascending and descending scale with the constant rhythmic pattern (s e s). I'm thinking in a function that could put some rests in this pattern, according to …
- 1 reply
- 1.8k views
-
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
- 2.5k views
-
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.6k views
-
Hi Everybody I found a great app to upload and share your music here is the address you can test it it is much better and classy than Soundcloud https://octave.is/pmimran/privatealbum/patrick%40mimran.com/em2XkPshTa Patrick Mimran
-
- 0 replies
- 1.2k views
-
-
Stephane Boussuge wrote on 23 October > your edit-omn function is definitively super-mega useful !! I updated my function edit-omn. Remember that this function is for turning relatively simple functions processing some OMN parameter sequence (e.g., pitch or length lists) quasi automatically into much more expressive functions processing arbitrary OMN expressions, including nested expressions, and automatically supporting typical Opusmodus arguments like section and flat. I now added support for creating functions with 'dynamic' arguments, i.e. arguments where different values are used for processing different sublists of OMN expressions. Fo…
- 2 replies
- 1.7k views
-
Hello, I'm aware of pcs-analysis (which prints data), but I'm looking for a way to collect lists of Forte-style interval vectors into a data structure in order to query them for similarity and difference. Something like: (get-interval-vector '3-1) -> (2 1 0 0 0 0) Is there an easy way to do this? thanks, Michael
- 2 replies
- 1.9k views
-
Here is a rather simple function that might be useful for others as well. The function rotate-omn rotates a sequence by the given number of positions, much like gen-rotate. However, you can specify which parameter you want to rotate, whether you want to rotate the flattened sequence or subsequences separately, or only certain subsequences. (setf melody '((-h q c4) (q. f4 e g4 q a4) (h. g4))) (rotate-omn :right melody) ; => ((-h q g4) (q. c4 e f4 q g4) (h. a4)) (rotate-omn :left melody :parameter :length) ; => ((q c4 q. f4 e g4) (q a4 h g4 tie) (q g4 -h)) (rotate-omn 2 melody :section '(1) :flat nil) ; => ((-h q c4) (q. g4 e a4 q f4) (h. g4)…
-
- 0 replies
- 1.6k views
-
-
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
- 2.4k views
-
-
Dear all, I just released a library that makes Rick Taube's Pattern Streams from Common Music (version 2) usable in Opusmodus. If you are interested then follow the link below. https://github.com/tanders/cm-patterns Best, Torsten
-
- 2 replies
- 2.5k views
-
-
Dear all, I released a collection of personal Opusmodus Tools at https://github.com/tanders/tot, together with installation instructions etc. Best, Torsten
-
- 1 reply
- 1.5k views
-
-
Dear Friends, Is there some function that deals with finding the shortest path between, for example, a trichord "a" to a trichord "b" ? In general, how to find the shortest path from a collection of notes (i.e. a chord) "a" to a collection of notes "b" (both in the same cardinality) ? Thanks in advance ! Best ! Julio
- 5 replies
- 2.2k views
-
I'm interested in having a complete list of the more high-level algorithms that Opusmodus supports out-of-the-box. This is what I found going through the integrated help documentation: Lindmayer systems Cellular automata Working with pitch class sets Euclidean Algorithm Tonality mapping Mandelbrot sets Rubin (Rubin functions) Twelve-tone row (including All-interval twelve-tone row and Twelve Tone Forms) Klangreihen technique Trobes (composer Joseph Hauer ) The Time Point System (Babbit) Infinity Series (Nørgård) Messiaen Permutation Stravinsky Ro…
- 12 replies
- 5.9k views
-
In the following line of code, what is the difference between vector and float? (vector-to-velocity 0.1 0.9 (pitch-to-velocity 'pppp 'ffff '(c1 d1 e1 f1 g1 a1 b1 c2 d2 e2 f2) :type :float)) The function name is 'vector-to-velocity' but in pitch-to-velocity the type is set to :float (instead of :vector). Looks like they are synonyms. Thanks in advance, Wim Dijkgraaf added 2 minutes later I guess this is the answer: Vectors are one-dimensional arrays, therefore a subtype of array. Wim :-) added 7 minutes later Code above being equal to: (pitch-to-velocity 'pppp 'ffff '(c1 d1 …
-
- 0 replies
- 1.4k views
-
-
Hi, how can I do to emulate this wonderful Fibonacci function in Symbolic Composer, great to create "background" patterns. 'cause the Fibonacci in OM handle just numbers, and not musical events. In scom, it was something like that: note1, note2, note2 + note1... Alain
- 5 replies
- 2.5k views
-
Hi, is there any function in OPMOD implementing self-similar algorithm, like those used by Tom Johnson in his great book "Self-Similar Melodies" ? http://repmus.ircam.fr/_media/mamux/saisons/saison06-2006-2007/johnson-2006-10-14.pdf http://www.algorithmiccomposer.com/2011/06/tom-johnsons-self-similar-melodies.html I'm sure they are hidden in the menus... :-) but where ? Alain
- 2 replies
- 2k views
-
Hi everybody, I'm working on different automatic composition projects, involving a lot of random use. Is it possible to "freeze" a complete score, instead of fixing a seed for each "random generator" (rnd-order function) ? I'd like to be in a "push button" situation, listening to a lot of versions and saving only the ones really working. I can do that by saving the score as a pdf and exporting a midifile for each instance, but it would be wonderful to just save the opmo files for further processing. Thanks for your help and suggestions. Alain
- 5 replies
- 2.2k views
-
For generating a harmonic rhythm, I needed to merge notes that are tied. If extracting only the length values with omn directly, then all ties are lost. (omn :length '((h c4 pizz q arco+tie) (q h tie) (h.))) => ((1/2 1/4) (1/4 1/2) (3/4)) So, I wrote myself a function that merges the lengths of tied notes. (lengths-with-merged-ties '((h c4 pizz q arco+tie) (q h tie) (h.))) => (1/2 1/2 5/4) The definition is below. Best, Torsten (defun lengths-with-merged-ties (sequence) "Returns a flat list of lengths that preserves the lengths in sequence including their tied notes. Ex…
- 3 replies
- 2.1k views