Jump to content

torstenanders

Members
  • Posts

    489
  • Joined

  • Last visited

Reputation Activity

  1. Like
    torstenanders got a reaction from JulioHerrlein in Controlling the score layout with ps (combining separate instruments with brackets, braces etc.)   
    Thanks! Yes, as I said I know that I can write the following, where rh and lh etc. are standard single-nested OMN sequences. 
    (ps 'my-instrument-set :p (list rh lh)) (ps 'gm :sq (list vl1 vl2 va vc))  
    Perhaps I just need to define some custom function that automatically translates my preferred representation -- where all parts (including rh and lh) are represented individually for simplifying further processing -- into the representation above 🙂 
  2. Like
    torstenanders got a reaction from JulioHerrlein in Controlling the score layout with ps (combining separate instruments with brackets, braces etc.)   
    Just for context: my function preview-score (link to doc) in the tot library -- which was perhaps the inspiration for the later function ps -- expands in the background simply into a call to def-score. In def-score, we can specify a layout of nested brackets, braces etc. separately of the actual music, which is expressed by individual single-nested OMN sequences. The function preview-score retained this separation: individual single-nested OMN sequences on the one hand, and the specification of the nested layout separately. 
     
    By contrast, in the function ps this separation of concerns -- the actual music and the nested layout -- is seemingly gone. The input to ps seemingly must already be nested as required by the layout. That may be more convenient in some situations, but is limiting in others. For example, in a full orchestral score we can have a layout of multiple nesting levels (e.g., brackets for orchestral sections wrapped in "squares" for divisions or the standard combination of the violins in a string section, below is an example). 
    (bracket-group (square-group (violin1-layout 'vl1) (violin2-layout 'vl2)) (viola-layout 'va) (violoncello-layout 'vc) (contrabass-layout 'cb)) Can the function ps handle such nested layouts, or is it only designed for sketches and a full score should be created separately afterwards? In principle, it would be possible with shorthand functions like ps to allow for arbitrary layouts when it expands to def-score in the background (again, as demonstrated by preview-score), but keeping the actual music and the layout separately would likely then be preferable. 
     
    ... I am just trying to make a switch from preview-score to ps to unify efforts, but I don't want to loose too much functionality 😊
     
    I will soon share a version of ps that supports the tot score format (https://tanders.github.io/tot/sources/score.html) so that we can have ps together with various score processing functions.  
     
  3. Thanks
    torstenanders got a reaction from JulioHerrlein in Variant of unfold supporting arbitrary function arguments   
    I provided a variant for unfold that has some advantages (support for arbitrary function arguments instead of a custom symbol for each argument combination set up with def-unfold-set), but I did not say that it would replace it 🙂  In addition to what you said, the unfold function is also baked into your counterpoint function, while this alternative is not. 
     
    > apply the the unfold method to a specific bar
     
    Sure. That also works with this variant, as shown above by using the argument section supported by most OPMO functions.  
     
    (fn-unfold '((tr 12) (ld (2 3) :section 1)) mat)
     
    > even to an event
     
    Yes, that is something currently not supported by the alternative fn-unfold (except individual functions would support it). As you can see, the definition of fn-unfold is pretty short, more stuff could be added, if we want to. 
     
    > Why so may users do not read/examine the function documentation.
     
    Actually, I was aware of that, which is why I included an example showing the same feature (applying a specific function only to a certain bar) in my original post 😊
  4. Like
    torstenanders got a reaction from Stephane Boussuge in arp-adlib   
    Copied from doc:
     
    The 'arp-adlib' arpeggiation needs special mention because
    it responds to the ordering of pitches in the chord. Look at
    the third list (bar), third chord.
    (-e - a5d5fs4 f c6f5fs4 d5b5g4 arp-adlib
        g5d5a4 gs5ds5gs4 gs5e5gs4)
    Audition this with Cmd-1 (d5b5g4 arp-adlib)
  5. Thanks
    torstenanders got a reaction from JulioHerrlein in Context Sensitive (uppercase) Substitute Map -   
    Common Lisp does usually not distinguish between lower and upper case in its symbols. Standard Common Lisp compilers always return symbols with only upper case therefore by default, but Opusmodus seemingly does internally some trickery to change that to always lower case. 
     
    It is possible with Common Lisp to specify symbols that distinguish between cases by wrapping the symbol names within bars (|) like so. 
     
    ? '|TesT|
    |TesT|
    ? '(|TesT|)
    (|TesT|)
     
    Unfortunately, this does not to work fully in Opusmodus for all cases, possibly because of the internal symbol trickery that Opusmodus does.
     
    ? '|3M|
    3m
     
    This symbol does not require the bars in standard Common Lisp, because it only contains upper cases. However, the mentioned Opusmodus magic then turns this case down, so therefore this uppercase preservation does not work here. 😶
     
    Summary: if you wrap your symbols in bars and use only symbols that contain both upper can lower case letters or only lowercase letters, the distinction works...
  6. Like
    torstenanders got a reaction from JulioHerrlein in Variant of unfold supporting arbitrary function arguments   
    > can we ... a file with our customized methods with your function?
     
    You can put this function fn-unfold wherever you want, as long as that file is loaded at startup, and likewise also any other function including functions like tr above  🙂
     
    > we can call the specific sets in the unfold function without having to evaluate the complete procedure of each method ?
     
    Questions concerning the original unfold function are better answered by Janusz, I guess... 
     
    Good night (its 23:00 over here...),
    Torsten
  7. Thanks
    torstenanders got a reaction from JulioHerrlein in Variant of unfold supporting arbitrary function arguments   
    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 first the function gen-retrograde and then quantum to the material mat. 
     
    (setf mat '((q c4 d4 e4) (h f4 q b3)))
    (fn-unfold '((gen-retrograde) (quantum :fraction -0.2)) mat)
    => ((7W B3 7H._QT F4 -E..) (E E4 D4 S. C4 -ET))
     
    If you would like to have functions with more concise names (as unfold does), just define functions with shorter names. Here are some examples.
     
    (defun tr (sequence transpose &key (section NIL) (exclude NIL) (ambitus 'piano) (omn NIL))
      "Like pitch-transpose, but sequence as first param."
      (pitch-transpose transpose sequence :section section :exclude exclude :ambitus ambitus :omn omn))
     
    (defun ld (sequence values &key set ignore seed (section NIL) (exclude NIL) (omn NIL))
      "Like length-divide, but sequence as first param."
      (length-divide values sequence :set set :ignore ignore :section section :exclude exclude :omn omn :seed seed))

    With the definitions above, we can now use fn-unfold as follows for computing an octave transposition of mat and then applying length-divide to the second bar with the given settings.
     
    (fn-unfold '((tr 12) (ld (2 3) :section 1)) mat)
    => ((Q C5 D5 E5) (3H E5 FS5 G5 3Q A4 BB4 CS5))
     
    BTW: The definition of fn-unfold is pretty short. By far the longest part of this definition is the doc string 🙂
     
    (defun fn-unfold (fns sequence) "Much like the buildin Opusmodus `unfold`, but instead works with functions and additional arguments can be given to the functions. Apply to `sequence` all fns in order. * Arguments: - fns (list of lists): Each sublist has the form (<omn-fn> &rest <args>), where <omn-fn> is a function expecting an OMN sequence as first argument and arbitrary further argments, and <args> are the further arguments beyond the OMN sequence given to the function. - sequence: OMN sequence * Examples: Some material to use ;;; (setf mat '((q c4 d4 e4) (h f4 q b3))) Remember: all functions used must expect a OMN sequence as *first* argument. ;;; (fn-unfold '((gen-retrograde) (quantum :fraction -0.2)) mat) Some short-hand versions of common functions are defined for conciseness. ;;; (fn-unfold '((tr 12) (ld (2 3) :section 1)) mat) " (reduce (lambda (seq fn) (apply (if (functionp (first fn)) (first fn) (fdefinition (first fn))) seq (rest fn))) fns :initial-value sequence))  
  8. Like
    torstenanders reacted to JulioHerrlein in ps display bug?   
    Great, Janusz !
     
    Or maybe put a user defined filter/map, like the one I suggested. With this, some people may choose a custom defined spelling.
    This is very useful for adapting material, making some scores more readable for performers (all flats, all sharps, tonality map oriented, etc).
     
    By the way, in my humble opinion, I don't think that modes and scales are archaic systems, since even Ligeti in the end of his carreer goes back to diatonic principles (the same is true for Penderecki). There are composers like Arvo Part (with some neomodal "Tintinabulation" stuff), Steve Reich, Terry Riley, and others minimalists that uses triadic and diatonic materiais that can be theorized as modal or tonal. You have jazz oriented guys also, like Kapustin, polystylistic guys, like Schnittke (who mix baroque with avant-garde music in the same Concerto), and many other in between possibilities, including Berio's use of quotation. So, in the contamporary music all tools are avaiable, not only the old-fashioned-historic-vanguard-Darmstad-atonal-Adorno stuff, so diversity and tolerance are important to keep music oxigenated. I know you are open minded guys.
     
    All the best
     
  9. Like
    torstenanders got a reaction from Avner Dorman in Opmo 1.3: Emacs interface (with SLIME) broken?   
    If your goal is for you as a teacher to create documents for your students to read containing Common Lisp and Opusmodus code, and where you want to evaluate the code directly from within that document, then Org mode with embedded Common Lisp + Slime is your friend. This is a very powerful combination, that can automatically create nice slides (with the LaTeX beamer interface), embed music notation (Lilypond) etc. I used this combination for years for teaching, had then all sessions of a course in a single document for easily moving content around etc.
     
    Nevertheless, you likely do not want to introduce your students to use Org mode... For that, Jupyter notebooks (or plain Opusmodus) will be more easy for the students.
     
    Org mode for Emacs – Your Life in Plain Text
    ORGMODE.ORG Org: an Emacs Mode for Notes, Planning, and Authoring  
    Babel: active code in Org-mode
    ORGMODE.ORG  
    However, I don't know of a way to automatically embed music notation output of Opusmodus in Emacs Org mode. What is missing for that, AFAIK, is some Opusmodus function that automatically creates a graphic file for a given snippet or score. If that would be there, that feature shouldn't be too hard to add (other Org mode babel programming language interfaces do already similar things, e.g., Lilypond, and the code for that is freely available).
  10. Like
    torstenanders got a reaction from Stephane Boussuge in Opmo 1.3: Emacs interface (with SLIME) broken?   
    If your goal is for you as a teacher to create documents for your students to read containing Common Lisp and Opusmodus code, and where you want to evaluate the code directly from within that document, then Org mode with embedded Common Lisp + Slime is your friend. This is a very powerful combination, that can automatically create nice slides (with the LaTeX beamer interface), embed music notation (Lilypond) etc. I used this combination for years for teaching, had then all sessions of a course in a single document for easily moving content around etc.
     
    Nevertheless, you likely do not want to introduce your students to use Org mode... For that, Jupyter notebooks (or plain Opusmodus) will be more easy for the students.
     
    Org mode for Emacs – Your Life in Plain Text
    ORGMODE.ORG Org: an Emacs Mode for Notes, Planning, and Authoring  
    Babel: active code in Org-mode
    ORGMODE.ORG  
    However, I don't know of a way to automatically embed music notation output of Opusmodus in Emacs Org mode. What is missing for that, AFAIK, is some Opusmodus function that automatically creates a graphic file for a given snippet or score. If that would be there, that feature shouldn't be too hard to add (other Org mode babel programming language interfaces do already similar things, e.g., Lilypond, and the code for that is freely available).
  11. Like
    torstenanders reacted to opmo in Opusmodus and Emacs-Slime Setup   
    Build-in Slime in Opusmodus coming soon.
    Here is the 'Emacs-Slime Setup.lisp' extension file:
    ;;;--------------------------------------------------------- ;;; SLIME in Opusmodus ;;;--------------------------------------------------------- #! ;;; HOWTO If you're accustomed to Emacs and Common Lisp, you may prefer SLIME, the Superior Lisp Interaction Mode for Emacs, to editing lisp in regular Opusmodus windows and its listener. There are a number of places to get Emacs for MacOS. One that works well is:   https://emacsforosx.com SLIME ships with Opusmodus, in the "/Applications/Opusmodus.app/Contents/Resources/third-party/slime" directory. There are two parts to Slime:   1. Swank, the server, a Common Lisp system, which runs inside      of the Opusmodus App.   2. Slime, the client, which is an Emacs lisp package. To start the Swank server when Opusmodus starts, comment out the (start-swank) form at the end of this file, and restart Opusmodus (or execute (start-swank) in the Listener to do it now, but not next time Opusmodus starts). To load Slime into your Emacs, define the following in your ~/.emacs startup file:   (load "/Applications/Opusmodus.app/Contents/Resources/third-party/slime/emacs-opusmodus.el")   (load-opusmodus-slime) If you want to use the Mac Command key for Emacs meta, instead of the default of the Mac Option key, and make C-o in dired open the file at point, in the Mac application that is assigned for editing that type of file, also add, after that:   (opusmodus-options) Then, restart Emacs, and do 'm-x slime-connect'. For Host, use the default of localhost. For Port, use 4005, or the port you specified in the (start-swank) call. 4005 will likely be the default. With (ignore-errors (slime-connect "localhost" 4005)) in your ~/.emacs startup file, the slime will start automatically at Emacs start. A "*slime-repl ccl*" buffer should appear. You can get to that buffer at any time with 'c-c s r' in Emacs. It is a read-eval-print loop, executing inside the Opusmodus App. Use it just as you do the Opusmodus Listener. There are some Opusmodus commands that may be executed from Emacs. They are all on the "om-selector", accessible via "C-c o". That will bring up a query for a single character ("Select [?alqsv]"). You may type one of: ?:    Show this help buffer. a:    Audition and Notation (snippet). l:    Audition and Notation last score. q:    Quit selector. s:    Stop audition. v:    Voices Audition and Notation (snippet). The "snippet" is the lisp form before the insertion point, as in Opusmodus. The commands (other than ? and q) behave as the like-named commands in the Opusmodus Tools/Snippet menu, except they open a new (reusable) notation window, instead of a new notation panel. When connected to Slime, errors in the Opusmodus Listener will bring up a backtrace dialog in the connected Emacs, NOT the CCL debugger in the Listener. Be careful to use the "Return to toplevel" restart from there, not one of the ones that kills the thread, or you'll break your Opusmodus, and will have to restart it. !# ;;; End of HOWTO ;; To start the Swank server when Opusmodus starts, you need to ;; uncomment the (start-swank) expression below: It can take a first ;; arg to change the port from the default of 4005, and a second arg ;; to change the directory from which to load Swank from the default ;; of inside the application bundle (you should only do this if you ;; need to run a different version of Swank, to be compatible with a ;; different version of Slime in your Emacs). (in-package :om) ; (start-swank) Janusz
  12. Like
    torstenanders reacted to opmo in Micropolyphony (coming soon)   
    MICROPOLYPHONY is a polyphonic musical texture developed by György Ligeti which consists of many lines of dense canons moving at different tempos or rhythms, thus resulting in tone clusters vertically. According to David Cope, "micropolyphony resembles cluster chords, but differs in its use of moving rather than static lines"; it is "a simultaneity of different lines, rhythms, and timbres".
     
    Example with two choirs:
     

       
  13. Thanks
    torstenanders got a reaction from Stephane Boussuge in Getting precompiled code (e.g., quicklisp, quicklisp libraries, swank, own libraries) running again on recent Opusmodus versions   
    Dear all,
     
    After updating to a recent Opusmodus version 1.3, I ran into some errors when loading code that had been loaded and compiled before, e.g., quicklisp, quicklisp libraries, swank (the interface that allows using Emacs Slime with Opusmodus), and my own Lisp libraries. The errors I saw were rather cryptic, like the following:
     
    Error: The value "CL" is not of the expected type list.
    While executing: (:internal ccl::operation-on-all-specs ccl::%define-package), in process Listener-1(7).
     
    After exchanges with Janusz (thanks a lot for your help!) I learnt that the underlying Common Lisp version of Opusmodus had been upgraded to CCL version 1.12, and the format of compiled files (fasl files or dx64fsl files) of this version had changed.
     
    So, in case you run into similar problems, these can be fixed simply by deleting all previously compiled files (which Lisp stores if they do not change to speed up the load process), so that the Lisp compiler has to compile them again. In the folder  ~/.cache/common-lisp just delete any folders starting with ccl-, so that all compiled files in this directory are compiled again.
     
    Best,
    Torsten
  14. Like
    torstenanders got a reaction from LdBeth in Out-of-the-box algorithms   
    > more high-level algorithms
     
    I cannot answer your question concerning built-in algorithms, but if you are looking for further ideas what could be added, here is some related literature. 
     
    A good general overview of algorithmic composition techniques, from a technical point of view. 
    Nierhaus, G. (2009) Algorithmic Composition: Paradigms of Automated Music Generation. Wien, New York: Springer.   Discussions of compositional applications in OpenMusic (likewise implemented in Common Lisp, though the main interface is a visual language) by various composers. Agon, C. et al. (eds.) (2006) The OM Composer’s Book. 1. Delatour France. Bresson, J. et al. (eds.) (2008) The OM Composer’s Book. 2. Editions Delatour France / Ircam. Hirs, R. & Gilmore, B. (eds.) (2009) Contemporary Compositional Techniques and OpenMusic. Collection Musique/Sciences. IRCAM/Delatour. Bresson, J. et al. (eds.) (2016) The OM Composer’s Book . 3. Paris; Sampzon: Editions Delatour France.  
    Most of you likely already know the book by Nigel Morgan, containing discussions of compositional applications in Opusmodus itself. 
    Morgan, N. & Legard, P. (2015) Parametric Composition: Computer-Assisted Strategies for Human Performance. West Yorkshire, UK: Tonality Systems Press.  
    The perhaps most important algorithmic composition technique of Common Music (also implemented in common Lisp) and SuperCollider are patterns / item streams, which can be nested. 
    http://commonmusic.sourceforge.net/cm/res/doc/cm.html#patterns  Taube, H. (2004) Notes from the Metalevel. London and New York: Taylor & Francis. Online: http://www.moz.ac.at/sem/lehre/lib/cm/Notes from the Metalevel/00/contents.html   The libraries of the venerable PatchWork and its successors PWGL and OpenMusic (all Common Lisp) provide ideas for various approaches, some already mentioned above. Below are links to relevant link collections.  OpenMusic libraries: http://repmus.ircam.fr/openmusic/libraries PWGL libraries: http://www2.siba.fi/pwgl/downloads.html   Another successful technique, implemented in multiple PWGL and OpenMusic libraries and beyond is constraint programming. I did a lot of research in this area and therefore quote some own publication here. Anders, T. & Miranda, E. R. (2011) Constraint Programming Systems for Modeling Music Theories and Composition. ACM Computing Surveys. 43 (4), 30:1–30:38. Online: https://pdfs.semanticscholar.org/7d0e/783e5bb1c35a871a45e72fddaf7bf3db5d28.pdf.   Of course, there is much more literature on algorithmic composition (computer-aided composition) out there, but the above literature gives a good starting point to study more general composition techniques and their applications. 
      Best, Torsten  
  15. Like
    torstenanders got a reaction from AM in Change Velocity Repeating Notes   
    The best document combining both worlds is likely the following. This was an internal textbook of the algorithmic composition teacher Paul Berg at the Sonology course at the Royal Conservatory of The Hague (the author of the composition system AC Toolbox, https://www.actoolbox.net), but it is unprinted, just a copy of a text processor document for internal use, and difficult to obtain (I only have a hard copy I got from a friend). 
     
    Berg, Paul (n.d.) Elements of Design. An introduction to Programming with Common Lisp. 
  16. Like
    torstenanders got a reaction from AM in Change Velocity Repeating Notes   
    http://www.gigamonkeys.com/book/
     
    Common Lisp Books | Common Lisp
    LISP-LANG.ORG Books about Common Lisp  
    For a more music-related introduction to Common Lisp you might want to look at the following books. These books teach algorithmic composition with Common Lisp. The above books introducing only Common Lisp are far more comprehensive on that matter, but you might prefer learning some foundations first within a  musical context.
     
     
    Morgan, N. & Legard, P. (2015) Parametric Composition: Computer-Assisted Strategies for Human Performance. West Yorkshire, UK: Tonality Systems Press. Sorry! Something went wrong!
    WWW.AMAZON.COM Introduces Opusmodus along with some Lisp.
     
     
    Taube, H. (2004) Notes from the Metalevel. London and New York: Taylor & Francis. Sorry! Something went wrong!
    WWW.AMAZON.COM Code examples online: http://www.moz.ac.at/sem/lehre/lib/cm/Notes from the Metalevel/00/contents.html This book introduces the algorithmic composition system Common Music, along with Lisp fundamentals.     Algorithmic Composition: A Gentle Introduction to Music Composition Using Common LISP and Common Music
    https://quod.lib.umich.edu/s/spobooks/bbv9810.0001.001/1:3/--algorithmic-composition-a-gentle-introduction-to-music?rgn=div1;view=fulltext
    I have not read this one...
  17. Like
    torstenanders got a reaction from opmo in Change Velocity Repeating Notes   
    The best document combining both worlds is likely the following. This was an internal textbook of the algorithmic composition teacher Paul Berg at the Sonology course at the Royal Conservatory of The Hague (the author of the composition system AC Toolbox, https://www.actoolbox.net), but it is unprinted, just a copy of a text processor document for internal use, and difficult to obtain (I only have a hard copy I got from a friend). 
     
    Berg, Paul (n.d.) Elements of Design. An introduction to Programming with Common Lisp. 
  18. Thanks
    torstenanders reacted to Stephane Boussuge in Controlling Counterpoint Output   
    Here i'm applying in bar 3 soprano part the method t-3 to event 6 and event 7:
     
    (setf p01 '((-e e4 stacc g4 stacc b4 stacc s e4 fs4 leg e g4 leg fs4 b3 leg))) (setf p02 '(((leg -e b5 b5 a5 a5 eb5 q eb5 leg)))) (setf voices (counterpoint (list p01 p02) '( ((1 -) :methods (- -) :polyphony (7 o)) ((2 1) :methods (t-12 -) :polyphony (7 o)) ((2 1) :methods (((t-3 1 (6 7)) t-5) r) :polyphony (7 ?)) ))) (ps 'gm :fl (list (assemble-voices 1 voices)) :cl (list (assemble-voices 2 voices)) :tempo '(80) :time-signature '(4 4) :start 1) SB.
  19. Like
    torstenanders reacted to opmo in OPUSMODUS 2.0 OUT NOW!   
  20. Like
    torstenanders got a reaction from JulioHerrlein in OLD VSL Gig Files articulations   
    Hi Julio, 
     
    Could you perhaps share your final  setup files for the old VSL instrument library with the community?
     
    Thanks!
     
    Best,
    Torsten
  21. Like
    torstenanders got a reaction from Stephane Boussuge in Neo-Riemannian approach (Tonnetz, etc.)   
    > Achim Bornhoeft and I spent some time talking and playing with the Neo-Riemann theory with an outcome of a diagram and a function
     
    Thanks for sharing. Do I understand correctly that these transformations always assume triads? 
     
    Of course, one can always extend the triads afterwards...
     
    Best,
    Torsten
  22. Like
    torstenanders reacted to opmo in Opusmodus 1.4 - Counterpoint   
    Upcoming ver. 1.4
    Function: COUNTERPOINT
     


       
     
     
  23. Like
    torstenanders got a reaction from AM in lisp / special divide - help needed   
    For a generic solution, you could use some function split-if that expects a Boolean function as argument comparing two consecutive pairs, and always splits a sublist if the Boolean function returns True. I don't have such a Lisp function at hand right now, but of an algorithm idea here is a similar Python function, only that this expects a Boolean function of a single argument only. If you port this function to Lisp, you could then generalise it by checking the number of arguments the given Boolean function expects, and it apply it always to the corresponding consecutive number of elements of xs.
     
    def split_if(fun, xs): """ Splits `xs` (list) into sublists based on a test. Starts a new sublist at every element for which Boolean function `fun` returns true. Examples -------- >>> split_if(lambda x: x % 3 == 0, [0, 1, 2, 3, 4, 5]) [[0, 1, 2], [3, 4, 5]] >>> split_if(lambda x: x % 3 == 0, [1, 2, 3, 4, 5, 6, 7]) [[1, 2], [3, 4, 5], [6, 7]] NOTE: Internally, `split_if` skips the first element of `xs`. So, if `fun` is stateful, it should initialise its state using that first element. For an example, see implementation of `format_api.split_into_sections`. """ result_list = [] start = 0 # Collect new list up to x whenever fun(x) == true, but not before first element for index, x in enumerate(xs[1:]): if fun(x): result_list.append(xs[start:index+1]) start = index+1 if start == 0: return [xs] result_list.append(xs[start:]) return result_list  
     
    Here is another approach as well with a Lisp function from my toolbox expecting a list of positions where to split the list. You could find those positions by iterating over conservative pairs of your list elements with the function positions-if listed below.
     
    OK, none of this is a ready made solution, but all the necessary pieces are there 🙂  I need to head back to work now ....
     
    Torsten
     
    (defun subseqs (sequence positions &optional end) "Splits `sequence' into a list of subsequences split at `positions'. Each element in `positions' specifies a position at which a new sublist starts. ; (subseqs '(0 1 2 3 4 5 6) '(0 2 4)) => ((0 1) (2 3) (4 5 6)) ; (subseqs '(0 1 2 3 4 5 6) '(2 4 6) 5) => ((2 3) (4)) `positions' are implicitly sorted and positions beyond end are excluded. " (let* ((updated-pos (sort (if end (remove-if #'(lambda (x) (>= x end)) positions) positions) #'<)) (full-pos (append updated-pos (list (if end end (length sequence)))))) (mapcar #'(lambda (start end) (subseq sequence start end)) (butlast full-pos) (rest full-pos)) )) (defun positions-if (predicate sequence &key key (start 0)) "Like the Common Lisp function `position-if', but returns all positions in `sequence' that match `predicate'. ; (positions-if #'oddp '((1) (2) (3) (4)) :key #'car) ; => (0 2)" (labels ((aux (predicate sequence &key key (start 0) accum) (let ((pos (position-if predicate sequence :start start :key key))) (if pos (aux predicate sequence :start (1+ pos) :key key :accum (cons pos accum)) (reverse accum))))) (aux predicate sequence :start start :key key))) #| ;; comparison (position-if #'oddp '((1) (2) (3) (4)) :key #'car) |#  
  24. Like
    torstenanders got a reaction from Stephane Boussuge in Negative Harmony Function   
    Just a brief follow-up. While Partch's book is obviously available in English, the other authors all wrote in German. More recent Neo-Riemannian theory is often pretty math-heavy, so also somewhat hard to digest for us composers. To get a taste of these harmonic theories in a highly developed form (with dualism throughout, but that is only one facet) delivered by a practicing composers, you might want to have a look at the recent English translation and discussion of Sigfrid Karg-Elert's book Acoustic Determination of Pitch, Chord and Function from 1930.
     
    Byrne, D. A. (2018) The Harmonic Theories of Sigfrid Karg-Elert: Acoustics, Function, Transformation, Perception. PhD Thesis thesis. University of Cincinnati. Online available (with a somewhat slow download speed) at https://etd.ohiolink.edu/apexprod/rws_olink/r/1501/10?p10_etd_subid=162928&clear=10   Warning: this is not for the faint of heart 🙂   Best, Torsten
  25. Thanks
    torstenanders got a reaction from loopyc in Negative Harmony Function   
    Are you simply looking for an invert function, e.g., pitch-invert? 
     
    (pitch-invert '(c4 d4 e4)) => (c4 bb3 gs3)  
    This function inverts (mirrors) around the first pitch by default. If you are looking for retaining the original ambitus, you might want to instead you my function invert-in-ambitus (https://tanders.github.io/tot/sources/pitch.html#_g251910).
     
    (invert-in-ambitus '(c4 e4 g4))  => (g4 eb4 c4)
    BTW, when you are specifically talking about a harmonic context in which you are "mirroring" chords, there exist extensive music theories based on this idea already. The notion of minor chords as the mirror image of major chords, and its implications on harmonic functions (tonic, dominant, subdominant etc.) was in detail explored under the label of dualism by theorists like Hugo Riemann, Arthur von Öttingen and Sigfrid Karg-Elert. They also already generalised this notion for microtonal music. Likely independently of these theorists exploring the notion of dualism, Harry Partch's concept of otonality and utonality is also based on this idea, now firmly in the field of microtonal music. In microtonal harmonic theory I came across this notion also elsewhere (e.g., discussed by the composers and theorists of ekmelic music like Franz Richter Herf, which may have arrived there independently as well.
     
    Anyway, this harmonic concept in general is so basic and fundamental that I would not be surprised it would have been studied by the likes of Pythagoras already...
     
    Best,
    Torsten
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy