Jump to content
Sign in to follow this  
TangoTango

Providing code examples to students

Recommended Posts

Hello,

 

I'm making a presentation on 12-tone composition in an educational context. While my focus is on a 12-tone map (including OMN and OpusModus code) I want to begin with some more simple examples e.g. a Canon, a Fugue, first second and third species counterpoint.

 

While I can create a canon, counterpoint and a fugue myself with a bit of time, it would be much less time-consuming for me if I were able to use existing examples. Is there an existing library of OMN examples of these types of compositions?

If not, I'm happy to post mine once I'm done.

Tom

Share this post


Link to post
Share on other sites

Such an example will be very useful indeed.

Looking forward to see how you made it work.

Best, J

Share this post


Link to post
Share on other sites

Dear Friends,

 

Here 's a way to produce chords from 12 tone rows (Schoenberg opus 25 row):

(setf op25arnie '(e4 f4 g4 cs4 fs4 ds4 gs4 d4 b4 c4 a4 as4))

(respell (gen-chord2 20 '(3 3 3 1) op25arnie))

Hope it helps a little.

 

Best,

Julio

 

 

Also check this !

And the Nigel Morgan Parametric Composition book, of course !

More specific, to keep track of the row:

(setf op29webernLib (expand-libraries '(library vienna webern r19)))
(setf rowint (pitch-to-integer op29webernLib))
(setf pitches (gen-repeat 10 op29webernLib))
(setf lengths (span pitches (gen-repeat 10 '(s s s s -s s e -s s s -s e e -q q))))
(setf text
      (span pitches rowint))
(def-score Stage-1
           (:key-signature 'chromatic 
            :time-signature '(4 4) 
            :tempo 80
            :layout (treble-layout 'piano-rh))
  (piano-rh
   :length lengths
   :pitch pitches
   :text text
   ;:velocity dynamics
   :channel 1
   :sound 'gm
   :program 'acoustic-grand-piano)
)

Best,

Julio

Share this post


Link to post
Share on other sites
(setf op25arnie '(e4 f4 g4 cs4 fs4 ds4 gs4 d4 b4 c4 a4 as4))

(respell (gen-chord2 20 '(3) op25arnie :offset '(2 1 2 3)))

Using the :offset parameter in the gen-chord2 function could be interesting too, for example for keeping notes between chords for smoother transitions with common tones.

 

S.

Share this post


Link to post
Share on other sites

Thank you for the help everyone! These are great for my section on serialism.

 

I've switched my focus to serialism and neural networks (I found an example that generates content from simple Irish Folk songs in .mid files). My focus is on the ever-changing relationship that composers have with rules and procedures.

 

https://www.mathworks.com/matlabcentral/fileexchange/69632-code-for-webinar-deep-learning-for-signals-and-sound

 

Tom

Share this post


Link to post
Share on other sites

"My focus is on the ever-changing relationship that composers have with rules and procedures."

 

some ideas/names...?

 

=> MOZART  https://en.wikipedia.org/wiki/Musikalisches_Würfelspiel

=> the LIGETI-analysis of BOULEZ's STRUCTURES ?

=> MESSIAEN in general: https://monoskop.org/File:Messiaen_Olivier_The_Technique_of_My_Musical_Language.pdf, or  specific "MODE DE VALEURS ET D'INTENSITÉS"

=> GOTTFRIED MICHAEL KöNIG

=> XENAKIS (the "ST"-pieces?)

=> HAUER https://de.wikipedia.org/wiki/Zwölftonspiel

 

 

 

 

Share this post


Link to post
Share on other sites

> While I can create a canon, counterpoint and a fugue myself with a bit of time, it would be much less time-consuming for me if I were able to use existing examples. Is there an existing library of OMN examples of these types of compositions?

 

I cannot offer ready-made examples, but a constraint-based library with various counterpoint (and also harmony) rules ready-made.  

 

Cluster engine implements the constraint solver, and many functions for applying user-defined rules to various score contexts in a flexible way (e.g., consecutive notes in certain voices, simultaneous notes across voices at certain metric positions etc). 

https://github.com/tanders/cluster-engine

 

Cluster rules provides a collection of ready-made rules for the cluster engine library.

https://github.com/tanders/cluster-rules

 

Both libraries were initially developed for PWGL, but we ported them to plain Common Lisp to make them usable, e.g., in Opusmodus (where I already used both) and the Max<->Lisp interface I just mentioned in other message.

 

There are some demo/test examples that come with the library (https://github.com/tanders/cluster-rules/blob/master/tests/first-tests.lisp). More extensive documentation (tutorials) are available with the original PWGL versions of the libraries.

 

Some code to smoothly interface the Cluster Library with Opusmodus is part of my tot library (e.g. in the file https://github.com/tanders/tot/blob/master/sources/constraints.lisp). For example, there are means to transform Cluster Library scores into Opusmodus scores (actually, my variant of it, see the docs) and some more complex functions that could be seen as example use cases. For example, the function revise-score-harmonically, expects an existing score that you might create with whatever Opusmodus methods, and some underlying harmony definitions, and that re-harmonises the score accordingly, taking some counterpoint rules etc. into account.

 

I hope the available doc of these packages helps (of which there is also some HTML version online). I cannot provide any more help at this stage, as I am currently extremely busy in my new job...

 

Best,

Torsten

Share this post


Link to post
Share on other sites

Thanks for a very informative post. Would someone be willing to explain the four integers included in the 

:offset '(2 1 2 3)

parameter from Stephane's reply? It is clear why the parameter is used; I just hope to better understand the purpose of the integer(s) used in order to better control the parameter.

 

Many thanks!

Share this post


Link to post
Share on other sites

>> While I can create a canon, counterpoint and a fugue myself with a bit of time, it would be much less time-consuming for me if I were able to use existing examples. Is there an existing library of OMN examples of these types of compositions?

> I cannot offer ready-made examples, but a constraint-based library with various counterpoint (and also harmony) rules ready-made.  

 

Following up my own comments, some entry level introduction to the libraries Cluster Engine and Cluster rules is offered by a video I prepared for my students last autumn.

 

https://www.youtube.com/watch?v=xPXIRmH9rZc&list=PLmbpscTxjn_DrdDXD5v7z0GzQRNKM5VyQ&index=9

 

This video uses PWGL instead of Openmusic, but you only need to mentally replace PWGL boxes with Lisp functions of the same name to get pretty much the equivalent Opusmusic code. Also, this tutorial only scratches the surface of what can be done with these libraries, but I hope it can give an initial idea how things are approached in these libraries and for going beyond that a relatively easy approach is simply to study the pre-programmed rules in the Cluster Rules library and trying to combine rules for your own purposes. Once you miss a specific rule you would like to have, the library Cluster Engine provides the tools for defining your own rules on a high level of abstraction (specifically, it provides many abstractions that help to easily apply your rule to a specific score context, like the pitches of simultaneous notes of certain parts). 

 

This video is the last of a series of introduction-level videos on algorithmic composition with PWGL... 

 

https://www.youtube.com/playlist?list=PLmbpscTxjn_DrdDXD5v7z0GzQRNKM5VyQ

 

Share this post


Link to post
Share on other sites

Thanks, Torsten. This is very informative.

All the best,

Zvony

Share this post


Link to post
Share on other sites

The integers are the number of pitch to shift for the offset.

If chords size parameter is 3, an offset of 1 will keep 2 pitch in common, offset of 2 will keep one pitch etc...

(gen-chord2 8 3 '(c4 d4 e4 f4 g4 a4 b4 c5 d5 e5 f5 g5 a5 b5) :offset '(0 1 2 3 0 3 2 1))
=> (c4d4e4 d4e4f4 f4g4a4 b4c5d5 b4c5d5 e5f5g5 g5a5b5 a5b5c4)

The :offset is the shift into the pitch list but related from chord to chord.

Another example for clarity:

(gen-chord2 2 3 '(c4 d4 e4 f4 g4 a4 b4 c5 d5 e5 f5 g5 a5 b5) :offset '(1 5))
=> (d4e4f4 b4c5d5)

SB.

Share this post


Link to post
Share on other sites

Many thanks, Stephane. This is very helpful!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Topics

    • By AM
      dear all
      here is a setup for playing midi-files/scores in polytempi / follow the instructions and have fun!
      just ask if you have some questions...
       
      greetings
      andré
       
      - personally i will use it for exact sample/e-player perfomance with my pieces which are working with "Technology-Assisted Conducting"
      http://polytempo.zhdk.ch ... in future i will do it all directly from OPMO or lisp - "live score generating" + polytempo-conducting + e-player)
      - i have already done this with my piece MODULAR FORM  but not all controlled by LISP/OPMO, so next step is doing it all in OPMO/LISP
       
      ...some explanations about the piece....
      andré meier - trompete | komposition - modular form
      WWW.ANDREMEIER.ORG  
       
       
      greetings
      andré
       
      Polytempo - Wikipedia
      EN.WIKIPEDIA.ORG  
      ;;; POLYTEMPO-PLAY ;;; with a MAX-patch (from my friend thomas peter) and some OSC-send i can play the same/different midis (up to 30) ;;; in different tempos in parallel - any combination, with precise coordination ;;; also possible: change global velocity (means: change velocity inside midi) ;;; time-delay (start) in ms ;;; 1) OSC-send functions: (defparameter *out-socket* (make-socket :type :datagram)) (defparameter *remote-host* "127.0.0.1") (defparameter *remote-port* 7500) (defun udpsend (&rest args) (let ((message (apply' osc::encode-message args))) (send-to *out-socket* message (length message) :remote-host *remote-host* :remote-port *remote-port*))) ;;; 2) a) put the MAX-player-folder on desktop ;;; b) start midiplayer.maxpat ;;; c) midiplayer: define your output source in [midiout@name "from MAX 1"] ;;; d) the MIDIS must be placed in the midi-folder (inside MAX-player-folder) ;;; 3) generate SCORE (here a nonsense example) (setf omn (make-omn :pitch (setf pitches (filter-repeat 1 (flatten (gen-sort (rnd-air :type :pitch :seed 45) :step 5 :sort '> :seed 123)))) :length (gen-length '(1) 1/32) :velocity (pitch-to-velocity 'p 'mf pitches :type :float) :span :pitch)) (def-score sorted-whitenoise (:title "sorted-whitenoise" :key-signature 'atonal :time-signature '(4 4) :tempo 60 :layout (grand-layout 'inst)) (inst :omn omn :port 0 :channel 1 :sound 'gm :program 'acoustic-grand-piano)) ;;; 4) COMPILE that score into your Max-Player/midi-folder => PATH+NAME!!! (compile-score 'sorted-whitenoise :file "your-path/sorted-whitenoise") ;;; 5) play it by evaluate UPSEND -> some examples ;;; /eplayer / midi-name / tempo-factor / velocity factor / time-delay in ms (udpsend "/eplayer" "sorted-whitenoise" 1.0 0.5 0) ;; originaltempo, velocity 0.5 (udpsend "/eplayer" "sorted-whitenoise" 2.3 1.0 0) ;; (* tempo 2.3) etc... (udpsend "/eplayer" "sorted-whitenoise" 0.375 1.0 2000) ;; (* tempo 0.375 with startdelay 2000ms) (udpsend "/eplayer" "stop") ; you can stop with that ;;; a tempo-relations => 23:17:13:9:3:2 -> a complex example with time-delays ;;; also possible with every and different midis you like (progn (udpsend "/eplayer" "sorted-whitenoise" 2.3 1.0 0) (udpsend "/eplayer" "sorted-whitenoise" 0.3 0.8 0) (udpsend "/eplayer" "sorted-whitenoise" 0.2 0.4 0) (udpsend "/eplayer" "sorted-whitenoise" 1.3 1.0 10000) (udpsend "/eplayer" "sorted-whitenoise" 1.7 0.9 16000) (udpsend "/eplayer" "sorted-whitenoise" 0.9 0.7 20000)) (udpsend "/eplayer" "stop") ; you can stop with that  
       
      Max_Player_19-08-23.zip example.aiff
      goldberg_13_11.aiff example_11_7_5_3_2.aiff
    • By torstenanders
      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
    • By AM
      hi all
       
      i would like to code a NAND gate with more then two input-items (as extension to AND etc...). here is a simple version of the NAND function with two inputs, but i don't know how to exapnd it to n-inputs without putting the the inputs to in a list (like lisp-internal AND / OR)...
       
      https://en.wikipedia.org/wiki/NAND_gate
       
      i dont't want it:
      (nand '(t t t nil))  but like to have
      (nand t nil nil t t t)  
      when i get a solution for that i will code an XOR, NOR etc....
       
       
       
      so the "problem" is: how to manage in DEFUN more then two inputs (don't work with &optional, i think) i tried it and failed)...
      any ideas, lisp-nerds? 🙂 thanx! andré
       
      ;;; easy with a specific number of input-items - that works! (defun nand (a b) (not (and a b))) (nand t t) => nil (nand nil nil) => t (nand nil t) => t ;;; i like to have an input perhaps like that - with any number of input-items, like lisp's AND / OR (nand t t t t) (nand nil t t t nil t t t nil) ...  
×
×
  • Create New...