Jump to content

marqrdt

Members
  • Posts

    21
  • Joined

  • Last visited

Reputation Activity

  1. Like
    marqrdt reacted to opmo in Fuction for sequence polarity   
    Is this what you are looking for:
     
    (defun polarity (seq &key sum)   (do-verbose ("polarity")     (flet ((polarity-i (in-seq)              (let ((integers (if (omn-pitchp (car in-seq)) (pitch-to-midi in-seq) in-seq)))                (when (equal (length integers) 0)                  return 0                  )                (let ((accum 0) (int-pairs (interval-class integers)))                  (mapcar (lambda (x) (when (evenp x) (incf accum) )) int-pairs)                  (/ (* accum 1.0) (- (length integers) 1))                  ))))       (let ((result (loop for i in (lists! seq)                           collect (polarity-i i))))         (if sum (/ (find-sum (flatten result)) (length result)) result))))) (polarity '(1 3 6 4 2)) => (0.75) (polarity '((c4 e4 c3 ds4 b5) (c4 cs4 d4 ds4 f4))) => (0.75 0.25) (polarity '((c4 e4 c3 ds4 b5) (c4 cs4 d4 ds4 f4)) :sum t) => 0.5  
  2. Like
    marqrdt got a reaction from Stephane Boussuge in Fuction for sequence polarity   
    OMers,
    I wrote this function and use it in my composition work. Please feel free to steal use it. It returns the "polarity" of a sequence, defined as the ratio of consecutive uneven and even interval classes (IC) in a sequence. I use this as a way of testing if a generated sequence contains a balanced mix of even or uneven ICs.
     
    (defun polarity (in-seq)     (when (equal (length in-seq) 0)       return 0       )     (let((accum 0) (int-pairs (interval-class in-seq)))       (mapcar (lambda (x) (when (evenp x) (incf accum) )) int-pairs)       (/ (* accum 1.0) (- (length in-seq) 1))       )     )  
    Some examples:
    ;; The polarity of a chromatic scale is 0.0, as there are no even interval classes.
    OM 9 > (polarity '(0 1 2 3 4 5 6 7 8 9 10)) 0.0  
    ;; The polarity of a whole-tone scale is 1.0, as there are no uneven interval classes.
    OM 10 > (polarity '(0 4 8 2 6 10)) 1.0  
    ;; The polarity of a chromatic scale is 0.0, as there are no even interval classes.
    OM 9 > (polarity '(0 1 2 3 4 5 6 7 8 9 10)) 0.0  
    ;; The polarity of a sequence of alternating even and uneven ICs is 0.5.
    OM 14 > (polarity `(0 6 11 5 10 4 9 3 8 2 7 1 6)) interval-class  
    Right now it only works on sequences of numbers and there's no error handling. I would appreciate very much any advice on a concise and OM-ian way to extend it to accepts either integers or pitch symbols like '(c4 fs4 b4 f5 bb5).
     
    Thanks!
    Paul Marquardt
     
  3. Like
    marqrdt got a reaction from opmo in Fuction for sequence polarity   
    OMers,
    I wrote this function and use it in my composition work. Please feel free to steal use it. It returns the "polarity" of a sequence, defined as the ratio of consecutive uneven and even interval classes (IC) in a sequence. I use this as a way of testing if a generated sequence contains a balanced mix of even or uneven ICs.
     
    (defun polarity (in-seq)     (when (equal (length in-seq) 0)       return 0       )     (let((accum 0) (int-pairs (interval-class in-seq)))       (mapcar (lambda (x) (when (evenp x) (incf accum) )) int-pairs)       (/ (* accum 1.0) (- (length in-seq) 1))       )     )  
    Some examples:
    ;; The polarity of a chromatic scale is 0.0, as there are no even interval classes.
    OM 9 > (polarity '(0 1 2 3 4 5 6 7 8 9 10)) 0.0  
    ;; The polarity of a whole-tone scale is 1.0, as there are no uneven interval classes.
    OM 10 > (polarity '(0 4 8 2 6 10)) 1.0  
    ;; The polarity of a chromatic scale is 0.0, as there are no even interval classes.
    OM 9 > (polarity '(0 1 2 3 4 5 6 7 8 9 10)) 0.0  
    ;; The polarity of a sequence of alternating even and uneven ICs is 0.5.
    OM 14 > (polarity `(0 6 11 5 10 4 9 3 8 2 7 1 6)) interval-class  
    Right now it only works on sequences of numbers and there's no error handling. I would appreciate very much any advice on a concise and OM-ian way to extend it to accepts either integers or pitch symbols like '(c4 fs4 b4 f5 bb5).
     
    Thanks!
    Paul Marquardt
     
  4. Like
    marqrdt reacted to opmo in Happy New Year 2024   
    Best wishes to you all, happy coding and Happy New year.
     
    Janusz
     
    P.S. Opusmodus AI expert 🙂



  5. Like
    marqrdt reacted to opmo in Apple M1 Arm processor?   
    We have started porting Opusmodus to LispWorks. The Apple Silicon processor support is on its way 🙂
    Windows PC version will follow.
  6. Like
    marqrdt reacted to opmo in Variations on Variations (2019)   
    Variations on "Webern Variationen Fuer Klavier Op.27, I" (2019) by JP
     
       
     
     
    Instrument: VSL Steinway D
  7. Like
    marqrdt reacted to opmo in How to extend the system with your own functions   
    The first thing you need to do is to create a source file (.opmo or .lisp).
    Give the file a name eg. Custom functions.opmo.
    This file will now be the source file for your functions, make sure the functions are working and that there are no errors.
    Save the file into the ~/Opusmodus/Extensions folder.
     
    The next step is to document the functions that you have created.
    Go to the ~/Opusmodus/System Library folder and create a new folder for example Custom Function.

    This folder is where you will place your (TextEdit) .rtfd system library documents (the best way to create a new document is to copy the contents of one of the System Library’s documents and paste it into the newly created .rtfd file).
     
    Now replace the function name i.e. variables, values etc… with your own examples and documentation. Each function must have its own document. Place the documents into the ~/Opusmodus/System Library/Custom Function folder.
     
    The last step is to create a new file that must be named contents.opmo and place it into the same folder.
    The form of the contents.opmo file should be written as follows:
     
    ;;; Custom functions (foo1 "here you write short note about the foo1 function") (foo2 "here you write short note about the foo2 function")
    The next time you start the application you should be able to use and see your function documents in the ’System Library’ utilities panel.
  8. Like
    marqrdt reacted to Stephane Boussuge in The Planet   
    Ambient soundtrack, thanks to gen-controller function for the algorithmic parameters automation ;-)

     
    SB.
  9. Like
    marqrdt reacted to opmo in Selection from lists of varying lengths   
    and/or
    (matrix-transpose '((1 3 5) (2 4 6))) => ((1 2) (3 4) (5 6)) (setf mat1 '(c4 db4 ab4 f4 g4 bb4 a4 eb4 b4 e4 d4 gb4)) (setf mat2 '(db4 ab4 f4 g4 bb4 a4 eb4 b4 e4 d4 gb4 c4)) (gen-combine mat1 mat2) => ((c4 db4) (db4 ab4) (ab4 f4) (f4 g4) (g4 bb4) (bb4 a4) (a4 eb4) (eb4 b4) (b4 e4) (e4 d4) (d4 gb4) (gb4 c4)) (gen-combine '(a a a a) '(b b b) '(c c) :rest t) => ((a b c) (a b c) (a b) (a)) (gen-combine '(a a a a) '(b b b) '(c c) :revolving t) => ((a b c) (a b c) (a b c) (a b c))  
  10. Like
    marqrdt reacted to Stephane Boussuge in Selection from lists of varying lengths   
    May be this could help:
     
    (setf source '((c4 d4 e4) (f4 g4 a4 b4) (cs4 ds4 fs4 gs4 as4))) (interleave-map '((1 1 1)(1 1 1)(1 1 1)) source) SB.
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy