Function Examples
Functions, arguments, values and results
265 topics in this forum
-
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
- 11.4k 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.1k 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
- 1.9k views
-
;;; ...an idea ;;; how to import some TEXT and translate it to integer-sequences to use this data ;;; for LIVE-CODING. also possible without .txt, but i tried to IMPORT it. perhaps ;;; in your live-coding session a friend of you is writing the text in a different ;;; location and you could share it (the path) via CLOUD :-D ;;; i know, this kind of data... is not very smart, but a little bit steam-punky :-) (defparameter *map-integer1* '(((a à á â ĂŁ ä ĂĄ æ Ä…) 0) (b 1) ((c ç ć) 2) (d 3) ((e è Ă© ĂŞ Ă« Ä™) 4) (f 5) (g 6) (h 7) ((i ì Ă® ĂŻ) 8) (j 9) (k 10) ((l Ĺ‚) 11) (m 12) ((n ñ Ĺ„) 13) ((o ò Ăł Ă´ õ ö) 14) (p 15) (q…
-
- 0 replies
- 1.1k views
-
-
LISP... any solution? i want to DIVIDE a seq into sublists -> when it's asc into a list, "rest" into single-listed values - thanx a lot for some help 🙂 ;;; input (divide* '(14 12 3 13 15 8 4 10 17 2 16 0 1 6 7 5 11 9)) ;;; output => ((14) (12) (3 13 15) (8) (4 10 17) (2 16) (0 1 6 7) (5 11) (9))
- 2 replies
- 1.5k views
-
;;; a little extension for lsystems, i needed all generations, not only the final one. i think for in-time-processes it's more interesting, because you will hear/see the way of "growing/developing" ;;; perhaps JANUSZ could extended the original OPMO-function. keep attention about stack-overflow if you have LARGE DEPth :-) ;;; function (defun all-gen-lsystem (ls &key depth ) (loop repeat (1+ depth) for i from 0 to depth collect (rewrite-lsystem ls :depth i))) ;;; setup (defclass sieve_1 (l-system) ((axiom :initform '(1)) (depth :initform 10))) (defmethod l-productions ((ls sieve_1)) (choose-production ls …
- 8 replies
- 2.1k views
-
Dear All, I´m doing some melodic permutations and I have a question about replace-map: Here are four elements permutations, generated by: (permute '(1 2 3 4)) (setf permut4 '((1 2 3 4) (1 2 4 3) (1 3 2 4) (1 3 4 2) (1 4 2 3) (1 4 3 2) (2 1 3 4) (2 1 4 3) (2 3 1 4) (2 3 4 1) (2 4 1 3) (2 4 3 1) (3 1 2 4) (3 1 4 2) (3 2 1 4) (3 2 4 1) (3 4 1 2) (3 4 2 1) (4 1 2 3) (4 1 3 2) (4 2 1 3) (4 2 3 1) (4 3 1 2) (4 3 2 1))) Here are the pitch material to be permutated: (setf permutcontent '((1 cs4) (2 d4) (3 e4) (4 g4))) I used the REPLACE MAP FUNCTION, like this: (replace-map permut…
- 2 replies
- 1.5k views
-
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.2k views
-
Parsimonious Voice Leading (again): attempts to provide an algorithm In a previous post I deleted, I was trying to find a good way to ensure the minimal parsimonious Voice-Leading (VL) between a sequence of chords. In this post I will try to explain my second attempt. Let's take a look at a sequence of chords, spreaded out almost in a random way, with no VL (setf chordstovl2 '(b3eb5g3 cs6e7gs3 b4f5g6 f7e5c2 d4f7e4 gs7e2a8) Let's specify and evaluate a variable for the number of voices used: (setf voices 3) Let's try to think the best way to connect this pitches with minimal movement. I will apply the following expression to ensure a be…
- 23 replies
- 5.1k views
-
Dear All, I'm trying to find a loop for making substitutions in a list, for changing the ranges of a list of pitches. SOME PITCHES (AND WHAT TO CHANGE) (setf pitches '(c4 d4 e4 c4 eb4 f4 c4 eb4 eb5)) (setf i '(c4 eb4)) This will take out the range of the notes, i.e., c4 db5 will became c db (defun convert-pitch (pitches) (loop for i in pitches when (pitchp i) collect (compress (butlast (explode i))) else collect i)) Setting a variable for pitches without range indication (pitnorng) and a new range list (setf pitnorng (convert-pitch pitches)) (setf rangelist '(4 5 3 6 4)) Function t…
- 11 replies
- 2.7k views
-
In the jazz world, Barry Harris came up with the idea of harmonizing a bebop scale. Combining a C6 (C, E, G, A) and a Bdim7 (B, D, F, Ab) chords, we have this scale: From this stantpoint we can alternate tonic and dominant sounds, like this: Every pair of chords have all the 8-note set. The notes C,E, G and A are always harmonized with a C6 chord. The notes D, F, Ab and B are always harmonized with a Bdim7 chord. So, from the point of view of sets, there is no problem. WHAT IS NEEDED: I want a way to start FROM the melody, and then make a four part block harmonization with t…
- 10 replies
- 3k views
- 1 follower
-
if you like to change dynamics/velocity of specific lengths (defun replace-velocity-of-a-length (omnseq length/velocity-map) (loop for i in (single-events (flatten omnseq)) when (length-restp (car i)) collect i else append (omn-replace :velocity (cadr (assoc (car (omn :length i)) length/velocity-map)) i))) (setf omn-seq '(s c4 ffff e e s e. s q q q q q)) (replace-velocity-of-a-length omn-seq '((1/16 mp) (2/16 pp) (3/16 ppp))) => (s c4 mp e c4 pp e c4 pp s c4 mp e. c4 ppp s c4 mp q c4 ffff q c4 ffff …
- 2 replies
- 1.4k views
-
if you like to change the articulation of specific lengths (defun replace-articulation-of-a-length (omnseq length/articulation-map) (loop for i in (single-events (flatten omnseq)) when (length-restp (car i)) collect i else append (omn-replace :articulation (cadr (assoc (car (omn :length i)) length/articulation-map)) i))) (setf omn-seq '(s c4 ffff ord e ord e ord s ord e. ord s ord q ord q q q q)) (replace-articulation-of-a-length omn-seq '((1/16 mute) (2/16 pizz) (3/16 arco))) => (s c4 ffff mute e c4 ffff pizz e c4 ffff pizz s c4 ffff mute e. c4 ffff arco s c4 ffff mute q c4 fff…
- 2 replies
- 1.4k views
-
Dear Friends, What is the exact opposite function of length-legato ? Lenght-legato turns this: onto this: I want exactly the reverse: Changing this: to this: Thanks for help ! Best ! Julio
- 13 replies
- 3.3k views
-
Dear Friends, I need some help on functions related to more control over 12-tone rows, specially the interval content. For example, below there are Berg's Lyric Suite 12-tone Row. This is an example of all interval series, a combination of every interval. Please, check this: https://en.wikipedia.org/wiki/All-interval_twelve-tone_row This All interval series are very interesting harmonically, since it produces very consonant trichords. 1) I'd like to control the building of the 12-tone rows, in relation to it's properties to get more control over the harmonic output. What are the methods an…
- 4 replies
- 2.1k views
-
Dear Friends, 1) How to convert a given length series in a binary series ? For example: ((1/16 -3/16 1/16 -1/8 1/16 -1/4)) with 1/16 as a base could be transformed in binary like: (1 0 0 0 1 0 0 1 0 0 0 0) and/or 2) How to convert a length 3/16 in 1/16 -1/16 -1/16, i.e. a kind of length conversion based on quantize. 3/16 could be converted in 1/16 -1/16 -1/16 or 1/32 -1/32 -1/32 -1/32 -1/32 -1/32 depending on the value regarded as the reference (1/16 in the first case or 1/32 in the second) Thanks ! Julio Code example (setf ccpa1 (omn :length (length-stacc…
- 2 replies
- 1.5k views
-
Sometime ago, I was searching for a function that would be the exact opposite function of length-legato. Lenght-legato turns this: onto this: I wanted exactly the reverse: Changing this: to this: In the ocasion, Andre Meier came with this code below: Janusz, do you think a good idea to include a function like this in the library ? Or there is also something similar that I dont know ? I still need it in a easy way... Best, Julio (defun length-staccato (n alist) (let ((newlengths) (new-omn (omn-merge-ties (flatten al…
-
- 0 replies
- 1.6k views
-
-
Dear all, I am working on porting libraries from other algorithmic composition environments so that they are usable in Opusmodus. The library Cluster Engine is a constraint solver for solving polyphonic constraint satisfaction problems where both the pitch and the rhythmic structure can be restricted by an arbitrary number of constraints (rules), and a constraint solver then searches for a solution that is consistent with all constraints. This library supports user-defined rules, and highly flexible ways to control which aspects of the resulting score are controlled by certain rules. For example, you can independently control with compositional ru…
-
- 2 replies
- 2k views
-
-
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
-
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
- 2.9k 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.3k 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.6k 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
- 1.8k 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
- 1.8k 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.2k views
-